--- version: '3.8' name: pssa2023 services: traefik: image: traefik:v2.10 ports: - 80:80 labels: - traefik.enable=true - traefik.constraint-label=public - traefik.http.routers.traefik-public-http.rule=Host(`traefik.pssa2023.localhost`) - traefik.http.routers.traefik-public-http.entrypoints=http - traefik.http.routers.traefik-public-http.service=api@internal - traefik.http.services.traefik-public.loadbalancer.server.port=8000 # GENERIC MIDDLEWARES - traefik.http.middlewares.gzip.compress=true - traefik.http.middlewares.gzip.compress.excludedcontenttypes=image/png, image/jpeg, font/woff2 volumes: - /var/run/docker.sock:/var/run/docker.sock:ro command: - --providers.docker - --providers.docker.constraints=Label(`traefik.constraint-label`, `public`) - --providers.docker.exposedbydefault=false - --entrypoints.http.address=:80 - --accesslog - --log - --api purger: image: ghcr.io/kitconcept/cluster-purger:latest platform: linux/amd64 environment: PURGER_SERVICE_NAME: varnish PURGER_SERVICE_PORT: 80 PURGER_MODE: "compose" PURGER_PUBLIC_SITES: "['pssa2023.localhost']" varnish: build: context: devops/varnish labels: - traefik.enable=true - traefik.constraint-label=public # SERVICE - traefik.http.services.svc-varnish.loadbalancer.server.port=80 depends_on: - backend frontend: build: context: ./frontend environment: RAZZLE_INTERNAL_API_PATH: http://backend:8080/Plone depends_on: - backend labels: - traefik.enable=true - traefik.constraint-label=public # Service - traefik.http.services.svc-frontend.loadbalancer.server.port=3000 # Routers ## / ### Router: Varnish Public - traefik.http.routers.rt-frontend-public.rule=Host(`pssa2023.localhost`) - traefik.http.routers.rt-frontend-public.entrypoints=http - traefik.http.routers.rt-frontend-public.service=svc-varnish - traefik.http.routers.rt-frontend-public.middlewares=gzip ### Router: Internal - traefik.http.routers.rt-frontend-internal.rule=Host(`pssa2023.localhost`) && Headers(`X-Varnish-Routed`, `1`) - traefik.http.routers.rt-frontend-internal.entrypoints=http - traefik.http.routers.rt-frontend-internal.service=svc-frontend backend: build: context: ./backend environment: RELSTORAGE_DSN: "dbname='${DB_NAME:-plone}' user='${DB_NAME:-plone}' host='${DB_HOST:-db}' password='${DB_PASSWORD:-NjdjUawvhysd}' port='${DB_PORT:-5432}'" depends_on: - db labels: - traefik.enable=true - traefik.constraint-label=public # Services - traefik.http.services.svc-backend.loadbalancer.server.port=8080 # Middlewares ## VHM rewrite /++api++/ - "traefik.http.middlewares.mw-backend-vhm-api.replacepathregex.regex=^/\\+\\+api\\+\\+($$|/.*)" - "traefik.http.middlewares.mw-backend-vhm-api.replacepathregex.replacement=/VirtualHostBase/http/pssa2023.localhost/Plone/++api++/VirtualHostRoot$$1" ## VHM rewrite /ClassicUI/ - "traefik.http.middlewares.mw-backend-vhm-classic.replacepathregex.regex=^/ClassicUI($$|/.*)" - "traefik.http.middlewares.mw-backend-vhm-classic.replacepathregex.replacement=/VirtualHostBase/http/pssa2023.localhost/Plone/VirtualHostRoot/_vh_ClassicUI$$1" ## Basic Authentication ### Note: all dollar signs in the hash need to be doubled for escaping. ### To create user:password pair, it's possible to use this command: ### echo $(htpasswd -nb user password) | sed -e s/\\$/\\$\\$/g ### Defaults to admin:admin - traefik.http.middlewares.mw-backend-auth.basicauth.users=admin:$$apr1$$uZPT5Fgu$$AmlIdamxT5ipBvPlsdfD70 # Routers ## /++api++/ ### Router: Varnish Public - traefik.http.routers.rt-backend-api-public.rule=Host(`pssa2023.localhost`) && PathPrefix(`/++api++`) - traefik.http.routers.rt-backend-api-public.entrypoints=http - traefik.http.routers.rt-backend-api-public.service=svc-varnish - traefik.http.routers.rt-backend-api-public.middlewares=gzip ### Router: Internal - traefik.http.routers.rt-backend-api-internal.rule=Host(`pssa2023.localhost`) && PathPrefix(`/++api++`) && Headers(`X-Varnish-Routed`, `1`) - traefik.http.routers.rt-backend-api-internal.entrypoints=http - traefik.http.routers.rt-backend-api-internal.service=svc-backend - traefik.http.routers.rt-backend-api-internal.middlewares=gzip,mw-backend-vhm-api ## /ClassicUI - traefik.http.routers.rt-backend-classic.rule=Host(`pssa2023.localhost`) && PathPrefix(`/ClassicUI`) - traefik.http.routers.rt-backend-classic.entrypoints=http - traefik.http.routers.rt-backend-classic.service=svc-backend - traefik.http.routers.rt-backend-classic.middlewares=gzip,mw-backend-auth,mw-backend-vhm-classic db: image: postgres:14 environment: POSTGRES_USER: plone POSTGRES_PASSWORD: NjdjUawvhysd POSTGRES_DB: plone volumes: - vol-site-data:/var/lib/postgresql/data volumes: vol-site-data: {}