diff --git a/docker-compose.yml b/docker-compose.yml index 0ace4b7..2e3a9d5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,17 +1,12 @@ -# Yote-In-Vest behind an existing Traefik (v2 or v3). -# -# Two routes on the same domain: -# /webhook -> open, so TradingView can reach it (protected by WEBHOOK_SECRET) -# all else -> dashboard, protected by basic auth (DASHBOARD_AUTH) -# -# Settings come from environment variables (in Portainer: Stack > Environment variables). -# No .env file is needed. Required: WEBHOOK_SECRET and DASHBOARD_AUTH. Everything else has a -# default. Adjust TRAEFIK_NETWORK / TRAEFIK_ENTRYPOINT / TRAEFIK_CERTRESOLVER if your Traefik differs. +# Yote-In-Vest behind Traefik v3 + Authentik +# - Dashboard: https://${BOT_DOMAIN} -> requires Authentik login (authentik@docker) +# - Webhook: https://${BOT_DOMAIN}/webhook -> open for TradingView, protected by WEBHOOK_SECRET +# Requires the external `proxy` network. services: yote-in-vest: build: . - pull_policy: build # always build from this folder; never try to pull from a registry + pull_policy: build container_name: yote-in-vest restart: unless-stopped environment: @@ -42,37 +37,35 @@ services: volumes: - yote-in-vest-data:/data networks: - - traefik + - proxy labels: - - traefik.enable=true - - traefik.docker.network=${TRAEFIK_NETWORK:-traefik} - - traefik.http.services.yote-in-vest.loadbalancer.server.port=8000 + traefik.enable: "true" + traefik.docker.network: proxy + traefik.http.services.yote-in-vest.loadbalancer.server.port: "8000" - # Webhook: no password, TradingView can't send one. - - traefik.http.routers.yote-in-vest-webhook.rule=Host(`${BOT_DOMAIN:-yoteinvest.dv3.app}`) && Path(`/webhook`) - - traefik.http.routers.yote-in-vest-webhook.entrypoints=${TRAEFIK_ENTRYPOINT:-websecure} - - traefik.http.routers.yote-in-vest-webhook.tls.certresolver=${TRAEFIK_CERTRESOLVER:-letsencrypt} - - traefik.http.routers.yote-in-vest-webhook.priority=100 - - traefik.http.routers.yote-in-vest-webhook.service=yote-in-vest - # Optional extra lock: only accept TradingView's sending IPs. - # Check the current list on TradingView's "How to configure webhook alerts" help page, - # then uncomment both lines (v3 uses ipallowlist, v2 uses ipwhitelist): - # - traefik.http.middlewares.yote-in-vest-tv-ips.ipallowlist.sourcerange=52.89.214.238,34.212.75.30,54.218.53.128,52.32.178.7 - # - traefik.http.routers.yote-in-vest-webhook.middlewares=yote-in-vest-tv-ips + # Webhook: no Authentik (TradingView can't log in); WEBHOOK_SECRET protects it + traefik.http.routers.yote-in-vest-webhook.rule: Host(`${BOT_DOMAIN:-yoteinvest.dv3.app}`) && Path(`/webhook`) + traefik.http.routers.yote-in-vest-webhook.entrypoints: websecure + traefik.http.routers.yote-in-vest-webhook.tls.certresolver: letsencrypt + traefik.http.routers.yote-in-vest-webhook.priority: "100" + traefik.http.routers.yote-in-vest-webhook.service: yote-in-vest + # Optional: only accept webhooks from TradingView's IPs + # traefik.http.middlewares.yote-in-vest-tv-ips.ipallowlist.sourcerange: 52.89.214.238,34.212.75.30,54.218.53.128,52.32.178.7 + # traefik.http.routers.yote-in-vest-webhook.middlewares: yote-in-vest-tv-ips - # Dashboard and API: password protected. - - traefik.http.routers.yote-in-vest.rule=Host(`${BOT_DOMAIN:-yoteinvest.dv3.app}`) - - traefik.http.routers.yote-in-vest.entrypoints=${TRAEFIK_ENTRYPOINT:-websecure} - - traefik.http.routers.yote-in-vest.tls.certresolver=${TRAEFIK_CERTRESOLVER:-letsencrypt} - - traefik.http.routers.yote-in-vest.priority=10 - - traefik.http.routers.yote-in-vest.service=yote-in-vest - - traefik.http.routers.yote-in-vest.middlewares=yote-in-vest-auth - - traefik.http.middlewares.yote-in-vest-auth.basicauth.users=${DASHBOARD_AUTH:?set DASHBOARD_AUTH in .env} + # Dashboard: everything else, behind Authentik + traefik.http.routers.yote-in-vest.rule: Host(`${BOT_DOMAIN:-yoteinvest.dv3.app}`) + traefik.http.routers.yote-in-vest.entrypoints: websecure + traefik.http.routers.yote-in-vest.tls.certresolver: letsencrypt + traefik.http.routers.yote-in-vest.priority: "10" + traefik.http.routers.yote-in-vest.service: yote-in-vest + traefik.http.routers.yote-in-vest.middlewares: authentik@docker,secure-headers@docker volumes: yote-in-vest-data: + # Set DATA_VOLUME to the existing volume name to keep your current data + name: ${DATA_VOLUME:-yote-in-vest-data} networks: - traefik: - name: ${TRAEFIK_NETWORK:-traefik} - external: true + proxy: + external: true \ No newline at end of file