A complete, production-ready WordPress deployment on Azure Container Apps with automated updates, monitoring, and backup capabilities.
- Azure Container Apps: Cost-effective hosting without jump host VMs
- Automated Updates: WordPress core, plugins, and themes via GitHub Actions
- High Availability: Auto-scaling and load balancing
- Security: Azure Key Vault integration, SSL/TLS, and security best practices
- Monitoring: Application Insights, Log Analytics, and custom dashboards
- Backup & Recovery: Automated backups with cross-region replication
- Performance: Redis caching and optimized PHP configuration
- Azure subscription with appropriate permissions
- GitHub repository with Actions enabled
- Azure CLI installed and configured
- Docker (for local testing)
- PowerShell 5.0+ with required Azure modules
Before running any deployment scripts, install the required Azure PowerShell modules:
# Automated installation (recommended)
.\Install-RequiredModules.ps1
# Manual installation
Install-Module -Name Az.Accounts, Az.Resources, Az.ContainerRegistry, Az.KeyVault, Az.Storage, Az.ContainerInstance -Force -AllowClobber -Scope CurrentUserBefore running any deployment scripts, authenticate with Azure:
# Automated authentication (recommended)
.\Connect-Azure.ps1
# Manual authentication
Connect-AzAccount
# With specific subscription
.\Connect-Azure.ps1 -SubscriptionId "your-subscription-id"βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β GitHub β β Azure β β Monitoring β
β Actions βββββΆβ Container Apps βββββΆβ & Alerts β
β (CI/CD) β β (WordPress) β β β
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β
βΌ
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β Azure Key β β MySQL β β Azure β
β Vault ββββββ Flexible β β Storage β
β (Secrets) β β Server β β (Files) β
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
git clone <your-repo-url>
cd wordpress-deployment# Complete deployment with Key Vault integration (handles everything automatically)
.\deploy-with-keyvault.ps1 -ResourceGroupName "rg-wordpress-prod" -WpAdminUser "admin" -WpAdminPassword (ConvertTo-SecureString "SecurePass123!" -AsPlainText -Force) -WpAdminEmail "admin@yourdomain.com" -DbPassword (ConvertTo-SecureString "SecureDBPass123!" -AsPlainText -Force) -DeployMonitoring -DeployBackup# Deploy with plain text passwords (NOT RECOMMENDED for production)
.\deploy.ps1 -ResourceGroupName "rg-wordpress-prod" -WpAdminUser "admin" -WpAdminPassword (ConvertTo-SecureString "SecurePass123!" -AsPlainText -Force) -WpAdminEmail "admin@yourdomain.com" -DbPassword (ConvertTo-SecureString "SecureDBPass123!" -AsPlainText -Force) -DeployMonitoring -DeployBackup-
Set up GitHub Secrets:
AZURE_CREDENTIALS: Azure service principal credentialsAZURE_CONTAINER_REGISTRY: Container registry nameAZURE_RESOURCE_GROUP: Resource group nameCONTAINER_APP_NAME: Container app name
-
Create Azure Service Principal:
az ad sp create-for-rbac \ --name "github-actions-wordpress" \ --role contributor \ --scopes /subscriptions/{subscription-id}/resourceGroups/rg-wordpress-prod \ --sdk-auth -
Push to GitHub:
git add . git commit -m "Initial WordPress deployment" git push origin main
After deployment, your WordPress site will be available at the Container App URL provided in the deployment output.
wordpress-deployment/
βββ main.bicep # Main infrastructure template
βββ monitoring.bicep # Monitoring and alerting
βββ backup.bicep # Backup and disaster recovery
βββ parameters.json # Deployment parameters
βββ Dockerfile # WordPress container with wp-cli
βββ update-wordpress.sh # WordPress update script
βββ wp-config-extra.php # Additional WordPress configuration
βββ custom-php.ini # PHP configuration
βββ backup-script.ps1 # PowerShell backup script
βββ .github/
β βββ workflows/
β βββ deploy-wordpress.yml # Deployment workflow
β βββ update-wordpress.yml # Update workflow
βββ DEPLOYMENT_GUIDE.md # Detailed deployment guide
βββ README.md # This file
- Frequency: Every Sunday at 2 AM UTC
- Scope: WordPress core, plugins, and themes
- Method: wp-cli commands executed in container
- Go to GitHub Actions β "Update WordPress Core and Plugins"
- Click "Run workflow"
- Select update options and run
- Check for available updates
- Update WordPress core (if available)
- Update all plugins (if available)
- Update all themes (if available)
- Clear caches and optimize database
- Set proper file permissions
- Performance metrics
- Error tracking
- User analytics
- Custom dashboards
- Container logs
- Database performance
- Security events
- Custom queries
- High CPU/Memory usage
- Container health
- Response time
- Error rates
- Database connectivity
- Database: Daily MySQL backups
- Files: WordPress uploads and themes
- Retention: 30 days (configurable)
- Cross-region: West US backup location
# Trigger backup via GitHub Actions
# Or use Azure CLI:
az containerapp exec \
--name wordpress-prod \
--resource-group rg-wordpress-prod \
--command "/usr/local/bin/update-wordpress.sh"- Stop WordPress container
- Restore database from backup
- Restore files from backup
- Restart container
- Verify functionality
WORDPRESS_DB_HOST: Database hostWORDPRESS_DB_NAME: Database nameWORDPRESS_DB_USER: Database userWORDPRESS_DB_PASSWORD: Database password (from Key Vault)WORDPRESS_ADMIN_USER: WordPress admin userWORDPRESS_ADMIN_PASSWORD: WordPress admin password (from Key Vault)WORDPRESS_ADMIN_EMAIL: WordPress admin email
- PHP Settings:
custom-php.ini - WordPress Settings:
wp-config-extra.php - Update Script:
update-wordpress.sh
- Secure storage for passwords using SecureString parameters
- RBAC access control
- Audit logging
- No plain text passwords in deployment files
- Private endpoints (optional)
- Firewall rules
- SSL/TLS encryption
- Disable file editing
- Secure file permissions
- Regular security updates
- PowerShell scripts use SecureString for password parameters
- Passwords converted to plain text only when needed for deployment
- Immediate cleanup of plain text passwords from memory
- Key Vault integration for production deployments
- Consumption Plan: Pay per use
- Auto-scaling: Scale to zero when idle
- Resource limits: CPU and memory limits
- Burstable tier: Cost-effective for development
- Auto-scaling: Scale based on demand
- Backup retention: Configurable retention period
- Standard LRS: Cost-effective storage
- Lifecycle policies: Automatic cleanup
- Compression: Reduce storage costs
-
Container won't start
# Check container logs az containerapp logs show \ --name wordpress-prod \ --resource-group rg-wordpress-prod -
Database connection issues
# Test database connectivity az containerapp exec \ --name wordpress-prod \ --resource-group rg-wordpress-prod \ --command "wp db check --allow-root --path=/var/www/html"
-
Update failures
# Check update logs az containerapp exec \ --name wordpress-prod \ --resource-group rg-wordpress-prod \ --command "tail -50 /var/log/wordpress-updates.log"
# Check container status
az containerapp show \
--name wordpress-prod \
--resource-group rg-wordpress-prod
# Execute wp-cli commands
az containerapp exec \
--name wordpress-prod \
--resource-group rg-wordpress-prod \
--command "wp --info --allow-root --path=/var/www/html"
# Check WordPress version
az containerapp exec \
--name wordpress-prod \
--resource-group rg-wordpress-prod \
--command "wp core version --allow-root --path=/var/www/html"- Deployment Guide - Detailed deployment instructions
- Azure Container Apps Documentation
- WordPress Documentation
- GitHub Actions Documentation
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
For support and questions:
- Create an issue in the GitHub repository
- Check the troubleshooting section
- Review Azure documentation
- Contact the development team
This deployment automatically updates:
- WordPress core
- All plugins
- All themes
- PHP dependencies
- Security patches
Manual updates can be triggered via GitHub Actions or Azure CLI commands.
Note: This deployment is designed for production use with proper security, monitoring, and backup capabilities. Always test in a development environment first.