fix: deploy workflow — add port 22, fix docker compose project name
Deploy to Dev / deploy-dev (push) Failing after 31s
Details
Deploy to Dev / deploy-dev (push) Failing after 31s
Details
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
e49fa9e746
commit
fb167ce83d
|
|
@ -7,7 +7,7 @@ on:
|
||||||
jobs:
|
jobs:
|
||||||
deploy-dev:
|
deploy-dev:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Deploy to Dev Server
|
- name: Deploy to Dev Server
|
||||||
uses: appleboy/ssh-action@v1.0.0
|
uses: appleboy/ssh-action@v1.0.0
|
||||||
|
|
@ -15,55 +15,38 @@ jobs:
|
||||||
host: ${{ secrets.DEV_HOST }}
|
host: ${{ secrets.DEV_HOST }}
|
||||||
username: ${{ secrets.DEV_USER }}
|
username: ${{ secrets.DEV_USER }}
|
||||||
key: ${{ secrets.SSH_PRIVATE_KEY }}
|
key: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||||
|
port: 22
|
||||||
use_insecure_cipher: true
|
use_insecure_cipher: true
|
||||||
debug: true
|
|
||||||
script_stop: true
|
script_stop: true
|
||||||
script: |
|
script: |
|
||||||
set -e
|
set -e
|
||||||
cd /var/www/platform/dev
|
cd /var/www/platform/dev
|
||||||
|
|
||||||
echo "📦 Pulling latest changes from repository..."
|
echo "📦 Pulling latest changes..."
|
||||||
git pull origin main || git pull origin master || git pull origin develop || git pull origin dev || true
|
git pull origin develop
|
||||||
|
|
||||||
echo "🔄 Restarting Docker services..."
|
echo "🔄 Restarting Docker services..."
|
||||||
docker compose restart
|
docker compose -p platform_dev restart web celery celery-beat
|
||||||
|
|
||||||
echo "📊 Running migrations (if needed)..."
|
echo "📊 Running migrations..."
|
||||||
docker compose exec -T web python manage.py migrate || true
|
docker compose -p platform_dev exec -T web python manage.py migrate || true
|
||||||
|
|
||||||
echo "📁 Collecting static files (if needed)..."
|
echo "✅ Dev deployment completed"
|
||||||
docker compose exec -T web python manage.py collectstatic --noinput --clear || echo "⚠️ collectstatic failed, but continuing..."
|
|
||||||
|
|
||||||
echo "✅ Dev deployment completed successfully"
|
|
||||||
echo "ℹ️ You can continue working directly on the server"
|
|
||||||
|
|
||||||
- name: Health Check
|
- name: Health Check
|
||||||
uses: appleboy/ssh-action@v1.0.0
|
uses: appleboy/ssh-action@v1.0.0
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.DEV_HOST }}
|
host: ${{ secrets.DEV_HOST }}
|
||||||
username: ${{ secrets.DEV_USER }}
|
username: ${{ secrets.DEV_USER }}
|
||||||
key: ${{ secrets.SSH_PRIVATE_KEY }}
|
key: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||||
|
port: 22
|
||||||
use_insecure_cipher: true
|
use_insecure_cipher: true
|
||||||
debug: true
|
|
||||||
script_stop: true
|
|
||||||
script: |
|
script: |
|
||||||
set -e
|
sleep 8
|
||||||
cd /var/www/platform/dev
|
docker compose -p platform_dev ps | head -15
|
||||||
echo "⏳ Waiting for services to start..."
|
HEALTH=$(curl -s http://localhost:8124/health/ 2>&1)
|
||||||
sleep 10
|
if [ -n "$HEALTH" ]; then
|
||||||
echo "📊 Checking Docker containers status..."
|
echo "✅ Health OK: $HEALTH" | head -c 200
|
||||||
docker compose ps | head -10
|
|
||||||
echo ""
|
|
||||||
echo "🏥 Checking health endpoint..."
|
|
||||||
HEALTH_RESPONSE=$(curl -s http://localhost:8124/health/ 2>&1)
|
|
||||||
if [ -n "$HEALTH_RESPONSE" ]; then
|
|
||||||
echo "✅ Health endpoint is responding"
|
|
||||||
echo "$HEALTH_RESPONSE" | python3 -m json.tool 2>/dev/null | head -10 || echo "$HEALTH_RESPONSE" | head -5
|
|
||||||
if echo "$HEALTH_RESPONSE" | grep -q '"database".*"healthy"'; then
|
|
||||||
echo "✅ Database is healthy - deployment successful!"
|
|
||||||
else
|
|
||||||
echo "⚠️ Database check unclear, but endpoint responds"
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
echo "⚠️ Health endpoint not available yet, but deployment completed"
|
echo "⚠️ Health endpoint not responding yet"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue