services: redis: image: redis:7-alpine volumes: - redis-data:/data web: build: . command: ["gunicorn", "my_app.wsgi"] environment: REDIS_HOST: redis depends_on: - redis # The worker is built from the same image as the web app, so both see the # same code and the same task registry. worker: build: . # NOTE: if you scale this service, add "-n" here and run a single # separate service (without "-n") to enqueue periodic tasks. command: ["huey_consumer", "my_app.huey", "-w", "4", "-g", "TERM", "-t", "55"] environment: REDIS_HOST: redis depends_on: - redis # SIGKILL deadline for a graceful shutdown (default 10s). The consumer's # -t 55 interrupts still-running tasks just before this. stop_grace_period: 60s volumes: redis-data: