refactor: Replace hardcoded backend references with variable for improved maintainability
This commit is contained in:
@@ -1,7 +1,3 @@
|
|||||||
upstream backend {
|
|
||||||
server backend:5000;
|
|
||||||
}
|
|
||||||
|
|
||||||
upstream frontend {
|
upstream frontend {
|
||||||
server frontend:5173;
|
server frontend:5173;
|
||||||
}
|
}
|
||||||
@@ -25,6 +21,8 @@ server {
|
|||||||
listen 443 ssl;
|
listen 443 ssl;
|
||||||
server_name dociva.io www.dociva.io;
|
server_name dociva.io www.dociva.io;
|
||||||
client_max_body_size 100M;
|
client_max_body_size 100M;
|
||||||
|
resolver 127.0.0.11 valid=30s ipv6=off;
|
||||||
|
set $backend_upstream backend:5000;
|
||||||
|
|
||||||
# SSL certificates (Let's Encrypt)
|
# SSL certificates (Let's Encrypt)
|
||||||
ssl_certificate /etc/letsencrypt/live/dociva.io/fullchain.pem;
|
ssl_certificate /etc/letsencrypt/live/dociva.io/fullchain.pem;
|
||||||
@@ -44,7 +42,7 @@ server {
|
|||||||
|
|
||||||
# API requests → Flask backend
|
# API requests → Flask backend
|
||||||
location /api/ {
|
location /api/ {
|
||||||
proxy_pass http://backend;
|
proxy_pass http://$backend_upstream;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
@@ -68,6 +66,6 @@ server {
|
|||||||
|
|
||||||
# Health check
|
# Health check
|
||||||
location /health {
|
location /health {
|
||||||
proxy_pass http://backend/api/health;
|
proxy_pass http://$backend_upstream/api/health;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,3 @@
|
|||||||
upstream backend {
|
|
||||||
server backend:5000;
|
|
||||||
}
|
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen 80;
|
listen 80;
|
||||||
server_name dociva.io www.dociva.io;
|
server_name dociva.io www.dociva.io;
|
||||||
@@ -37,6 +33,8 @@ server {
|
|||||||
http2 on;
|
http2 on;
|
||||||
server_name dociva.io;
|
server_name dociva.io;
|
||||||
client_max_body_size 100M;
|
client_max_body_size 100M;
|
||||||
|
resolver 127.0.0.11 valid=30s ipv6=off;
|
||||||
|
set $backend_upstream backend:5000;
|
||||||
|
|
||||||
# SSL certificates (Let's Encrypt via certbot)
|
# SSL certificates (Let's Encrypt via certbot)
|
||||||
ssl_certificate /etc/letsencrypt/live/dociva.io/fullchain.pem;
|
ssl_certificate /etc/letsencrypt/live/dociva.io/fullchain.pem;
|
||||||
@@ -69,7 +67,7 @@ server {
|
|||||||
|
|
||||||
# SSE streaming for assistant chat
|
# SSE streaming for assistant chat
|
||||||
location /api/assistant/chat/stream {
|
location /api/assistant/chat/stream {
|
||||||
proxy_pass http://backend;
|
proxy_pass http://$backend_upstream;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
@@ -85,7 +83,7 @@ server {
|
|||||||
|
|
||||||
# API requests → Flask
|
# API requests → Flask
|
||||||
location /api/ {
|
location /api/ {
|
||||||
proxy_pass http://backend;
|
proxy_pass http://$backend_upstream;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
@@ -109,6 +107,6 @@ server {
|
|||||||
|
|
||||||
# Health check
|
# Health check
|
||||||
location /health {
|
location /health {
|
||||||
proxy_pass http://backend/api/health;
|
proxy_pass http://$backend_upstream/api/health;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user