🔧 Fix Gitea Actions for zero-downtime deployment
- Create new ci-cd-zero-downtime-fixed.yml workflow
- Disable old workflows that try to access port 3000 directly
- New workflow uses docker-compose.zero-downtime.yml
- Health checks now use nginx on port 80 instead of direct port 3000
- Fixes the 'Connection refused' errors in Gitea Actions
✅ Actions now properly work with zero-downtime nginx setup
This commit is contained in:
@@ -10,7 +10,7 @@ ENVIRONMENT=${1:-production}
|
||||
REGISTRY="ghcr.io"
|
||||
IMAGE_NAME="dennis-konkol/my_portfolio"
|
||||
CONTAINER_NAME="portfolio-app"
|
||||
COMPOSE_FILE="docker-compose.prod.yml"
|
||||
COMPOSE_FILE="docker-compose.zero-downtime.yml"
|
||||
|
||||
# Colors for output
|
||||
RED='\033[0;31m'
|
||||
@@ -79,10 +79,10 @@ echo "$GITHUB_TOKEN" | docker login $REGISTRY -u $GITHUB_ACTOR --password-stdin
|
||||
warning "Failed to login to registry. Make sure GITHUB_TOKEN and GITHUB_ACTOR are set."
|
||||
}
|
||||
|
||||
# Pull latest image
|
||||
log "Pulling latest image..."
|
||||
docker pull $FULL_IMAGE_NAME || {
|
||||
error "Failed to pull image $FULL_IMAGE_NAME"
|
||||
# Build latest image locally
|
||||
log "Building latest image locally..."
|
||||
docker build -t portfolio-app:latest . || {
|
||||
error "Failed to build image locally"
|
||||
exit 1
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ HEALTH_CHECK_INTERVAL=2
|
||||
ELAPSED=0
|
||||
|
||||
while [ $ELAPSED -lt $HEALTH_CHECK_TIMEOUT ]; do
|
||||
if curl -f http://localhost:3000/api/health > /dev/null 2>&1; then
|
||||
if curl -f http://localhost/api/health > /dev/null 2>&1; then
|
||||
success "Application is healthy!"
|
||||
break
|
||||
fi
|
||||
@@ -131,7 +131,7 @@ fi
|
||||
|
||||
# Verify deployment
|
||||
log "Verifying deployment..."
|
||||
if curl -f http://localhost:3000/api/health > /dev/null 2>&1; then
|
||||
if curl -f http://localhost/api/health > /dev/null 2>&1; then
|
||||
success "Deployment successful!"
|
||||
|
||||
# Show container status
|
||||
@@ -156,5 +156,5 @@ docker system prune -f --volumes || {
|
||||
}
|
||||
|
||||
success "Deployment completed successfully!"
|
||||
log "Application is available at: http://localhost:3000"
|
||||
log "Health check endpoint: http://localhost:3000/api/health"
|
||||
log "Application is available at: http://localhost/"
|
||||
log "Health check endpoint: http://localhost/api/health"
|
||||
|
||||
@@ -37,7 +37,7 @@ warning() {
|
||||
check_health() {
|
||||
log "Checking application health..."
|
||||
|
||||
if curl -f http://localhost:3000/api/health > /dev/null 2>&1; then
|
||||
if curl -f http://localhost/api/health > /dev/null 2>&1; then
|
||||
success "Application is healthy"
|
||||
return 0
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user