flutter-vienna-hackathon-25/wien_talks/wien_talks_server/docker-compose.deploy.yaml
Max R. Carrara 9d1a61885c server: docker: fix traefik not being able to discover server
tl;dr: Since the server is in both the postgres instance's isolated
"backend" network and the public-facing "docker-net", traefik
unfortunately happened to decide to use the "backend" network for its
proxying purposes. This led to the server not being reachable at all.

This commit fixes that by explicitly telling traefik which network to
use.

Signed-off-by: Max R. Carrara <max@aequito.sh>
2025-08-16 22:52:06 +02:00

69 lines
2 KiB
YAML

networks:
docker-net:
name: docker-net
external: true
backend:
name: backend
driver: bridge
external: false
services:
postgres:
image: postgres:16-trixie
container_name: postgres
env_file:
- path: env.d/postgres.env
required: true
volumes:
- db:/var/lib/postgresql/data
restart: always
networks:
- backend
ports:
- "127.0.0.1:5432:5432"
server:
depends_on:
- postgres
build:
context: ./
image: wien-talks
command: [
"--mode",
"production",
"--server-id",
"default",
"--logging",
"normal",
"--role",
"monolith",
"--apply-migrations",
]
env_file:
- path: env.d/server.env
required: true
restart: always
networks:
- docker-net
- backend
labels:
- "traefik.enable=true"
- "traefik.http.routers.wien-talks-api.rule=Host(`${SERVERPOD_API_SERVER_PUBLIC_HOST}`)"
- "traefik.http.routers.wien-talks-api.entrypoints=secure"
- "traefik.http.routers.wien-talks-api.service=wien-talks-api-service"
- "traefik.http.services.wien-talks-api-service.loadbalancer.server.port=${SERVERPOD_API_SERVER_PORT}"
- "traefik.http.routers.wien-talks-insights.rule=Host(`${SERVERPOD_INSIGHTS_SERVER_PUBLIC_HOST}`)"
- "traefik.http.routers.wien-talks-insights.entrypoints=secure"
- "traefik.http.routers.wien-talks-insights.service=wien-talks-insights-service"
- "traefik.http.services.wien-talks-insights-service.loadbalancer.server.port=${SERVERPOD_INSIGHTS_SERVER_PORT}"
- "traefik.http.routers.wien-talks-web.rule=Host(`${SERVERPOD_WEB_SERVER_PUBLIC_HOST}`)"
- "traefik.http.routers.wien-talks-web.entrypoints=secure"
- "traefik.http.routers.wien-talks-web.service=wien-talks-web-service"
- "traefik.http.services.wien-talks-web-service.loadbalancer.server.port=${SERVERPOD_WEB_SERVER_PORT}"
- "traefik.docker.network=docker-net"
volumes:
db: