chore: replace nginx proxy with direct Traefik routing on two domains
This commit is contained in:
@@ -43,6 +43,15 @@ services:
|
|||||||
networks:
|
networks:
|
||||||
- internal
|
- internal
|
||||||
- nats
|
- nats
|
||||||
|
- traefik
|
||||||
|
labels:
|
||||||
|
- "traefik.enable=true"
|
||||||
|
- "traefik.docker.network=traefik"
|
||||||
|
- "traefik.http.routers.thoughts-api.rule=Host(`api.thoughts.gabrielkaszewski.dev`)"
|
||||||
|
- "traefik.http.routers.thoughts-api.entrypoints=web,websecure"
|
||||||
|
- "traefik.http.routers.thoughts-api.tls.certresolver=letsencrypt"
|
||||||
|
- "traefik.http.routers.thoughts-api.service=thoughts-api"
|
||||||
|
- "traefik.http.services.thoughts-api.loadbalancer.server.port=8000"
|
||||||
|
|
||||||
worker:
|
worker:
|
||||||
container_name: thoughts-worker
|
container_name: thoughts-worker
|
||||||
@@ -67,6 +76,7 @@ services:
|
|||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
environment:
|
environment:
|
||||||
NEXT_PUBLIC_SERVER_SIDE_API_URL: http://api:8000
|
NEXT_PUBLIC_SERVER_SIDE_API_URL: http://api:8000
|
||||||
|
NEXT_PUBLIC_API_URL: https://api.thoughts.gabrielkaszewski.dev
|
||||||
PORT: 3000
|
PORT: 3000
|
||||||
HOSTNAME: 0.0.0.0
|
HOSTNAME: 0.0.0.0
|
||||||
depends_on:
|
depends_on:
|
||||||
@@ -79,18 +89,6 @@ services:
|
|||||||
retries: 5
|
retries: 5
|
||||||
networks:
|
networks:
|
||||||
- internal
|
- internal
|
||||||
|
|
||||||
proxy:
|
|
||||||
container_name: thoughts-proxy
|
|
||||||
image: custom-proxy:latest
|
|
||||||
restart: unless-stopped
|
|
||||||
depends_on:
|
|
||||||
frontend:
|
|
||||||
condition: service_healthy
|
|
||||||
api:
|
|
||||||
condition: service_healthy
|
|
||||||
networks:
|
|
||||||
- internal
|
|
||||||
- traefik
|
- traefik
|
||||||
labels:
|
labels:
|
||||||
- "traefik.enable=true"
|
- "traefik.enable=true"
|
||||||
@@ -99,7 +97,7 @@ services:
|
|||||||
- "traefik.http.routers.thoughts.entrypoints=web,websecure"
|
- "traefik.http.routers.thoughts.entrypoints=web,websecure"
|
||||||
- "traefik.http.routers.thoughts.tls.certresolver=letsencrypt"
|
- "traefik.http.routers.thoughts.tls.certresolver=letsencrypt"
|
||||||
- "traefik.http.routers.thoughts.service=thoughts"
|
- "traefik.http.routers.thoughts.service=thoughts"
|
||||||
- "traefik.http.services.thoughts.loadbalancer.server.port=80"
|
- "traefik.http.services.thoughts.loadbalancer.server.port=3000"
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
postgres_data:
|
postgres_data:
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
FROM nginx:stable-alpine
|
|
||||||
|
|
||||||
RUN rm /etc/nginx/conf.d/default.conf
|
|
||||||
|
|
||||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
upstream frontend {
|
|
||||||
server frontend:3000;
|
|
||||||
}
|
|
||||||
|
|
||||||
upstream backend {
|
|
||||||
server backend:8000;
|
|
||||||
}
|
|
||||||
|
|
||||||
server {
|
|
||||||
listen 80;
|
|
||||||
server_name localhost;
|
|
||||||
|
|
||||||
location /health {
|
|
||||||
return 200 "OK";
|
|
||||||
access_log off;
|
|
||||||
}
|
|
||||||
|
|
||||||
proxy_connect_timeout 300s;
|
|
||||||
proxy_send_timeout 300s;
|
|
||||||
proxy_read_timeout 300s;
|
|
||||||
send_timeout 300s;
|
|
||||||
|
|
||||||
location /api/ {
|
|
||||||
rewrite /api/(.*) /$1 break;
|
|
||||||
|
|
||||||
proxy_set_header Host $host;
|
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
|
||||||
|
|
||||||
proxy_pass http://backend;
|
|
||||||
}
|
|
||||||
|
|
||||||
location / {
|
|
||||||
proxy_set_header Host $host;
|
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
|
||||||
|
|
||||||
proxy_pass http://frontend;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user