A production-ready, containerized WordPress application stack featuring automated SSL certificate management, database administration, and multi-environment deployment using Ansible.
Cloud-1 demonstrates Infrastructure as Code principles by combining Docker containerization with Ansible automation to deploy a complete WordPress stack. The project showcases modern DevOps practices including automated SSL certificate management, multi-environment deployment, and secure configuration management.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Internet β
βββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββ
β
βββββββΌββββββ
β Nginx β (Port 80/443)
β Reverse β SSL/TLS Termination
β Proxy β Let's Encrypt + Cloudflare
βββββββ¬ββββββ
β
βββββββββββββββΌββββββββββββββ
β β β
βββββββΌββββββ βββββββΌββββββ βββββββΌββββββ
βWordPress β βphpMyAdmin β β Certbot β
β (PHP) β β (Admin) β β (SSL) β
βββββββ¬ββββββ βββββββ¬ββββββ βββββββ¬ββββββ
β β β
βββββββββββββββΌββββββββββββββ
β
βββββββΌββββββ
β MariaDB β
β Database β
βββββββββββββ
- Python 3.9+
- SSH access to target servers (for production)
- Cloudflare account with API token (for production SSL)
- No SSH required for local testing
- Project runs directly on your current machine
- You have to create your own secrets file (vars/secrets_dev.yml) - see Configuration
- π³ Containerized Stack: WordPress, MariaDB, phpMyAdmin, Nginx with Alpine Linux base
- π Automated SSL: Let's Encrypt certificates with Cloudflare DNS challenge
- π Multi-Environment: Separate dev/prod configurations with Ansible
- π Security-First: Vault-encrypted secrets, access controls, security headers
- β‘ Zero-Downtime: Health checks and graceful service management
- π οΈ WordPress CLI Integration: Automated WordPress setup with
wp_config.sh - π§ Custom Content Management: Automated post creation with media upload support
- π Health Monitoring: Built-in health check endpoints for service monitoring
- π Advanced Security Config: phpMyAdmin with blowfish encryption and security hardening
- ποΈ Role-Based Deployment: Modular Ansible roles for
app_code,app_config,base_setup, anddocker_app - π Persistent Storage: Organized volume management for data persistence across services
- π Network Isolation: Custom Docker networking with service-to-service communication
- βοΈ Environment Templating: Dynamic
.envgeneration from Ansible Vault secrets via.env.j2
| Document | Purpose |
|---|---|
| π Ansible Documentation | Complete deployment automation guide |
| π³ Microservices Documentation | Detailed container architecture and services |
# Clone and setup
git clone https://github.com/almat101/cloud-1.git
cd cloud-1/ansible
# Source the script to enter in the python virtual environment(this install ansible and all its dependencies)
source ansible_venv.shCreate a Vault-encrypted file for development environment with the following variables. These will be securely transformed into a .env file during deployment:
# Reomove my vault vars
rm -rf vars/secrets_dev.yml
#Create the vault vars
ansible-vault create vars/secrets_dev.yml
Each environment file should contain these variables, customized for your specific deployment:
# Core settings
DOMAIN_NAME: "localhost"
CLOUDFLARE_API_TOKEN: "not_required_for_dev"
EMAIL: "dev@localhost"
USER: "ale"
# Database
MARIA_DB: "mariadb"
MARIA_DB_NAME: "wordpress_db"
MARIA_USER: "wp_user"
MARIA_PASSWORD: "dev_password123"
MARIA_ROOT_PASSWORD: "dev_root123"
# WordPress
WP_TITLE: "cloud1-dev"
WP_USER: "dev_user"
WP_PASSWORD: "dev_password"
WP_EMAIL: "dev@localhost"
WP_ROOT_USER: "dev_admin"
WP_ROOT_PASSWORD: "dev_admin_pass"
WP_ROOT_EMAIL: "admin@localhost"
WP_VERSION: 6.8.1
# Access Control (full access for development)
WP_ADMIN_ACCESSIBLE: "true"
PMA_ACCESSIBLE: "true"
# phpMyAdmin
BLOWFISH_SECRET: "dev_secret_32_chars_exactly_123"
# Optional
COMPOSE_BAKE: "true"cloud-1/
βββ README.md # Project overview (this file)
βββ ansible_doc.md # Ansible deployment guide
βββ Container_doc.md # Container architecture guide
βββ ansible/ # Deployment automation
β βββ inventory/hosts.ini # Dev/prod host definitions
β βββ playbooks/deploy.yml # Main deployment playbook
β βββ roles/ # Ansible automation roles
β βββ vars/ # Encrypted secrets (Vault)
βββ srcs/ # Container source code
βββ docker-compose.yml # Service orchestration
βββ requirements/ # Service configurations
βββ nginx/ # Web server & reverse proxy
βββ wordpress/ # WordPress application
βββ mariadb/ # Database server
βββ phpmyadmin/ # Database administration
βββ certbot/ # SSL certificate management
| Task | Command | Requirements |
|---|---|---|
| Deploy to dev | ansible-playbook playbooks/deploy.yml --limit dev --ask-vault-pass --ask-become-pass |
β Available now - Local machine only |
| Deploy to prod | ansible-playbook playbooks/deploy.yml --limit prod --ask-vault-pass |
π§ Requires: AWS instance + domain + DNS |
| Update code only | ansible-playbook playbooks/deploy.yml --limit prod --tags "app_code" |
For production updates |
| Update config | ansible-playbook playbooks/deploy.yml --limit dev --tags "app_config" |
Redeploy environment variables |
# Quick development deployment
cd cloud-1/ansible && source ansible_venv.sh
ansible-playbook playbooks/deploy.yml --limit dev --ask-vault-pass --ask-become-pass
# Check your local deployment
docker compose ps
curl -k https://localhost/health- SSL/TLS: Automated Let's Encrypt certificates with auto-renewal
- Access Control: IP-based restrictions for admin interfaces
- Secrets Management: Ansible Vault encryption for sensitive data
- Network Isolation: Docker network segmentation
- Security Headers: HSTS, secure ciphers, and CSRF protection
This project is licensed under the MIT License - see the LICENSE file for details.
- Containerization: Docker & Docker Compose
- Automation: Ansible with role-based architecture
- Web Server: Nginx (Alpine Linux)
- Application: WordPress with PHP 8.4
- Database: MariaDB (Alpine Linux)
- SSL: Let's Encrypt with Certbot + Cloudflare DNS
- Security: Ansible Vault for secrets management
π For detailed technical documentation, see Ansible Documentation and Container Documentation
Made with β€οΈ demonstrating modern DevOps practices with Infrastructure as Code