🔧 Fix zero-downtime deployment issues
- 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:
@@ -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
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user