services:
  db:
    # Query-level statistics are enabled only for the isolated load profile.
    # PostgreSQL requires pg_stat_statements in shared_preload_libraries and a
    # server restart; the ordinary Compose database is not changed.
    command:
      - postgres
      - -c
      - shared_preload_libraries=pg_stat_statements
      - -c
      - compute_query_id=on

  proxy:
    networks:
      edge:
        aliases:
          - ${LOAD_HOST}
      ingress: {}

  migrate:
    image: who-need-help:load

  web:
    image: who-need-help:load
    labels:
      - traefik.http.routers.${TRAEFIK_APP_NAME}.middlewares=${TRAEFIK_APP_NAME}-forwarded,${TRAEFIK_APP_NAME}-retry
      - traefik.http.middlewares.${TRAEFIK_APP_NAME}-forwarded.headers.customrequestheaders.X-Forwarded-Proto=https
      - traefik.http.routers.${TRAEFIK_APP_NAME}-tls.rule=${TRAEFIK_ROUTER_RULE}
      - traefik.http.routers.${TRAEFIK_APP_NAME}-tls.entrypoints=websecure
      - traefik.http.routers.${TRAEFIK_APP_NAME}-tls.service=${TRAEFIK_APP_NAME}
      - traefik.http.routers.${TRAEFIK_APP_NAME}-tls.middlewares=${TRAEFIK_APP_NAME}-forwarded,${TRAEFIK_APP_NAME}-retry
      - traefik.http.routers.${TRAEFIK_APP_NAME}-tls.tls=true

  worker:
    image: who-need-help:load
