fix: reorganize Traefik labels and network configuration in Docker Compose
All checks were successful
Build and Deploy Thoughts / build-and-deploy-local (push) Successful in 29s
All checks were successful
Build and Deploy Thoughts / build-and-deploy-local (push) Successful in 29s
This commit is contained in:
@@ -39,21 +39,7 @@ services:
|
|||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 5
|
retries: 5
|
||||||
networks:
|
networks:
|
||||||
- traefik
|
|
||||||
- internal
|
- internal
|
||||||
labels:
|
|
||||||
- "traefik.enable=true"
|
|
||||||
- "traefik.docker.network=traefik"
|
|
||||||
# Create a router for the API
|
|
||||||
- "traefik.http.routers.thoughts-api.rule=Host(`thoughts.gabrielkaszewski.dev`) && PathPrefix(`/api`)"
|
|
||||||
- "traefik.http.routers.thoughts-api.entrypoints=web,websecure"
|
|
||||||
- "traefik.http.routers.thoughts-api.tls.certresolver=letsencrypt"
|
|
||||||
- "traefik.http.routers.thoughts-api.service=thoughts-api"
|
|
||||||
# Add a middleware to strip the /api prefix before sending to the backend
|
|
||||||
- "traefik.http.routers.thoughts-api.middlewares=strip-api-prefix"
|
|
||||||
- "traefik.http.middlewares.strip-api-prefix.stripprefix.prefixes=/api"
|
|
||||||
# Create a service for the API that points to the backend container's port
|
|
||||||
- "traefik.http.services.thoughts-api.loadbalancer.server.port=8000"
|
|
||||||
|
|
||||||
frontend:
|
frontend:
|
||||||
container_name: thoughts-frontend
|
container_name: thoughts-frontend
|
||||||
@@ -71,40 +57,28 @@ services:
|
|||||||
- PORT=3000
|
- PORT=3000
|
||||||
- HOSTNAME=0.0.0.0
|
- HOSTNAME=0.0.0.0
|
||||||
networks:
|
networks:
|
||||||
- traefik
|
|
||||||
- internal
|
- internal
|
||||||
|
|
||||||
|
proxy:
|
||||||
|
container_name: thoughts-proxy
|
||||||
|
image: custom-proxy:latest
|
||||||
|
restart: unless-stopped
|
||||||
|
depends_on:
|
||||||
|
frontend:
|
||||||
|
condition: service_healthy
|
||||||
|
backend:
|
||||||
|
condition: service_healthy
|
||||||
|
networks:
|
||||||
|
- internal
|
||||||
|
- traefik
|
||||||
labels:
|
labels:
|
||||||
- "traefik.enable=true"
|
- "traefik.enable=true"
|
||||||
- "traefik.docker.network=traefik"
|
- "traefik.docker.network=traefik"
|
||||||
# Create a router for the main web traffic
|
- "traefik.http.routers.thoughts.rule=Host(`thoughts.gabrielkaszewski.dev`)"
|
||||||
- "traefik.http.routers.thoughts-web.rule=Host(`thoughts.gabrielkaszewski.dev`)"
|
- "traefik.http.routers.thoughts.entrypoints=web,websecure"
|
||||||
- "traefik.http.routers.thoughts-web.entrypoints=web,websecure"
|
- "traefik.http.routers.thoughts.tls.certresolver=letsencrypt"
|
||||||
- "traefik.http.routers.thoughts-web.tls.certresolver=letsencrypt"
|
- "traefik.http.routers.thoughts.service=thoughts"
|
||||||
- "traefik.http.routers.thoughts-web.service=thoughts-web"
|
- "traefik.http.services.thoughts.loadbalancer.server.port=80"
|
||||||
# Give this router a lower priority so the more specific /api route is matched first
|
|
||||||
- "traefik.http.routers.thoughts-web.priority=1"
|
|
||||||
# Create a service for the web that points to the frontend container's port
|
|
||||||
- "traefik.http.services.thoughts-web.loadbalancer.server.port=3000"
|
|
||||||
|
|
||||||
# proxy:
|
|
||||||
# container_name: thoughts-proxy
|
|
||||||
# image: custom-proxy:latest
|
|
||||||
# restart: unless-stopped
|
|
||||||
# depends_on:
|
|
||||||
# frontend:
|
|
||||||
# condition: service_healthy
|
|
||||||
# backend:
|
|
||||||
# condition: service_healthy
|
|
||||||
# networks:
|
|
||||||
# - internal
|
|
||||||
# - traefik
|
|
||||||
# labels:
|
|
||||||
# - "traefik.enable=true"
|
|
||||||
# - "traefik.http.routers.thoughts.rule=Host(`thoughts.gabrielkaszewski.dev`)"
|
|
||||||
# - "traefik.http.routers.thoughts.entrypoints=web,websecure"
|
|
||||||
# - "traefik.http.routers.thoughts.tls.certresolver=letsencrypt"
|
|
||||||
# - "traefik.http.routers.thoughts.service=thoughts"
|
|
||||||
# - "traefik.http.services.thoughts.loadbalancer.server.port=80"
|
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
postgres_data:
|
postgres_data:
|
||||||
|
Reference in New Issue
Block a user