Checkpoint before follow-up message
Co-authored-by: dennis <dennis@konkol.net>
This commit is contained in:
@@ -1,16 +1,16 @@
|
||||
name: Dev Deployment (Zero Downtime)
|
||||
name: Testing Deployment (Zero Downtime)
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ dev ]
|
||||
branches: [ testing ]
|
||||
|
||||
env:
|
||||
NODE_VERSION: '20'
|
||||
DOCKER_IMAGE: portfolio-app
|
||||
IMAGE_TAG: staging
|
||||
IMAGE_TAG: testing
|
||||
|
||||
jobs:
|
||||
deploy-dev:
|
||||
deploy-testing:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
@@ -38,7 +38,7 @@ jobs:
|
||||
|
||||
- name: Build Docker image
|
||||
run: |
|
||||
echo "🏗️ Building dev Docker image with BuildKit cache..."
|
||||
echo "🏗️ Building testing Docker image with BuildKit cache..."
|
||||
DOCKER_BUILDKIT=1 docker build \
|
||||
--cache-from ${{ env.DOCKER_IMAGE }}:${{ env.IMAGE_TAG }} \
|
||||
--cache-from ${{ env.DOCKER_IMAGE }}:latest \
|
||||
@@ -46,12 +46,12 @@ jobs:
|
||||
.
|
||||
echo "✅ Docker image built successfully"
|
||||
|
||||
- name: Zero-Downtime Dev Deployment
|
||||
- name: Zero-Downtime Testing Deployment
|
||||
run: |
|
||||
echo "🚀 Starting zero-downtime dev deployment..."
|
||||
echo "🚀 Starting zero-downtime testing deployment..."
|
||||
|
||||
COMPOSE_FILE="docker-compose.staging.yml"
|
||||
CONTAINER_NAME="portfolio-app-staging"
|
||||
COMPOSE_FILE="docker-compose.testing.yml"
|
||||
CONTAINER_NAME="portfolio-app-testing"
|
||||
HEALTH_PORT="3002"
|
||||
|
||||
# Backup current container ID if running
|
||||
@@ -59,7 +59,7 @@ jobs:
|
||||
|
||||
# Start new container with updated image
|
||||
echo "🆕 Starting new dev container..."
|
||||
docker compose -f $COMPOSE_FILE up -d --no-deps --build portfolio-staging
|
||||
docker compose -f $COMPOSE_FILE up -d --no-deps --build portfolio-testing
|
||||
|
||||
# Wait for new container to be healthy
|
||||
echo "⏳ Waiting for new container to be healthy..."
|
||||
@@ -84,8 +84,8 @@ jobs:
|
||||
|
||||
# Verify new container is working
|
||||
if ! curl -f http://localhost:$HEALTH_PORT/api/health > /dev/null 2>&1; then
|
||||
echo "⚠️ New dev container health check failed, but continuing (non-blocking)..."
|
||||
docker compose -f $COMPOSE_FILE logs --tail=50 portfolio-staging
|
||||
echo "⚠️ New testing container health check failed, but continuing (non-blocking)..."
|
||||
docker compose -f $COMPOSE_FILE logs --tail=50 portfolio-testing
|
||||
fi
|
||||
|
||||
# Remove old container if it exists and is different
|
||||
@@ -98,11 +98,11 @@ jobs:
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "✅ Dev deployment completed!"
|
||||
echo "✅ Testing deployment completed!"
|
||||
env:
|
||||
NODE_ENV: staging
|
||||
NODE_ENV: production
|
||||
LOG_LEVEL: ${{ vars.LOG_LEVEL || 'debug' }}
|
||||
NEXT_PUBLIC_BASE_URL: ${{ vars.NEXT_PUBLIC_BASE_URL || 'https://dev.dk0.dev' }}
|
||||
NEXT_PUBLIC_BASE_URL: ${{ vars.NEXT_PUBLIC_BASE_URL_TESTING || 'https://testing.dk0.dev' }}
|
||||
MY_EMAIL: ${{ vars.MY_EMAIL }}
|
||||
MY_INFO_EMAIL: ${{ vars.MY_INFO_EMAIL }}
|
||||
MY_PASSWORD: ${{ secrets.MY_PASSWORD }}
|
||||
@@ -111,19 +111,19 @@ jobs:
|
||||
N8N_WEBHOOK_URL: ${{ vars.N8N_WEBHOOK_URL || '' }}
|
||||
N8N_SECRET_TOKEN: ${{ secrets.N8N_SECRET_TOKEN || '' }}
|
||||
|
||||
- name: Dev Health Check
|
||||
- name: Testing Health Check
|
||||
run: |
|
||||
echo "🔍 Running dev health checks..."
|
||||
echo "🔍 Running testing health checks..."
|
||||
for i in {1..20}; do
|
||||
if curl -f http://localhost:3002/api/health && curl -f http://localhost:3002/ > /dev/null; then
|
||||
echo "✅ Dev is fully operational!"
|
||||
echo "✅ Testing is fully operational!"
|
||||
exit 0
|
||||
fi
|
||||
echo "⏳ Waiting for dev... ($i/20)"
|
||||
echo "⏳ Waiting for testing... ($i/20)"
|
||||
sleep 3
|
||||
done
|
||||
echo "⚠️ Dev health check failed, but continuing (non-blocking)..."
|
||||
docker compose -f docker-compose.staging.yml logs --tail=50
|
||||
echo "⚠️ Testing health check failed, but continuing (non-blocking)..."
|
||||
docker compose -f docker-compose.testing.yml logs --tail=50
|
||||
|
||||
- name: Cleanup
|
||||
run: |
|
||||
|
||||
@@ -196,7 +196,7 @@ jobs:
|
||||
env:
|
||||
NODE_ENV: production
|
||||
LOG_LEVEL: ${{ vars.LOG_LEVEL || 'info' }}
|
||||
NEXT_PUBLIC_BASE_URL: ${{ vars.NEXT_PUBLIC_BASE_URL || 'https://dk0.dev' }}
|
||||
NEXT_PUBLIC_BASE_URL: ${{ vars.NEXT_PUBLIC_BASE_URL_PRODUCTION || 'https://dk0.dev' }}
|
||||
MY_EMAIL: ${{ vars.MY_EMAIL }}
|
||||
MY_INFO_EMAIL: ${{ vars.MY_INFO_EMAIL }}
|
||||
MY_PASSWORD: ${{ secrets.MY_PASSWORD }}
|
||||
|
||||
Reference in New Issue
Block a user