From 3dbe80edcc40b3e4cffe7b4c4b0534dc2d309e3f Mon Sep 17 00:00:00 2001 From: denshooter Date: Sat, 13 Sep 2025 22:31:39 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20Fix=20zero-downtime=20deployment?= =?UTF-8?q?=20issues?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fix Dockerfile standalone build path from /app/.next/standalone/gitea/portfolio to /app/.next/standalone/app - Fix nginx configuration by removing conflicting server blocks - Consolidate health check and main proxy into single server block - Ensure proper load balancing between portfolio-app-1 and portfolio-app-2 ✅ Deployment now working successfully with: - Application running on both instances (healthy) - Database and Redis running (healthy) - Nginx load balancer working - Health endpoints accessible - Main portfolio site accessible at http://localhost/ --- Dockerfile | 2 +- nginx-zero-downtime.conf | 19 +++++++------------ 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/Dockerfile b/Dockerfile index 312d9bd..1637064 100644 --- a/Dockerfile +++ b/Dockerfile @@ -55,7 +55,7 @@ RUN chown nextjs:nodejs .next # Automatically leverage output traces to reduce image size # https://nextjs.org/docs/advanced-features/output-file-tracing -COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ +COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone/app ./ COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static # Copy Prisma files diff --git a/nginx-zero-downtime.conf b/nginx-zero-downtime.conf index 9d3a57b..c5ebace 100644 --- a/nginx-zero-downtime.conf +++ b/nginx-zero-downtime.conf @@ -9,18 +9,6 @@ http { server portfolio-app-2:3000 max_fails=3 fail_timeout=30s; } - # Health check endpoint - server { - listen 80; - server_name _; - - location /health { - access_log off; - return 200 "healthy\n"; - add_header Content-Type text/plain; - } - } - # Main server server { listen 80; @@ -42,6 +30,13 @@ http { proxy_buffer_size 4k; proxy_buffers 8 4k; + # Health check endpoint + location /health { + access_log off; + return 200 "healthy\n"; + add_header Content-Type text/plain; + } + # Main location location / { proxy_pass http://portfolio_backend;