Files
digiserver-v2/DEPLOYMENT_STEPS_QUICK.md
Deployment System d235c8e057 Add quick deployment steps guide (4 phases, 12 steps)
- Create DEPLOYMENT_STEPS_QUICK.md with concise deployment workflow
- Include command cheat sheet and timing breakdown
- Add troubleshooting quick fixes
- Update DOCUMENTATION_INDEX.md to highlight quick guide
2026-01-16 22:44:37 +02:00

4.6 KiB

🚀 Deployment Steps - Quick Reference

Total Time: ~10 minutes | Risk Level: LOW | Difficulty: Easy


⏸️ Phase 1: Pre-Deployment (Before you start)

Step 1: Identify Target IP

Determine what IP your host will have after restart:

TARGET_IP=192.168.0.121    # Example: your static production IP

Step 2: Generate SECRET_KEY

python -c "import secrets; print(secrets.token_urlsafe(32))"
# Copy output - you'll need this

Step 3: Create .env File

cp .env.example .env

Step 4: Configure .env

nano .env

Edit these values in .env:

SECRET_KEY=<paste-generated-key-from-step-2>
ADMIN_PASSWORD=<set-strong-password>
HOST_IP=192.168.0.121
DOMAIN=digiserver.local
TRUSTED_PROXIES=192.168.0.0/24

🔨 Phase 2: Build & Start (Still on current network)

Step 5: Build Docker Images

docker-compose build

Step 6: Start Containers

docker-compose up -d

Step 7: Initialize Database

docker-compose exec digiserver-app flask db upgrade

Step 8: Wait for Startup

# Wait ~30 seconds for containers to be healthy
sleep 30

# Verify containers are healthy
docker-compose ps
# Look for "healthy" status on both containers

🌐 Phase 3: Move Host to Target Network

Step 9: Network Configuration

  • Physically disconnect host from current network
  • Connect to production network (e.g., 192.168.0.0/24)
  • Host will receive/retain static IP (192.168.0.121)

Phase 4: Verification

Step 10: Test Health Endpoint

curl -k https://192.168.0.121/api/health

# Expected response:
# {"status":"healthy","timestamp":"...","version":"2.0.0"}

Step 11: Check Logs

docker-compose logs --tail=50 digiserver-app

# Look for any ERROR messages
# Should see Flask running on port 5000

Step 12: Test API with CORS

curl -i -k https://192.168.0.121/api/playlists

# Verify CORS headers present:
# access-control-allow-origin: *
# access-control-allow-methods: GET, POST, PUT, DELETE, OPTIONS

📋 Command Cheat Sheet

# Create environment
cp .env.example .env && nano .env

# Build and start
docker-compose build
docker-compose up -d

# Initialize database
docker-compose exec digiserver-app flask db upgrade

# Check status
docker-compose ps

# View logs
docker-compose logs -f digiserver-app

# Health check
curl -k https://192.168.0.121/api/health

# Stop services
docker-compose down

# Restart services
docker-compose restart

⏱️ Timing Breakdown

Phase Duration Notes
Pre-deployment setup 5 min Configure .env
Docker build 2-3 min First time only
Containers start 30 sec Automatic
Database init 10 sec Flask migrations
Network move Instant Plug/Unplug
Verification 2 min Health checks
Total ~10 min Ready to go

Post-Deployment

Once verified working:

  • Backup .env (contains secrets)

    cp .env /backup/.env.backup
    chmod 600 /backup/.env.backup
    
  • Enable backups (optional)

    # Add to crontab for daily backups
    0 2 * * * docker-compose exec digiserver-app \
      cp instance/dashboard.db /backup/db.$(date +\%Y\%m\%d)
    
  • Monitor logs (first 24 hours)

    docker-compose logs -f digiserver-app
    

🆘 Troubleshooting Quick Fixes

Issue Fix
Build fails Run: docker-compose build --no-cache
Port already in use Run: docker-compose down first
Container won't start Check logs: docker-compose logs digiserver-app
Health check fails Wait 30 sec longer, networks take time
Can't reach API Verify host IP: ip addr | grep 192.168
Certificate error Curl with -k flag (self-signed cert)

🎯 Success Criteria

All steps completed when:

  • docker-compose ps shows both containers "Up" and "healthy"
  • curl -k https://192.168.0.121/api/health returns 200
  • CORS headers present in API responses
  • No ERROR messages in logs
  • Admin panel accessible at https://192.168.0.121/admin

📞 Need Help?

See detailed guides:


Status: Ready to deploy
Last Updated: 2026-01-16
Deployment Type: Network transition (deploy on one network, run on another)