voxblog/.gitea/workflows/deploy.yml
Ender 51999669af
Some checks are pending
Deploy to Production / deploy (push) Waiting to run
feat: add deployment and server configuration files
- Added .dockerignore to exclude unnecessary files from Docker builds
- Enhanced .env.example with detailed configuration options and added MySQL settings
- Created Gitea CI/CD workflow for automated production deployment with health checks
- Added comprehensive Caddy server setup guide and configuration for reverse proxy
- Created Caddyfile with secure defaults for SSL, compression, and security headers

The changes focus on setting up a production-
2025-10-25 23:04:04 +02:00

82 lines
2.2 KiB
YAML

name: Deploy to Production
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Create .env file
run: |
cat > .env << EOF
MYSQL_ROOT_PASSWORD=${{ secrets.MYSQL_ROOT_PASSWORD }}
MYSQL_PASSWORD=${{ secrets.MYSQL_PASSWORD }}
ADMIN_PASSWORD=${{ secrets.ADMIN_PASSWORD }}
OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}
GHOST_ADMIN_API_KEY=${{ secrets.GHOST_ADMIN_API_KEY }}
S3_BUCKET=${{ secrets.S3_BUCKET }}
S3_REGION=${{ secrets.S3_REGION }}
S3_ACCESS_KEY=${{ secrets.S3_ACCESS_KEY }}
S3_SECRET_KEY=${{ secrets.S3_SECRET_KEY }}
S3_ENDPOINT=${{ secrets.S3_ENDPOINT }}
VITE_API_URL=${{ secrets.VITE_API_URL }}
EOF
- name: Stop existing containers
run: docker-compose down || true
- name: Build images
run: docker-compose build --no-cache
- name: Start containers
run: docker-compose up -d
- name: Wait for services
run: sleep 15
- name: Run database migrations
run: docker-compose exec -T api pnpm run drizzle:migrate || echo "Migration skipped"
- name: Health check API
run: |
for i in {1..10}; do
if curl -f http://localhost:3001/health; then
echo "API is healthy"
exit 0
fi
echo "Waiting for API... ($i/10)"
sleep 5
done
echo "API health check failed"
docker-compose logs api
exit 1
- name: Health check Admin
run: |
if curl -f http://localhost:3000; then
echo "Admin is healthy"
else
echo "Admin health check failed"
docker-compose logs admin
exit 1
fi
- name: Clean up old images
run: docker image prune -af --filter "until=24h"
- name: Deployment summary
run: |
echo "✅ Deployment successful!"
echo "Services:"
docker-compose ps