feat: update docker-compose and Nginx configuration for improved service dependencies and API routing
- Added 'depends_on' for the frontend service to ensure it starts after the backend service. - Updated Nginx configuration to proxy API and media requests to the backend, enhancing client access under the same host URL. - Included health check endpoint for backend service in Nginx configuration to monitor service status.
This commit is contained in:
parent
5215a2adc5
commit
60132e97e8
|
|
@ -18,5 +18,6 @@ jobs:
|
||||||
docker compose build --no-cache
|
docker compose build --no-cache
|
||||||
docker compose up -d
|
docker compose up -d
|
||||||
sleep 5
|
sleep 5
|
||||||
curl -sf http://localhost:8003/api/version && echo "✓ PROD API healthy"
|
curl -sf http://localhost:8003/api/version && echo "✓ PROD API (direkt) healthy"
|
||||||
|
curl -sf http://localhost:3003/api/version && echo "✓ PROD API über Frontend-Nginx (wie Browser) healthy"
|
||||||
echo "=== Shinkan PROD Deploy complete ==="
|
echo "=== Shinkan PROD Deploy complete ==="
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,8 @@ services:
|
||||||
container_name: shinkan-ui
|
container_name: shinkan-ui
|
||||||
ports:
|
ports:
|
||||||
- "3003:80"
|
- "3003:80"
|
||||||
|
depends_on:
|
||||||
|
- backend
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
networks:
|
networks:
|
||||||
- shinkan-network
|
- shinkan-network
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,37 @@ server {
|
||||||
root /usr/share/nginx/html;
|
root /usr/share/nginx/html;
|
||||||
index index.html;
|
index index.html;
|
||||||
|
|
||||||
|
# Uploads (Übungsmedien) und API erreichen Clients unter derselben Host-URL wie die SPA —
|
||||||
|
# dafür muss Nginx zur FastAPI-Instanz im Compose-Netz weiterleiten.
|
||||||
|
client_max_body_size 64m;
|
||||||
|
|
||||||
|
location ^~ /api/ {
|
||||||
|
proxy_pass http://backend:8000;
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
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_connect_timeout 60s;
|
||||||
|
proxy_send_timeout 300s;
|
||||||
|
proxy_read_timeout 300s;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ^~ /media/ {
|
||||||
|
proxy_pass http://backend:8000;
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
location = /health {
|
||||||
|
proxy_pass http://backend:8000/health;
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
}
|
||||||
|
|
||||||
# SPA routing - serve index.html for all routes
|
# SPA routing - serve index.html for all routes
|
||||||
location / {
|
location / {
|
||||||
try_files $uri $uri/ /index.html;
|
try_files $uri $uri/ /index.html;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user