move commands from manifest to procfile

cf v3 commands don't appear to support commands in manifest files. They
say that they do, but in practice they fail on cf v3-zdt-push with an
error message "No process types returned from stager". This can be
solved by moving the command from the manifest to a Procfile.

However, the Procfile is part of the source code, and as such is the
same for each app. To get around this, make the Procfile command invoke
a new wrapper script, which checks the NOTIFY_APP_NAME env var and then
calls the correct command
This commit is contained in:
Leo Hemsted
2019-04-09 17:00:54 +01:00
parent 193ff8548c
commit fe77d4f654
2 changed files with 49 additions and 0 deletions

1
Procfile Normal file
View File

@@ -0,0 +1 @@
web: ./scripts/paas_app_wrapper.sh

48
scripts/paas_app_wrapper.sh Executable file
View File

@@ -0,0 +1,48 @@
#!/bin/bash
case $NOTIFY_APP_NAME in
public-api)
unset GUNICORN_CMD_ARGS
scripts/run_app_paas.sh gunicorn -c /home/vcap/app/gunicorn_config.py application
;;
delivery-worker)
scripts/run_app_paas.sh celery -A run_celery.notify_celery worker --loglevel=INFO --concurrency=11 \
-Q job-tasks,retry-tasks,create-letters-pdf-tasks,letter-tasks 2> /dev/null
;;
delivery-worker-database)
scripts/run_app_paas.sh celery -A run_celery.notify_celery worker --loglevel=INFO --concurrency=11 \
-Q database-tasks 2> /dev/null
;;
delivery-worker-research)
scripts/run_app_paas.sh celery -A run_celery.notify_celery worker --loglevel=INFO --concurrency=5 \
-Q research-mode-tasks 2> /dev/null
;;
delivery-worker-sender)
scripts/run_multi_worker_app_paas.sh celery multi start 3 -c 10 -A run_celery.notify_celery --loglevel=INFO \
-Q send-sms-tasks,send-email-tasks
;;
delivery-worker-periodic)
scripts/run_app_paas.sh celery -A run_celery.notify_celery worker --loglevel=INFO --concurrency=2 \
-Q periodic-tasks,statistics-tasks 2> /dev/null
;;
delivery-worker-priority)
scripts/run_app_paas.sh celery -A run_celery.notify_celery worker --loglevel=INFO --concurrency=5 \
-Q priority-tasks 2> /dev/null
;;
# Only consume the notify-internal-tasks queue on this app so that Notify messages are processed as a priority
delivery-worker-internal)
scripts/run_app_paas.sh celery -A run_celery.notify_celery worker --loglevel=INFO --concurrency=11 \
-Q notify-internal-tasks 2> /dev/null
;;
delivery-worker-receipts)
scripts/run_app_paas.sh celery -A run_celery.notify_celery worker --loglevel=INFO --concurrency=11 \
-Q ses-callbacks 2> /dev/null
;;
delivery-worker-service-callbacks)
scripts/run_app_paas.sh celery -A run_celery.notify_celery worker --loglevel=INFO --concurrency=11 \
-Q service-callbacks 2> /dev/null
;;
*)
echo "Unknown notify_app_name $NOTIFY_APP_NAME"
exit 1
;;
esac