2025SELab2-project-Dwengo/compose.staging.yml

114 lines
3.2 KiB
YAML

#
# Use this configuration to test the production configuration locally.
#
# This configuration builds the frontend and backend services as Docker images,
# and uses the paths for the services, instead of ports.
#
services:
web:
build:
context: .
dockerfile: frontend/Dockerfile
ports:
- '8080:8080/tcp'
restart: unless-stopped
labels:
- 'traefik.http.routers.web.rule=PathPrefix(`/`)'
- 'traefik.http.services.web.loadbalancer.server.port=8080'
api:
build:
context: .
dockerfile: backend/Dockerfile
ports:
- '3000:3000/tcp'
restart: unless-stopped
volumes:
- ./backend/.env.staging:/app/dwengo/backend/.env
depends_on:
- db
- logging
labels:
- 'traefik.http.routers.api.rule=PathPrefix(`/api`)'
- 'traefik.http.services.api.loadbalancer.server.port=3000'
db:
extends:
file: ./compose.yml
service: db
idp:
extends:
file: ./compose.yml
service: idp
labels:
- 'traefik.http.routers.idp.rule=PathPrefix(`/idp`)'
- 'traefik.http.services.idp.loadbalancer.server.port=7080'
environment:
PROXY_ADDRESS_FORWARDING: 'true'
KC_HTTP_RELATIVE_PATH: '/idp'
reverse-proxy:
image: traefik:v3.3
command:
# Enable web UI
- '--api.insecure=true'
# Add Docker provider
- '--providers.docker=true'
- '--providers.docker.exposedbydefault=true'
# Add web entrypoint
- '--entrypoints.web.address=:80/tcp'
# Proxying the web UI on a sub-path
- '--api.basePath=/proxy'
labels:
- 'traefik.http.routers.proxy.service=api@internal'
- 'traefik.http.routers.proxy.rule=PathPrefix(`/proxy`)'
- 'traefik.http.services.proxy.loadbalancer.server.port=8080'
ports:
- '9000:8080'
- '80:80/tcp'
restart: unless-stopped
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
logging:
image: grafana/loki:latest
ports:
- '9001:3102'
- '9095:9095'
command: -config.file=/etc/loki/config.yaml
restart: unless-stopped
volumes:
- ./config/loki/config.yml:/etc/loki/config.yaml
- dwengo_loki_data:/loki
dashboards:
image: grafana/grafana:latest
ports:
- '9002:3000'
labels:
- 'traefik.http.routers.graphs.rule=PathPrefix(`/graphs`)'
- 'traefik.http.services.graphs.loadbalancer.server.port=3000'
volumes:
- dwengo_grafana_data:/var/lib/grafana
- ./config/grafana/grafana.ini:/etc/grafana/grafana.ini
restart: unless-stopped
caching:
image: memcached
restart: always
ports:
- '11211:11211'
command:
- --conn-limit=1024
- --memory-limit=2048
- -I 128m
- --threads=4
volumes:
dwengo_grafana_data:
dwengo_loki_data:
dwengo_postgres_data: