version: "3.3" services: db: image: postgres:12 volumes: - app-db-data:/var/lib/postgresql/data/pgdata env_file: - .env environment: - PGDATA=/var/lib/postgresql/data/pgdata pgadmin: image: dpage/pgadmin4 networks: - traefik-public - default depends_on: - db env_file: - .env labels: - traefik.enable=true - traefik.docker.network=traefik-public - traefik.constraint-label=traefik-public - traefik.http.routers.${STACK_NAME?Variable not set}-pgadmin-http.rule=Host(`pgadmin.${DOMAIN?Variable not set}`) - traefik.http.routers.${STACK_NAME?Variable not set}-pgadmin-http.entrypoints=http - traefik.http.routers.${STACK_NAME?Variable not set}-pgadmin-http.middlewares=https-redirect - traefik.http.routers.${STACK_NAME?Variable not set}-pgadmin-https.rule=Host(`pgadmin.${DOMAIN?Variable not set}`) - traefik.http.routers.${STACK_NAME?Variable not set}-pgadmin-https.entrypoints=https - traefik.http.routers.${STACK_NAME?Variable not set}-pgadmin-https.tls=true - traefik.http.routers.${STACK_NAME?Variable not set}-pgadmin-https.tls.certresolver=le - traefik.http.services.${STACK_NAME?Variable not set}-pgadmin.loadbalancer.server.port=5050 queue: image: rabbitmq:3 # Using the below image instead is required to enable the "Broker" tab in the flower UI: # image: rabbitmq:3-management # # You also have to change the flower command flower: image: mher/flower:0.9.7 networks: - traefik-public - default env_file: - .env command: - "--broker=amqp://guest@queue:5672//" # For the "Broker" tab to work in the flower UI, uncomment the following command argument, # and change the queue service's image as well # - "--broker_api=http://guest:guest@queue:15672/api//" labels: - traefik.enable=true - traefik.docker.network=traefik-public - traefik.constraint-label=traefik-public - traefik.http.routers.${STACK_NAME?Variable not set}-flower-http.rule=Host(`flower.${DOMAIN?Variable not set}`) - traefik.http.routers.${STACK_NAME?Variable not set}-flower-http.entrypoints=http - traefik.http.routers.${STACK_NAME?Variable not set}-flower-http.middlewares=https-redirect - traefik.http.routers.${STACK_NAME?Variable not set}-flower-https.rule=Host(`flower.${DOMAIN?Variable not set}`) - traefik.http.routers.${STACK_NAME?Variable not set}-flower-https.entrypoints=https - traefik.http.routers.${STACK_NAME?Variable not set}-flower-https.tls=true - traefik.http.routers.${STACK_NAME?Variable not set}-flower-https.tls.certresolver=le - traefik.http.services.${STACK_NAME?Variable not set}-flower.loadbalancer.server.port=5555 backend: image: '${DOCKER_IMAGE_BACKEND?Variable not set}:${TAG-latest}' networks: - traefik-public - default depends_on: - db env_file: - .env environment: - SERVER_NAME=${DOMAIN?Variable not set} - SERVER_HOST=https://${DOMAIN?Variable not set} # Allow explicit env var override for tests - SMTP_HOST=${SMTP_HOST} build: context: ./backend dockerfile: backend.dockerfile args: INSTALL_DEV: ${INSTALL_DEV-false} labels: - traefik.enable=true - traefik.docker.network=traefik-public - traefik.constraint-label=traefik-public - traefik.http.services.${STACK_NAME?Variable not set}-backend.loadbalancer.server.port=80 - traefik.http.routers.${STACK_NAME?Variable not set}-backend-http.rule=Host(`${DOMAIN?Variable not set}`, `www.${DOMAIN?Variable not set}`) && PathPrefix(`/api`, `/docs`, `/redoc`) - traefik.http.routers.${STACK_NAME?Variable not set}-backend-http.entrypoints=http - traefik.http.routers.${STACK_NAME?Variable not set}-backend-https.rule=Host(`${DOMAIN?Variable not set}`, `www.${DOMAIN?Variable not set}`) && PathPrefix(`/api`, `/docs`, `/redoc`) - traefik.http.routers.${STACK_NAME?Variable not set}-backend-https.entrypoints=https - traefik.http.routers.${STACK_NAME?Variable not set}-backend-https.tls=true - traefik.http.routers.${STACK_NAME?Variable not set}-backend-https.tls.certresolver=le - traefik.http.routers.${STACK_NAME?Variable not set}-backend-http.middlewares=https-redirect,${STACK_NAME?Variable not set}-www-redirect - traefik.http.routers.${STACK_NAME?Variable not set}-backend-https.middlewares=${STACK_NAME?Variable not set}-www-redirect celeryworker: image: '${DOCKER_IMAGE_CELERYWORKER?Variable not set}:${TAG-latest}' depends_on: - db - queue env_file: - .env environment: - SERVER_HOST=https://${DOMAIN?Variable not set} # Allow explicit env var override for tests - SMTP_HOST=${SMTP_HOST?Variable not set} build: context: ./backend dockerfile: celeryworker.dockerfile args: INSTALL_DEV: ${INSTALL_DEV-false} frontend: image: '${DOCKER_IMAGE_FRONTEND?Variable not set}:${TAG-latest}' networks: - traefik-public - default build: context: ./frontend args: - VITE_API_URL=https://${DOMAIN?Variable not set} - NODE_ENV=production labels: - traefik.enable=true - traefik.docker.network=traefik-public - traefik.constraint-label=traefik-public - traefik.http.services.${STACK_NAME?Variable not set}-frontend.loadbalancer.server.port=80 - traefik.http.routers.${STACK_NAME?Variable not set}-frontend-http.rule=Host(`${DOMAIN?Variable not set}`, `www.${DOMAIN?Variable not set}`) - traefik.http.routers.${STACK_NAME?Variable not set}-frontend-http.entrypoints=http - traefik.http.routers.${STACK_NAME?Variable not set}-frontend-https.rule=Host(`${DOMAIN?Variable not set}`, `www.${DOMAIN?Variable not set}`) - traefik.http.routers.${STACK_NAME?Variable not set}-frontend-https.entrypoints=https - traefik.http.routers.${STACK_NAME?Variable not set}-frontend-https.tls=true - traefik.http.routers.${STACK_NAME?Variable not set}-frontend-https.tls.certresolver=le # Handle domain with and without "www" to redirect to only one # To disable www redirection remove the next line - traefik.http.middlewares.${STACK_NAME?Variable not set}-www-redirect.redirectregex.regex=^http(s)?://www.(${DOMAIN?Variable not set})/(.*) # Redirect a domain with www to non-www # To disable it remove the next line - traefik.http.middlewares.${STACK_NAME?Variable not set}-www-redirect.redirectregex.replacement=http$${1}://${DOMAIN?Variable not set}/$${3} # Redirect a domain without www to www # To enable it remove the previous line and uncomment the next # - traefik.http.middlewares.${STACK_NAME}-www-redirect.redirectregex.replacement=https://www.${DOMAIN}/$${3} # Middleware to redirect www, to disable it remove the next line - traefik.http.routers.${STACK_NAME?Variable not set}-frontend-https.middlewares=${STACK_NAME?Variable not set}-www-redirect # Middleware to redirect www, and redirect HTTP to HTTPS # to disable www redirection remove the section: ${STACK_NAME?Variable not set}-www-redirect, - traefik.http.routers.${STACK_NAME?Variable not set}-frontend-http.middlewares=https-redirect,${STACK_NAME?Variable not set}-www-redirect volumes: app-db-data: networks: traefik-public: # Allow setting it to false for testing external: true