diff --git a/.gitea/workflows/deploy-dev.yml b/.gitea/workflows/deploy-dev.yml index 6a1abff..972ce88 100644 --- a/.gitea/workflows/deploy-dev.yml +++ b/.gitea/workflows/deploy-dev.yml @@ -7,7 +7,7 @@ on: jobs: deploy-dev: runs-on: ubuntu-latest - + steps: - name: Deploy to Dev Server uses: appleboy/ssh-action@v1.0.0 @@ -15,55 +15,38 @@ jobs: host: ${{ secrets.DEV_HOST }} username: ${{ secrets.DEV_USER }} key: ${{ secrets.SSH_PRIVATE_KEY }} + port: 22 use_insecure_cipher: true - debug: true script_stop: true script: | set -e cd /var/www/platform/dev - - echo "đŸ“Ļ Pulling latest changes from repository..." - git pull origin main || git pull origin master || git pull origin develop || git pull origin dev || true - + + echo "đŸ“Ļ Pulling latest changes..." + git pull origin develop + echo "🔄 Restarting Docker services..." - docker compose restart - - echo "📊 Running migrations (if needed)..." - docker compose exec -T web python manage.py migrate || true - - echo "📁 Collecting static files (if needed)..." - 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" - + docker compose -p platform_dev restart web celery celery-beat + + echo "📊 Running migrations..." + docker compose -p platform_dev exec -T web python manage.py migrate || true + + echo "✅ Dev deployment completed" + - name: Health Check uses: appleboy/ssh-action@v1.0.0 with: host: ${{ secrets.DEV_HOST }} username: ${{ secrets.DEV_USER }} key: ${{ secrets.SSH_PRIVATE_KEY }} + port: 22 use_insecure_cipher: true - debug: true - script_stop: true script: | - set -e - cd /var/www/platform/dev - echo "âŗ Waiting for services to start..." - sleep 10 - echo "📊 Checking Docker containers status..." - 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 + sleep 8 + docker compose -p platform_dev ps | head -15 + HEALTH=$(curl -s http://localhost:8124/health/ 2>&1) + if [ -n "$HEALTH" ]; then + echo "✅ Health OK: $HEALTH" | head -c 200 else - echo "âš ī¸ Health endpoint not available yet, but deployment completed" + echo "âš ī¸ Health endpoint not responding yet" fi