forked from ungleich-public/dynamicweb
Pick the container role with ROLE instead of a command
This commit is contained in:
parent
d488b565d9
commit
9ee1a3bd49
2 changed files with 14 additions and 3 deletions
|
|
@ -28,13 +28,13 @@ services:
|
|||
|
||||
web:
|
||||
<<: *app
|
||||
command: sh start-web.sh
|
||||
ports:
|
||||
- "8000:8000"
|
||||
|
||||
celery:
|
||||
<<: *app
|
||||
command: celery -A dynamicweb worker -l info
|
||||
environment:
|
||||
ROLE: celery
|
||||
|
||||
volumes:
|
||||
pgdata:
|
||||
|
|
|
|||
|
|
@ -47,4 +47,15 @@ for _ in range(60):
|
|||
sys.exit("postgres at %s:%s not reachable" % (host, port))
|
||||
PYEOF
|
||||
|
||||
exec "$@"
|
||||
# Explicit arguments win (docker compose run web python manage.py shell);
|
||||
# otherwise ROLE decides what this container does: web (default), celery, or
|
||||
# migrate (run the migrations and exit).
|
||||
if [ "$#" -gt 0 ]; then
|
||||
exec "$@"
|
||||
fi
|
||||
case "${ROLE:-web}" in
|
||||
web) exec sh start-web.sh ;;
|
||||
celery) exec celery -A dynamicweb worker -l "${CELERY_LOGLEVEL:-info}" ;;
|
||||
migrate) MIGRATE_ONLY=True exec sh start-web.sh ;;
|
||||
*) echo "unknown ROLE '$ROLE' (web, celery, migrate)" >&2; exit 1 ;;
|
||||
esac
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue