Docker-based Dokku deployment with multiple processes in one app #7262
-
(dokku version 0.35.5) I've been struggling to deploy a Django and Celery services in one app with a Dockerfile-based Dokku deployment. My app is built with this Dockerfile:
#!/bin/bash
set -e
if [ "$1" = "worker" ]; then
printf '\nStarting worker via entrypoint\n'
exec celery -A myapp worker --loglevel=DEBUG --max-tasks-per-child=100 --optimization=fair
elif [ "$1" = "web" ]; then
printf '\nStarting web via entrypoint\n'
exec gunicorn --chdir /app/myapp -b :8000 myapp.wsgi:application --log-level debug --access-logfile - --error-logfile -
else
exec "$@"
fi web: web
worker: worker My understanding is that for the push/deploy to succeed, a process needs to be running, which is why I pass CMD "web". Ideally, I don't have any CMD line in the Dockerfile, and instead use the Procfile to start both services in their respective ways, to support the completion of the deploy. If I don't have a CMD line, when I push/deploy:
Which is a fail, because the app wasn't started (neither web or worker). However if I include the CMD line, the deployment is successful and the Procfile seemingly gets ignored - if I check the logs of the worker (celery), I get:
which is a gunicorn log, suggesting that worker was started with the "web" arg to the entrypoint. Am I doing something wrong? Presumably this case was designed for. Why does the Dockerfile need a CMD command, when I define an entrypoint with a Procfile, per https://dokku.com/docs/processes/process-management/#procfile - specifically: What I've confirmed:
Ideally, I run these two as separate processes within the one app, given the image is the same for both services. Happy to generate any versions/logs on request to help debug. Any help would be greatly appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
Update:
Any help on debugging this specific issue would be greatly appreciated :) |
Beta Was this translation helpful? Give feedback.
-
ok I have stumbled across a solution.
This doesn't feel like an ideal pattern, I think the biggest issue is the disabling of the healthchecks. But perhaps some custom healthchecks can be defined in But it works! The correct commands are used to spin up each service/process in the app. |
Beta Was this translation helpful? Give feedback.
-
Where exactly is your Procfile located? We don't look for |
Beta Was this translation helpful? Give feedback.
ok I have stumbled across a solution.
entrypoint.sh
appropriately, to use the DYNO var to determine how to start the servicedokku ps:scale backend worker=1 web=1
This doesn't feel like an id…