diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4488e37d6ea..b59f975830e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,8 +7,8 @@ on: - '.github/workflows/deploy.yml' - '.github/workflows/redeploy.yml' - 'bin/logger' - - 'conf/development.ini' - - 'production.ini' + - 'conf/development-app.ini' + - 'app.ini' - 'conf/supervisord*.conf' - 'docs/*' - 'requirements/*.in' diff --git a/.github/workflows/data_tasks.yml b/.github/workflows/data_tasks.yml index cc33e1f1ef2..8f150465282 100644 --- a/.github/workflows/data_tasks.yml +++ b/.github/workflows/data_tasks.yml @@ -55,5 +55,5 @@ jobs: Env: ${{ inputs.Environment }} Timeout: 7200 Region: ${{ inputs.Region }} - Command: 'newrelic-admin run-program python bin/run_data_task.py --config-file conf/production.ini --task ${{ inputs.Task }}' + Command: 'newrelic-admin run-program python bin/run_data_task.py --config-file conf/app.ini --task ${{ inputs.Task }}' secrets: inherit diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index ed03f0fad63..97a9bb20408 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -12,7 +12,7 @@ on: - '.github/*' - 'bin/create-testdb' - 'bin/install-python' - - 'conf/development.ini' + - 'conf/development-app.ini' - 'conf/supervisord-dev.conf' - 'conf/websocket-dev.ini' - 'docs/*' diff --git a/.github/workflows/report_refresh.yml b/.github/workflows/report_refresh.yml index 657c3850e69..c2dc08a8b0f 100644 --- a/.github/workflows/report_refresh.yml +++ b/.github/workflows/report_refresh.yml @@ -15,5 +15,5 @@ jobs: Env: 'prod' Timeout: 3600 Region: 'all' - Command: 'newrelic-admin run-program python bin/run_data_task.py --config-file conf/production.ini --task report/refresh' + Command: 'newrelic-admin run-program python bin/run_data_task.py --config-file conf/app.ini --task report/refresh' secrets: inherit diff --git a/Makefile b/Makefile index 6ec0ff2aace..a120a4a2872 100644 --- a/Makefile +++ b/Makefile @@ -57,7 +57,7 @@ devdata: python .PHONY: shell shell: python - @pyenv exec tox -qe dev --run-command 'pshell conf/development.ini' + @pyenv exec tox -qe dev --run-command 'pshell conf/development-app.ini' .PHONY: sql sql: python diff --git a/bin/make_db b/bin/make_db index 5e8681ff6b2..74ff1716024 100644 --- a/bin/make_db +++ b/bin/make_db @@ -45,7 +45,7 @@ def init_search(settings): def main(): - with bootstrap("conf/development.ini") as env: + with bootstrap("conf/development-app.ini") as env: settings = env["registry"].settings init_db(settings) init_search(settings) diff --git a/conf/production.ini b/conf/app.ini similarity index 88% rename from conf/production.ini rename to conf/app.ini index bb45d3e8f02..bd2ade24cc8 100644 --- a/conf/production.ini +++ b/conf/app.ini @@ -9,6 +9,11 @@ use: call:h.app:create_app [filter:proxy-prefix] use: egg:PasteDeploy#prefix +[server:main] +use: egg:gunicorn#main +bind: unix:/tmp/gunicorn-web.sock +proc_name: web + [loggers] keys = root, alembic, gunicorn.error, h diff --git a/conf/development.ini b/conf/development-app.ini similarity index 89% rename from conf/development.ini rename to conf/development-app.ini index 42c9fa3f786..b9d47c8e022 100644 --- a/conf/development.ini +++ b/conf/development-app.ini @@ -22,6 +22,15 @@ secret_key: notverysecretafterall sqlalchemy.url: postgresql://postgres@localhost/postgres +[server:main] +use: egg:gunicorn#main +host: 0.0.0.0 +port: 5000 +proc_name: web +graceful_timeout: 0 +timeout: 0 +errorlog: - + [pshell] setup = h.pshell.setup diff --git a/conf/gunicorn-dev.conf.py b/conf/gunicorn-dev.conf.py deleted file mode 100644 index 9b2156f02a1..00000000000 --- a/conf/gunicorn-dev.conf.py +++ /dev/null @@ -1,3 +0,0 @@ -bind = "0.0.0.0:5000" -graceful_timeout = 0 -timeout = 0 diff --git a/conf/gunicorn-websocket-dev.conf.py b/conf/gunicorn-websocket-dev.conf.py deleted file mode 100644 index a1b4a398a8c..00000000000 --- a/conf/gunicorn-websocket-dev.conf.py +++ /dev/null @@ -1,5 +0,0 @@ -bind = "localhost:5001" -worker_class = "h.streamer.Worker" -graceful_timeout = 0 -workers = 2 -worker_connections = 8 diff --git a/conf/gunicorn-websocket-monolithic.conf.py b/conf/gunicorn-websocket-monolithic.conf.py deleted file mode 100644 index 2bc7f926c90..00000000000 --- a/conf/gunicorn-websocket-monolithic.conf.py +++ /dev/null @@ -1,5 +0,0 @@ -bind = "unix:/tmp/gunicorn-websocket.sock" -worker_class = "h.streamer.Worker" -graceful_timeout = 0 -workers = 2 -worker_connections = 8192 diff --git a/conf/gunicorn-websocket.conf.py b/conf/gunicorn-websocket.conf.py deleted file mode 100644 index 12ed214038f..00000000000 --- a/conf/gunicorn-websocket.conf.py +++ /dev/null @@ -1,5 +0,0 @@ -bind = "0.0.0.0:5000" -worker_class = "h.streamer.Worker" -graceful_timeout = 0 -workers = 2 -worker_connections = 8192 diff --git a/conf/gunicorn.conf.py b/conf/gunicorn.conf.py deleted file mode 100644 index d59b887b3d1..00000000000 --- a/conf/gunicorn.conf.py +++ /dev/null @@ -1 +0,0 @@ -bind = "unix:/tmp/gunicorn-web.sock" diff --git a/conf/supervisord-dev.conf b/conf/supervisord-dev.conf index 6d6faec3f2a..00745af10a6 100644 --- a/conf/supervisord-dev.conf +++ b/conf/supervisord-dev.conf @@ -3,7 +3,7 @@ nodaemon = true silent = true [program:web] -command = gunicorn --paste conf/development.ini --config conf/gunicorn-dev.conf.py +command = pserve --reload conf/development-app.ini stdout_events_enabled=true stderr_events_enabled=true stopsignal = KILL @@ -11,7 +11,7 @@ stopasgroup = true autostart = %(ENV_ENABLE_WEB)s [program:websocket] -command = gunicorn --paste conf/websocket-dev.ini --config conf/gunicorn-websocket-dev.conf.py +command = pserve --reload conf/websocket-dev.ini stdout_events_enabled=true stderr_events_enabled=true stopsignal = KILL diff --git a/conf/supervisord.conf b/conf/supervisord.conf index c6309cebc22..322a6a8f017 100644 --- a/conf/supervisord.conf +++ b/conf/supervisord.conf @@ -13,7 +13,7 @@ stderr_events_enabled=true autostart = %(ENV_ENABLE_NGINX)s [program:web] -command=newrelic-admin run-program gunicorn --paste conf/production.ini --config conf/gunicorn.conf.py +command=newrelic-admin run-program pserve conf/app.ini stdout_logfile=NONE stderr_logfile=NONE stdout_events_enabled=true @@ -21,22 +21,13 @@ stderr_events_enabled=true autostart = %(ENV_ENABLE_WEB)s [program:websocket] -command=gunicorn --paste conf/websocket.ini --config conf/gunicorn-websocket.conf.py +command=pserve %(ENV_WEBSOCKET_CONFIG)s stdout_logfile=NONE stderr_logfile=NONE stdout_events_enabled=true stderr_events_enabled=true autostart = %(ENV_ENABLE_WEBSOCKET)s -[program:websocket-monolithic] -command=gunicorn --paste conf/websocket-monolithic.ini --config conf/gunicorn-websocket-monolithic.conf.py -stdout_logfile=NONE -stderr_logfile=NONE -stdout_events_enabled=true -stderr_events_enabled=true -autostart = %(ENV_ENABLE_WEBSOCKET_MONOLITHIC)s -process_name = websocket - [program:worker] command=newrelic-admin run-program hypothesis celery worker --loglevel=INFO stdout_logfile=NONE diff --git a/conf/websocket-dev.ini b/conf/websocket-dev.ini index 30f8123faa8..4f4a327b937 100644 --- a/conf/websocket-dev.ini +++ b/conf/websocket-dev.ini @@ -10,6 +10,17 @@ secret_key: notverysecretafterall # SQLAlchemy configuration -- See SQLAlchemy documentation sqlalchemy.url: postgresql://postgres@localhost/postgres +[server:main] +use: egg:gunicorn#main +host: localhost +port: 5001 +worker_class: h.streamer.Worker +graceful_timeout: 0 +proc_name: websocket +# This is very low so you can see what happens when we run out +workers: 2 +worker_connections: 8 + [loggers] keys = root, gunicorn.error, h diff --git a/conf/websocket-monolithic.ini b/conf/websocket-monolithic.ini index ada4eee45f8..ddab2880dfe 100644 --- a/conf/websocket-monolithic.ini +++ b/conf/websocket-monolithic.ini @@ -1,6 +1,15 @@ [app:main] use: call:h.streamer:create_app +[server:main] +use: egg:gunicorn#main +bind: unix:/tmp/gunicorn-websocket.sock +worker_class: h.streamer.Worker +graceful_timeout: 0 +proc_name: websocket +workers: 2 +worker_connections: 8192 + [loggers] keys = root, gunicorn.error, h.streamer diff --git a/conf/websocket.ini b/conf/websocket-separate.ini similarity index 75% rename from conf/websocket.ini rename to conf/websocket-separate.ini index ada4eee45f8..50642cf5753 100644 --- a/conf/websocket.ini +++ b/conf/websocket-separate.ini @@ -1,6 +1,16 @@ [app:main] use: call:h.streamer:create_app +[server:main] +use: egg:gunicorn#main +host: 0.0.0.0 +port: 5000 +worker_class: h.streamer.Worker +graceful_timeout: 0 +proc_name: websocket +workers: 2 +worker_connections: 8192 + [loggers] keys = root, gunicorn.error, h.streamer diff --git a/h/cli/__init__.py b/h/cli/__init__.py index 1f0861767ee..7c364ca8e4d 100644 --- a/h/cli/__init__.py +++ b/h/cli/__init__.py @@ -36,7 +36,7 @@ def bootstrap(app_url, dev=False): else: raise click.ClickException("the app URL must be set in production mode!") - config = "conf/development.ini" if dev else "conf/production.ini" + config = "conf/development-app.ini" if dev else "conf/app.ini" paster.setup_logging(config) request = Request.blank("/", base_url=app_url) diff --git a/tests/functional/bin/run_data_task_test.py b/tests/functional/bin/run_data_task_test.py index c3efc443b34..fffff26854e 100644 --- a/tests/functional/bin/run_data_task_test.py +++ b/tests/functional/bin/run_data_task_test.py @@ -29,7 +29,7 @@ def test_reporting_tasks(self, environ): sys.executable, "bin/run_data_task.py", "--config-file", - "conf/development.ini", + "conf/development-app.ini", "--task", task_name, ],