mirror of
https://github.com/thecyberlearn/modern-django-starter.git
synced 2026-08-18 07:52:54 +00:00
🎯 Future-proof deployment system: 1. DEPLOYMENT_CHECKLIST.md - Zero-fail step-by-step guide 2. scripts/pre-deploy-check.sh - Validates everything before deployment 3. scripts/post-deploy-verify.sh - Tests deployment after completion 4. .github/workflows/deploy.yml - Automated GitHub Actions validation ✅ Key features: - Catches static files, migrations, Docker issues before deployment - Provides clear error messages and next steps - Tests all endpoints after deployment - 5-minute deployment target with this system - Copy-paste templates for new projects Run: ./scripts/pre-deploy-check.sh before every deployment Run: ./scripts/post-deploy-verify.sh after deployment Never face deployment issues again! 🚀
90 lines
2.5 KiB
YAML
90 lines
2.5 KiB
YAML
name: 🚀 Deploy to Dokploy
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
pull_request:
|
|
branches: [ main ]
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
pre-deploy-checks:
|
|
runs-on: ubuntu-latest
|
|
name: 🔍 Pre-deployment validation
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Python 3.11
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: '3.11'
|
|
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '18'
|
|
|
|
- name: Cache Python dependencies
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ~/.cache/pip
|
|
key: ${{ runner.os }}-pip-${{ hashFiles('requirements/production.txt') }}
|
|
|
|
- name: Install Python dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install -r requirements/production.txt
|
|
|
|
- name: Install and build Tailwind CSS
|
|
run: |
|
|
cd theme/static_src
|
|
npm install
|
|
npm run build
|
|
|
|
- name: Run Django system checks
|
|
run: |
|
|
export DJANGO_SETTINGS_MODULE=django_project.settings.production
|
|
export SECRET_KEY=github-actions-secret-key
|
|
export ALLOWED_HOSTS=localhost
|
|
export DEBUG=False
|
|
python manage.py check --deploy
|
|
|
|
- name: Test static file collection
|
|
run: |
|
|
export DJANGO_SETTINGS_MODULE=django_project.settings.build
|
|
python manage.py collectstatic --noinput --dry-run
|
|
|
|
- name: Check for pending migrations
|
|
run: |
|
|
export DJANGO_SETTINGS_MODULE=django_project.settings.production
|
|
export SECRET_KEY=github-actions-secret-key
|
|
export DATABASE_URL=sqlite:///temp.db
|
|
python manage.py makemigrations --check --dry-run
|
|
|
|
- name: Test Docker build
|
|
run: |
|
|
docker build --target production -t django-template-test .
|
|
docker rmi django-template-test
|
|
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
name: 📤 Deploy notification
|
|
needs: pre-deploy-checks
|
|
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
|
|
|
|
steps:
|
|
- name: ✅ Pre-deployment checks passed
|
|
run: |
|
|
echo "🎉 All pre-deployment checks passed!"
|
|
echo "🚀 Ready for deployment to Dokploy"
|
|
echo "📋 Manual steps required:"
|
|
echo " 1. Trigger deployment in Dokploy dashboard"
|
|
echo " 2. Wait for build completion"
|
|
echo " 3. Run post-deployment verification"
|
|
|
|
- name: 📝 Deployment reminder
|
|
if: success()
|
|
run: |
|
|
echo "::notice::Deployment ready! Trigger deployment in Dokploy manually"
|