Skip to content

✅ Successful Azure Container Apps Deployment

🎉 Deployment Complete!

Your Django parody news application has been successfully deployed to Azure Container Apps!

Deployment Time: 9 minutes 31 seconds
Status: ✅ LIVE
Endpoint: https://src.icysea-c22e25eb.westus2.azurecontainerapps.io/


📊 Deployed Resources

Container Apps Environment

  • Name: cae-uzsgj7wa4mxmw
  • Location: West US 2
  • Container App: src

Database

  • Type: Azure Database for PostgreSQL Flexible Server
  • Name: psql-uzsgj7wa4mxmw
  • Location: West US 2

Container Registry

  • Name: cruzsgj7wa4mxmw.azurecr.io
  • Image: barodybroject/src-barodybroject-test:azd-deploy-1761972712

Monitoring & Logging

  • Application Insights: appi-uzsgj7wa4mxmw
  • Log Analytics: log-uzsgj7wa4mxmw
  • Dashboard: dash-uzsgj7wa4mxmw

Security

  • Key Vault: kv-uzsgj7wa4mxmw
  • Endpoint: https://kv-uzsgj7wa4mxmw.vault.azure.net/

🔍 Testing Your Deployment

1. Access the Application

# Open in browser
open https://src.icysea-c22e25eb.westus2.azurecontainerapps.io/

# Or test with curl
curl https://src.icysea-c22e25eb.westus2.azurecontainerapps.io/

2. View Application Logs

# Stream logs in real-time
az containerapp logs show \
  --name src \
  --resource-group rg-barodybroject-test \
  --follow

# Or use azd
azd monitor --logs

3. Check Application Status

# Get container app details
az containerapp show \
  --name src \
  --resource-group rg-barodybroject-test \
  --output table

# Check replica count and health
az containerapp revision list \
  --name src \
  --resource-group rg-barodybroject-test \
  --output table

💰 Cost Breakdown (Estimated Monthly)

Resource SKU/Tier Estimated Cost
Container Apps Environment Consumption $0 (+ usage)
Container App (running time) 0.25 vCPU, 0.5 GB ~$10-15/month
PostgreSQL Flexible Server Burstable B1ms ~$12/month
Container Registry Basic ~$5/month
Application Insights Pay-as-you-go ~$2-5/month
Key Vault Standard ~$0.03/month
Total Estimated ~$27-37/month

Note: Container Apps on Consumption plan charges for: - Active CPU time (per vCPU-second) - Memory usage (per GB-second) - HTTP requests (after free tier)

You can reduce costs by: - Scaling to 0 replicas when not in use - Using reserved capacity for predictable workloads - Optimizing container size and startup time


🚀 Managing Your Deployment

Update Application Code

# Make code changes, then redeploy
azd deploy

# Or update everything (infrastructure + code)
azd up

Scale the Application

# Scale manually
az containerapp update \
  --name src \
  --resource-group rg-barodybroject-test \
  --min-replicas 1 \
  --max-replicas 5

# Configure auto-scaling rules
az containerapp update \
  --name src \
  --resource-group rg-barodybroject-test \
  --scale-rule-name http-scaling \
  --scale-rule-type http \
  --scale-rule-http-concurrency 10

Environment Variables

# Update environment variable
az containerapp update \
  --name src \
  --resource-group rg-barodybroject-test \
  --set-env-vars "NEW_VAR=value"

# List current environment variables
az containerapp show \
  --name src \
  --resource-group rg-barodybroject-test \
  --query "properties.template.containers[0].env"

🔐 Security Considerations

Secrets Management

All sensitive data (database password, API keys) are stored in: - Azure Key Vault: kv-uzsgj7wa4mxmw - Container Apps automatically loads secrets from Key Vault

Database Access

  • PostgreSQL is accessible only from Azure services by default
  • Connection string includes SSL enforcement
  • Password stored in Key Vault

Container Registry

  • Private registry with managed identity authentication
  • Images are scanned for vulnerabilities
  • Only authenticated services can pull images

📈 Monitoring & Troubleshooting

Application Insights

View metrics in Azure Portal:

https://portal.azure.com -> Application Insights -> appi-uzsgj7wa4mxmw

Key metrics to monitor: - Request rate and response times - Failed requests (4xx, 5xx errors) - Container resource usage (CPU, memory) - Database connection pool status

Common Issues

Issue: Application returns 502 Bad Gateway Solution:

# Check container logs
az containerapp logs show --name src --resource-group rg-barodybroject-test --follow

# Verify container is running
az containerapp replica list --name src --resource-group rg-barodybroject-test

Issue: Database connection errors Solution:

# Check PostgreSQL firewall rules
az postgres flexible-server firewall-rule list \
  --name psql-uzsgj7wa4mxmw \
  --resource-group rg-barodybroject-test

# Test database connectivity from container
az containerapp exec \
  --name src \
  --resource-group rg-barodybroject-test \
  --command "/bin/bash"
# Then: psql -h psql-uzsgj7wa4mxmw.postgres.database.azure.com -U adminuser -d barodydb

Issue: High costs Solution:

# Scale down to 0 when not in use
az containerapp update \
  --name src \
  --resource-group rg-barodybroject-test \
  --min-replicas 0

# Or delete non-essential resources
az monitor app-insights component delete \
  --app appi-uzsgj7wa4mxmw \
  --resource-group rg-barodybroject-test


🔄 CI/CD Integration

GitHub Actions

Create .github/workflows/azure-deploy.yml:

name: Deploy to Azure Container Apps

on:
  push:
    branches: [main]
  workflow_dispatch:

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Azure Login
        uses: azure/login@v1
        with:
          creds: ${{ secrets.AZURE_CREDENTIALS }}

      - name: Deploy with azd
        run: |
          azd login --client-id ${{ secrets.AZURE_CLIENT_ID }} \
                    --client-secret ${{ secrets.AZURE_CLIENT_SECRET }} \
                    --tenant-id ${{ secrets.AZURE_TENANT_ID }}
          azd deploy --no-prompt

📞 Support & Resources

Azure Portal

  • Resource Group: https://portal.azure.com/#@/resource/subscriptions/43f36802-f8fd-4120-893b-2bd2213889db/resourceGroups/rg-barodybroject-test
  • Cost Management: https://portal.azure.com/#view/Microsoft_Azure_CostManagement/Menu/~/overview

Documentation

  • Container Apps: https://learn.microsoft.com/azure/container-apps/
  • PostgreSQL Flexible Server: https://learn.microsoft.com/azure/postgresql/flexible-server/
  • Application Insights: https://learn.microsoft.com/azure/azure-monitor/app/app-insights-overview

Azure CLI Commands

# List all resources
az resource list --resource-group rg-barodybroject-test --output table

# Get cost breakdown
az consumption usage list \
  --start-date $(date -v-30d +%Y-%m-%d) \
  --end-date $(date +%Y-%m-%d) \
  --query "[?contains(instanceName, 'barodybroject')]"

# Delete everything
az group delete --name rg-barodybroject-test --yes --no-wait

✅ Deployment Success Checklist

  • Infrastructure provisioned successfully
  • Container image built and pushed to ACR
  • Container App deployed and running
  • PostgreSQL database created and configured
  • Application Insights configured for monitoring
  • Key Vault created for secrets management
  • Application accessible at public endpoint
  • Logging and monitoring enabled

🎯 Next Steps

  1. Test the Application
  2. Visit https://src.icysea-c22e25eb.westus2.azurecontainerapps.io/
  3. Verify database connectivity
  4. Test key functionality

  5. Configure Custom Domain (optional)

    az containerapp hostname add \
      --name src \
      --resource-group rg-barodybroject-test \
      --hostname yourdomain.com
    

  6. Set Up CI/CD

  7. Configure GitHub Actions for automated deployments
  8. Add staging environment for testing

  9. Monitor Costs

  10. Set up budget alerts in Azure Portal
  11. Review cost analysis weekly
  12. Optimize resource usage based on metrics

  13. Enhance Security

  14. Enable managed identity for all services
  15. Implement API authentication
  16. Review and harden firewall rules

Deployment completed successfully! 🚀

Your application is now live on Azure Container Apps with full monitoring, security, and scalability features.