Merge branch 'production' of https://git.dk0.dev/denshooter/portfolio into production
This commit is contained in:
@@ -25,48 +25,10 @@ services:
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
# Fallback: if the config file doesn't exist, create a basic one
|
||||
# Simple startup command
|
||||
command: >
|
||||
sh -c "
|
||||
# Remove default nginx configuration files to prevent conflicts
|
||||
rm -rf /etc/nginx/conf.d/*
|
||||
|
||||
# Test the main config first
|
||||
if nginx -t -c /etc/nginx/nginx.conf 2>/dev/null; then
|
||||
echo 'Using main nginx configuration'
|
||||
else
|
||||
echo 'Main config failed, creating fallback nginx configuration...'
|
||||
cat > /etc/nginx/nginx.conf << 'EOF'
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
http {
|
||||
upstream portfolio_backend {
|
||||
server portfolio-app-1:3000 max_fails=3 fail_timeout=30s;
|
||||
server portfolio-app-2:3000 max_fails=3 fail_timeout=30s;
|
||||
}
|
||||
server {
|
||||
listen 80;
|
||||
server_name _;
|
||||
location /health {
|
||||
access_log off;
|
||||
return 200 'healthy\n';
|
||||
add_header Content-Type text/plain;
|
||||
}
|
||||
location / {
|
||||
proxy_pass http://portfolio_backend;
|
||||
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 5s;
|
||||
proxy_send_timeout 60s;
|
||||
proxy_read_timeout 60s;
|
||||
}
|
||||
}
|
||||
}
|
||||
EOF
|
||||
fi
|
||||
nginx -g 'daemon off;'
|
||||
"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user