- CI/CD GitLab (.gitlab-ci.yml): verify -> test -> build -> publish -> deploy cu health-gate (/api/v3/health/all) + rollback manual - Publicare pe retele sociale (LinkedIn/Facebook) din Analysis History (social.ts, linkedin.ts, facebook.ts, SocialPostModal) - Specificatii OpenAPI: agent-v3 (87 op.) si didi-framework (287 op.) - Matrice testare acceptanta beneficiar + script dovezi API - Fix nginx SSL: redirect port 3001 (error_page 497, absolute_redirect off) - Adrese interne inlocuite cu hostname-uri generice (.local)
296 lines
10 KiB
Text
296 lines
10 KiB
Text
server {
|
|
listen 443 ssl;
|
|
server_name localhost didi.local;
|
|
|
|
ssl_certificate /etc/nginx/ssl/server.crt;
|
|
ssl_certificate_key /etc/nginx/ssl/server.key;
|
|
ssl_protocols TLSv1.2 TLSv1.3;
|
|
ssl_ciphers HIGH:!aNULL:!MD5;
|
|
|
|
# Cererile HTTP simplu pe portul HTTPS (ex. utilizator tastează http://host:3001)
|
|
# primesc redirect către https în loc de "400 Bad Request".
|
|
error_page 497 =301 https://$http_host$request_uri;
|
|
|
|
# Redirecturi RELATIVE (ex. /admin → /admin/): altfel nginx pune portul intern
|
|
# (443) în Location și se pierde :3001 din adresa publică → pagină inaccesibilă.
|
|
absolute_redirect off;
|
|
|
|
# Global: allow large file uploads (video up to 100MB)
|
|
client_max_body_size 100M;
|
|
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
|
|
gzip on;
|
|
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
|
|
|
|
# Redirect root to /admin/ so browser URL matches React Router basename
|
|
location = / {
|
|
return 301 $scheme://$http_host/admin/;
|
|
}
|
|
|
|
# /admin-backend/ — branding alias for /admin/. Both paths land users on
|
|
# the same SPA. Keeps /admin/ as the canonical basename so we don't have
|
|
# to touch Keycloak redirect URIs or React Router config.
|
|
location = /admin-backend { return 301 $scheme://$http_host/admin/; }
|
|
location /admin-backend/ { return 301 $scheme://$http_host/admin/; }
|
|
|
|
# /admin-ai/ — reverse-proxy to AI platform dashboard (didiAI-dashboard).
|
|
# AI platform's React SPA is built with base=/admin-ai/ and FastAPI mounts
|
|
# the SPA at /admin-ai/, so paths line up — no rewrite needed for assets.
|
|
# `^~` ensures this prefix beats the .js/.css regex location below.
|
|
location ^~ /admin-ai/ {
|
|
resolver 127.0.0.11 valid=30s;
|
|
set $aidash didiAI-dashboard;
|
|
proxy_pass http://$aidash:51300;
|
|
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_set_header X-Forwarded-Host $host;
|
|
proxy_buffer_size 64k;
|
|
proxy_buffers 4 64k;
|
|
proxy_read_timeout 60s;
|
|
proxy_send_timeout 60s;
|
|
proxy_connect_timeout 5s;
|
|
}
|
|
|
|
# Proxy ALL /api/ requests to local Kong (didi-kong container on didi-network)
|
|
# Host header overridden to didi365.eu so Kong matches the DIDI route hosts.
|
|
location /api/ {
|
|
resolver 127.0.0.11 valid=30s;
|
|
set $kong_upstream didi-kong;
|
|
proxy_pass http://$kong_upstream:8000;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Host didi365.eu;
|
|
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 https;
|
|
proxy_set_header X-Forwarded-Host $host;
|
|
proxy_read_timeout 660s;
|
|
proxy_send_timeout 660s;
|
|
proxy_connect_timeout 10s;
|
|
}
|
|
|
|
# Proxy /auth/ directly to Keycloak (KC_HTTP_RELATIVE_PATH=/auth, no rewrite)
|
|
# ^~ forces this prefix to beat the static .css/.js regex location below
|
|
location ^~ /auth/ {
|
|
resolver 127.0.0.11 valid=30s;
|
|
set $kc_upstream keycloak;
|
|
proxy_pass http://$kc_upstream:8080;
|
|
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 https;
|
|
proxy_set_header X-Forwarded-Host $host;
|
|
proxy_set_header X-Forwarded-Port 443;
|
|
proxy_buffer_size 128k;
|
|
proxy_buffers 4 256k;
|
|
proxy_busy_buffers_size 256k;
|
|
}
|
|
|
|
# Proxy to Agent V3 API (video processing can take up to 10 min)
|
|
location /agent-v3/ {
|
|
resolver 127.0.0.11 valid=30s;
|
|
set $agent_upstream didi-agent-v3;
|
|
rewrite ^/agent-v3/(.*) /$1 break;
|
|
proxy_pass http://$agent_upstream:24803;
|
|
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_read_timeout 660s;
|
|
proxy_send_timeout 660s;
|
|
proxy_connect_timeout 10s;
|
|
}
|
|
|
|
# Proxy to Framework API
|
|
location /framework/ {
|
|
resolver 127.0.0.11 valid=30s;
|
|
set $framework_upstream didi-framework;
|
|
rewrite ^/framework/(.*) /$1 break;
|
|
proxy_pass http://$framework_upstream:3005;
|
|
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;
|
|
}
|
|
|
|
# Health check proxies for internal services
|
|
location /health-check/postgres {
|
|
resolver 127.0.0.11 valid=30s;
|
|
set $pg staging-dataLayer-postgres;
|
|
proxy_pass http://$pg:5432/;
|
|
proxy_connect_timeout 3s;
|
|
proxy_read_timeout 3s;
|
|
}
|
|
|
|
location /health-check/redis-commander {
|
|
resolver 127.0.0.11 valid=30s;
|
|
set $rc staging-dataLayer-redis-commander;
|
|
proxy_pass http://$rc:8081/redis-commander/;
|
|
proxy_connect_timeout 3s;
|
|
proxy_read_timeout 3s;
|
|
}
|
|
|
|
location /health-check/rabbitmq {
|
|
resolver 127.0.0.11 valid=30s;
|
|
set $rmq staging-dataLayer-rabbitmq;
|
|
proxy_pass http://$rmq:15672/;
|
|
proxy_connect_timeout 3s;
|
|
proxy_read_timeout 3s;
|
|
}
|
|
|
|
location /health-check/minio {
|
|
resolver 127.0.0.11 valid=30s;
|
|
set $minio staging-dataLayer-minio;
|
|
proxy_pass http://$minio:9000/minio/health/live;
|
|
proxy_connect_timeout 3s;
|
|
proxy_read_timeout 3s;
|
|
}
|
|
|
|
location /health-check/pgadmin {
|
|
resolver 127.0.0.11 valid=30s;
|
|
set $pga staging-dataLayer-pgadmin;
|
|
proxy_pass http://$pga:80/;
|
|
proxy_connect_timeout 3s;
|
|
proxy_read_timeout 3s;
|
|
}
|
|
|
|
# SPA fallback
|
|
location / {
|
|
try_files $uri $uri/ /admin/index.html;
|
|
}
|
|
|
|
# Cache static assets
|
|
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
|
|
expires 1y;
|
|
add_header Cache-Control "public, immutable";
|
|
}
|
|
|
|
# Security headers
|
|
add_header X-Frame-Options "SAMEORIGIN" always;
|
|
add_header X-Content-Type-Options "nosniff" always;
|
|
add_header X-XSS-Protection "1; mode=block" always;
|
|
}
|
|
|
|
# HTTP server (for Kong proxy + direct access)
|
|
server {
|
|
listen 80;
|
|
absolute_redirect off;
|
|
server_name localhost didi.local;
|
|
|
|
client_max_body_size 100M;
|
|
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
|
|
gzip on;
|
|
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
|
|
|
|
location = / {
|
|
return 301 $scheme://$http_host/admin/;
|
|
}
|
|
|
|
location /api/ {
|
|
resolver 127.0.0.11 valid=30s;
|
|
set $kong_upstream didi-kong;
|
|
proxy_pass http://$kong_upstream:8000;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Host didi365.eu;
|
|
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 https;
|
|
proxy_set_header X-Forwarded-Host $host;
|
|
proxy_read_timeout 660s;
|
|
proxy_send_timeout 660s;
|
|
proxy_connect_timeout 10s;
|
|
}
|
|
|
|
location ^~ /auth/ {
|
|
resolver 127.0.0.11 valid=30s;
|
|
set $kc_upstream keycloak;
|
|
proxy_pass http://$kc_upstream:8080;
|
|
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 https;
|
|
proxy_set_header X-Forwarded-Host $host;
|
|
proxy_set_header X-Forwarded-Port 443;
|
|
proxy_buffer_size 128k;
|
|
proxy_buffers 4 256k;
|
|
proxy_busy_buffers_size 256k;
|
|
}
|
|
|
|
location /agent-v3/ {
|
|
resolver 127.0.0.11 valid=30s;
|
|
set $agent_upstream didi-agent-v3;
|
|
rewrite ^/agent-v3/(.*) /$1 break;
|
|
proxy_pass http://$agent_upstream:24803;
|
|
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_read_timeout 660s;
|
|
proxy_send_timeout 660s;
|
|
proxy_connect_timeout 10s;
|
|
}
|
|
|
|
location /framework/ {
|
|
resolver 127.0.0.11 valid=30s;
|
|
set $framework_upstream didi-framework;
|
|
rewrite ^/framework/(.*) /$1 break;
|
|
proxy_pass http://$framework_upstream:3005;
|
|
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;
|
|
}
|
|
|
|
# Health check proxies (same as HTTPS block)
|
|
location /health-check/postgres {
|
|
resolver 127.0.0.11 valid=30s;
|
|
set $pg staging-dataLayer-postgres;
|
|
proxy_pass http://$pg:5432/;
|
|
proxy_connect_timeout 3s;
|
|
}
|
|
location /health-check/redis-commander {
|
|
resolver 127.0.0.11 valid=30s;
|
|
set $rc staging-dataLayer-redis-commander;
|
|
proxy_pass http://$rc:8081/redis-commander/;
|
|
proxy_connect_timeout 3s;
|
|
}
|
|
location /health-check/rabbitmq {
|
|
resolver 127.0.0.11 valid=30s;
|
|
set $rmq staging-dataLayer-rabbitmq;
|
|
proxy_pass http://$rmq:15672/;
|
|
proxy_connect_timeout 3s;
|
|
}
|
|
location /health-check/minio {
|
|
resolver 127.0.0.11 valid=30s;
|
|
set $minio staging-dataLayer-minio;
|
|
proxy_pass http://$minio:9000/minio/health/live;
|
|
proxy_connect_timeout 3s;
|
|
}
|
|
location /health-check/pgadmin {
|
|
resolver 127.0.0.11 valid=30s;
|
|
set $pga staging-dataLayer-pgadmin;
|
|
proxy_pass http://$pga:80/;
|
|
proxy_connect_timeout 3s;
|
|
}
|
|
location / {
|
|
try_files $uri $uri/ /admin/index.html;
|
|
}
|
|
|
|
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
|
|
expires 1y;
|
|
add_header Cache-Control "public, immutable";
|
|
}
|
|
}
|