Skip to content

Azure Deployment Process

S5 uses GitHub Actions for automated deployments to Azure Container Apps.

Deployment Workflow

Preview Deployment

Trigger: Push to preview branch

Process:

  1. GitHub Actions workflow starts (.github/workflows/preview.yml)
  2. Checkout code from repository
  3. Login to Azure using AZURE_CREDENTIALS secret
  4. Login to Azure Container Registry
  5. Build Docker image:
  6. Download slidefactory-core wheel from GitHub releases (v1.0.8)
  7. Copy S5 branding assets from s5_branding/
  8. Install Azure dependencies
  9. Create application image
  10. Push image to Azure Container Registry with tag preview-{sha}
  11. Update Azure Container App with new image
  12. Container App performs rolling update

Preview URL: https://slidefactory-preview.sportfive.com

Duration: ~5-10 minutes

Production Deployment

Trigger: Push to main branch (repository owner only)

Process: Same as preview deployment, but:

  • Uses .github/workflows/production.yml
  • Uses AZURE_CREDENTIALS_PROD secret
  • Deploys to production resource group
  • Tags image with prod-{sha}
  • Updates production Container App

Production URL: https://slidefactory.sportfive.com

Duration: ~5-10 minutes

Deployment Architecture

Developer Push
GitHub Actions
Build Docker Image (with core package)
Push to Azure Container Registry
Update Container App
Rolling Deployment (zero downtime)

Manual Deployment

Via Azure CLI

# Login to Azure
az login

# Update preview environment
az containerapp update \
  --name slidefactory-web-preview \
  --resource-group rg-slidefactory-preview \
  --image s5slidefactory.azurecr.io/slidefactory:preview-abc123

# Update production environment (owner only)
az containerapp update \
  --name slidefactory-web-prod \
  --resource-group rg-slidefactory-prod \
  --image s5slidefactory.azurecr.io/slidefactory:prod-abc123

Via Azure Portal

  1. Navigate to Azure Portal
  2. Go to Container App resource
  3. Select Revision Management
  4. Create new revision with updated image
  5. Activate new revision

Rollback Procedures

Rollback to Previous Revision

Azure Container Apps keeps previous revisions, allowing instant rollback:

# List revisions
az containerapp revision list \
  --name slidefactory-web-preview \
  --resource-group rg-slidefactory-preview \
  --output table

# Activate previous revision
az containerapp revision activate \
  --name slidefactory-web-preview \
  --resource-group rg-slidefactory-preview \
  --revision slidefactory-web-preview--abc123

Rollback Duration: ~30 seconds (instant traffic switch)

Rollback via Git

# Revert last commit on preview branch
git revert HEAD
git push origin preview

# Or reset to previous commit (use with caution)
git reset --hard HEAD~1
git push origin preview --force

Rollback Duration: ~5-10 minutes (full redeployment)

Pre-Deployment Checklist

Before merging previewmain for production deployment:

  • Preview deployment successful
  • Smoke tests pass on preview environment
  • Database migrations applied successfully (if any)
  • Environment variables updated (if needed)
  • S5 branding displays correctly
  • User can log in with Azure AD
  • Presentations generate successfully
  • N8N workflows execute properly
  • No errors in Container App logs
  • Performance is acceptable (response times < 2s)

Monitoring Deployment

GitHub Actions

View deployment progress:

  1. Go to repository on GitHub
  2. Click Actions tab
  3. Select the workflow run
  4. View logs for each step

Key Steps to Monitor: - Build Docker image (should complete in ~3-5 minutes) - Push to Azure Container Registry (should complete in ~1-2 minutes) - Update Container App (should complete in ~2-3 minutes)

Azure Portal

Monitor Container App health during deployment:

  1. Go to Container App resource in Azure Portal
  2. View Metrics for CPU/memory usage
  3. Check Log stream for application logs
  4. Review Revision management for active revision
  5. Check Health probes status

Healthy Deployment Indicators: - New revision shows as "Active" - Health probes return 200 OK - CPU/memory within normal range - No error logs during startup

Deployment Secrets

Required GitHub secrets for deployment:

Preview Environment

  • AZURE_CREDENTIALS - Azure service principal credentials for preview
  • GH_PAT_SLIDEFACTORY_CORE - GitHub PAT to download private core package

Production Environment

  • AZURE_CREDENTIALS_PROD - Azure service principal credentials for production
  • GH_PAT_SLIDEFACTORY_CORE - GitHub PAT to download private core package (same as preview)

Troubleshooting Deployments

Issue: GitHub Actions Workflow Fails

Symptoms: Workflow shows red X, deployment never reaches Azure

Solutions:

  1. Check GitHub Actions logs for specific error
  2. Verify Azure credentials are valid: az login using service principal
  3. Verify GitHub PAT has access to slidefactory-core repository
  4. Check if Container Registry is accessible
  5. Verify Docker build succeeds locally

Issue: Container App Deployment Fails

Symptoms: Deployment reaches Azure but Container App doesn't start

Solutions:

  1. Check Container App logs in Azure Portal → Log stream
  2. Verify environment variables are set correctly in Container App configuration
  3. Check if database is accessible from Container App
  4. Verify slidefactory-core wheel exists in GitHub releases (v1.0.8)
  5. Check if image exists in Azure Container Registry

Issue: Database Migration Failures

Symptoms: App starts but shows database errors

Solutions:

  1. Check Container App logs for Alembic migration errors
  2. Manually run migrations via Azure CLI:
    az containerapp exec \
      --name slidefactory-web-preview \
      --resource-group rg-slidefactory-preview \
      --command "alembic upgrade head"
    
  3. Verify database connection string in environment variables
  4. Check if pgvector extension is installed in PostgreSQL

Issue: Application Doesn't Respond After Deployment

Symptoms: Deployment succeeds but app returns 502/503 errors

Solutions:

  1. Check health probe status in Container App
  2. Verify port 8000 is exposed in Dockerfile
  3. Check if FastAPI app starts successfully in logs
  4. Verify Redis connection for sessions
  5. Check if Azure Blob Storage is accessible

Deployment Best Practices

  1. Always test on preview first - Never deploy directly to production
  2. Monitor logs during deployment - Watch for errors in real-time
  3. Keep rollback ready - Know how to quickly rollback if needed
  4. Update preview frequently - Don't let preview drift from production
  5. Document breaking changes - Update deployment checklist for major changes
  6. Use semantic versioning - Tag releases in Git for tracking
  7. Coordinate with users - Notify users of production deployments