oramap/frontend/nginx.conf
dvirlabs c457db534b
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Restructure project and update Helm chart for microservices
Directory Changes:
- Moved old unused files to 'old/' directory:
  - server.js, package.json, package-lock.json, node_modules
  - data/, public/, run_ora_map.sh, README copy.md
- Clean root structure with only backend/ and frontend/ dirs
- Updated .gitignore to ignore old directories

Helm Chart Updates (oramap/):
- Updated Chart.yaml to v0.2.0 with proper description
- Split values.yaml for separate backend and frontend configurations
- Created separate deployments for backend and frontend
- Created separate services for backend (port 3000) and frontend (port 80)
- Added ConfigMap for nginx configuration in Kubernetes
- Added volume mounts for nginx config in frontend deployment
- Updated ingress to route to frontend service
- Added proper health checks for both services
- Added resource limits and requests

Frontend Updates:
- Enhanced nginx.conf with dynamic backend routing
- Supports both Docker Compose and Kubernetes service discovery

This enables proper microservices deployment in Kubernetes with:
- Separate scaling for frontend and backend
- Independent deployments and rollbacks
- Proper service discovery and load balancing
2026-03-24 10:25:23 +02:00

45 lines
1.4 KiB
Nginx Configuration File

server {
listen 80;
server_name _;
root /usr/share/nginx/html;
index index.html;
# Gzip compression
gzip on;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
# Main location
location / {
try_files $uri $uri/ /index.html;
}
# API proxy to backend service
# For Kubernetes: set BACKEND_HOST env var or use service name
# For Docker Compose: backend service name is 'backend'
location /api/ {
# In Kubernetes, this will be: oramap-backend:3000
# In Docker Compose, this will be: backend:3000
# Default to backend:3000
set $backend_host backend;
if ($http_x_backend_host != "") {
set $backend_host $http_x_backend_host;
}
proxy_pass http://$backend_host:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
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;
}
# Cache static assets
location ~* \.(jpg|jpeg|png|gif|ico|css|js|svg)$ {
expires 1y;
add_header Cache-Control "public, immutable";
}
}