🔧 Fix zero-downtime deployment issues
Some checks failed
CI/CD Pipeline (Fast) / production (push) Failing after 5m10s
CI/CD Pipeline (Zero Downtime) / production (push) Failing after 7m53s
CI/CD Pipeline (Simple) / production (push) Failing after 9m14s

- 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/
This commit is contained in:
2025-09-13 22:31:39 +02:00
parent bdc38d8b57
commit 3dbe80edcc
2 changed files with 8 additions and 13 deletions

View File

@@ -55,7 +55,7 @@ RUN chown nextjs:nodejs .next
# Automatically leverage output traces to reduce image size # Automatically leverage output traces to reduce image size
# https://nextjs.org/docs/advanced-features/output-file-tracing # 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 --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
# Copy Prisma files # Copy Prisma files

View File

@@ -9,18 +9,6 @@ http {
server portfolio-app-2:3000 max_fails=3 fail_timeout=30s; 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 # Main server
server { server {
listen 80; listen 80;
@@ -42,6 +30,13 @@ http {
proxy_buffer_size 4k; proxy_buffer_size 4k;
proxy_buffers 8 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 # Main location
location / { location / {
proxy_pass http://portfolio_backend; proxy_pass http://portfolio_backend;