# Override for running behind nginx-proxy (and optionally acme-companion), from the folder with
# compose.yaml (docker/ in a checkout):
#   docker compose -f compose.yaml -f compose.nginx-proxy.yaml up -d
# The server joins nginx-proxy's network and is no longer published on the host,
# so forwarded headers can only come from the proxy. So does ntfy, with the ntfy profile, at
# NTFY_HOST (with a certificate too when LETSENCRYPT_HOST is set).
services:
  server:
    ports: !reset []
    environment:
      VIRTUAL_HOST: ${VIRTUAL_HOST:?set VIRTUAL_HOST in .env}
      VIRTUAL_PORT: '8080'
      LETSENCRYPT_HOST: ${LETSENCRYPT_HOST:-}
      TRUST_PROXY: ${TRUST_PROXY:-1}
    networks:
      - default
      - proxy

  ntfy:
    ports: !reset []
    environment:
      VIRTUAL_HOST: ${NTFY_HOST:-}
      VIRTUAL_PORT: '80'
      LETSENCRYPT_HOST: ${LETSENCRYPT_HOST:+${NTFY_HOST:-}}
    networks:
      - default
      - proxy

networks:
  proxy:
    external: true
    name: ${NGINX_PROXY_NETWORK:-nginx-proxy}
