Skip to content

Open-source personal finance manager. Self-hosted, privacy-first.

fix(deploy): add opt-in Traefik labels for frontend service (#1012)

Allan Medeirosddc462229c7a
diff --git a/.env.example b/.env.example
index b551a0ee..77609584 100644
--- a/.env.example
+++ b/.env.example
@@ -77,6 +77,25 @@ ENABLE_BANKING_APP_ID=
# FRONTEND_PORT=3132
# BACKEND_PORT=8182
+# Reverse proxy labels (optional, docker-compose.prod.yml only) — static
+# Traefik routing labels on the frontend service, for setups (e.g. some
+# Coolify versions) where the proxy's own domain UI doesn't turn into
+# working Traefik labels on this compose file. Off by default.
+# TRAEFIK_ENABLE=true
+# FRONTEND_DOMAIN=securo.example.com
+## Set to a network name shared by this stack and your Traefik/proxy
+## container — find it with `docker network ls` or `docker inspect
+## <traefik-container> --format '{{json .NetworkSettings.Networks}}'`.
+## Leave unset to let Traefik auto-detect the shared network — works as
+## long as `frontend` is on exactly one network (the default). REQUIRED if
+## you've attached `frontend` to more than one network yourself.
+# TRAEFIK_NETWORK=
+## Only if your ACME resolver isn't named "letsencrypt".
+# TRAEFIK_CERTRESOLVER=letsencrypt
+## Must be unique per deployment if multiple Securo instances share the
+## same Traefik/Coolify proxy — otherwise their router/service names collide.
+# TRAEFIK_RESOURCE_NAME=securo-frontend
+
# AI Agents (optional) — to enable, set BOTH:
# 1) the feature flag
# 2) COMPOSE_PROFILES so `docker compose up` starts the mcp-server container
diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml
index ce8a1d1c..ea41d951 100644
--- a/docker-compose.prod.yml
+++ b/docker-compose.prod.yml
@@ -132,6 +132,37 @@ services:
depends_on:
- backend
restart: unless-stopped
+ labels:
+ # Static Traefik routing labels for reverse proxies (e.g. Coolify)
+ # whose own "generate FQDN" UI doesn't reliably turn into Traefik
+ # labels on this compose file. Opt-in only: set TRAEFIK_ENABLE=true
+ # and FRONTEND_DOMAIN (bare domain, no protocol) to use them.
+ # TRAEFIK_RESOURCE_NAME must be unique per deployment if multiple
+ # Securo instances share the same Traefik/Coolify proxy, otherwise
+ # their router/service names collide.
+ # TRAEFIK_NETWORK has no default: the Docker network Traefik and this
+ # stack share isn't guaranteed to be named `securo_default` (it isn't,
+ # under some Coolify setups) — find it with `docker network ls` or
+ # `docker inspect <traefik-container> --format '{{json .NetworkSettings.Networks}}'`
+ # and set it explicitly. Left unset (the empty value below is
+ # equivalent to omitting the label), Traefik auto-detects the network
+ # when this container is on exactly one — the default here, since
+ # `frontend` isn't attached to any other network out of the box. If
+ # you've added `frontend` to additional networks yourself, you MUST
+ # set TRAEFIK_NETWORK, or Traefik's choice among them is undefined.
+ - traefik.enable=${TRAEFIK_ENABLE:-false}
+ - traefik.docker.network=${TRAEFIK_NETWORK:-}
+ - traefik.http.routers.${TRAEFIK_RESOURCE_NAME:-securo-frontend}-http.rule=Host(`${FRONTEND_DOMAIN:-localhost}`)
+ - traefik.http.routers.${TRAEFIK_RESOURCE_NAME:-securo-frontend}-http.entrypoints=http
+ - traefik.http.routers.${TRAEFIK_RESOURCE_NAME:-securo-frontend}-http.middlewares=${TRAEFIK_RESOURCE_NAME:-securo-frontend}-https-redirect
+ - traefik.http.routers.${TRAEFIK_RESOURCE_NAME:-securo-frontend}-http.service=${TRAEFIK_RESOURCE_NAME:-securo-frontend}
+ - traefik.http.middlewares.${TRAEFIK_RESOURCE_NAME:-securo-frontend}-https-redirect.redirectscheme.scheme=https
+ - traefik.http.routers.${TRAEFIK_RESOURCE_NAME:-securo-frontend}-https.rule=Host(`${FRONTEND_DOMAIN:-localhost}`)
+ - traefik.http.routers.${TRAEFIK_RESOURCE_NAME:-securo-frontend}-https.entrypoints=https
+ - traefik.http.routers.${TRAEFIK_RESOURCE_NAME:-securo-frontend}-https.tls=true
+ - traefik.http.routers.${TRAEFIK_RESOURCE_NAME:-securo-frontend}-https.tls.certresolver=${TRAEFIK_CERTRESOLVER:-letsencrypt}
+ - traefik.http.routers.${TRAEFIK_RESOURCE_NAME:-securo-frontend}-https.service=${TRAEFIK_RESOURCE_NAME:-securo-frontend}
+ - traefik.http.services.${TRAEFIK_RESOURCE_NAME:-securo-frontend}.loadbalancer.server.port=8080
celery-worker:
<<: *backend-base