Developer Guide
Set up your local environment and start contributing.
Quick Start
- Clone the repository
- Copy and configure environment variables
- Start the Docker containers
- Access the local site
git clone https://bitbucket.org/wilsonify/renewed-renaissance-woocommerce.git
cd renewed-renaissance-woocommerce/deploy/01_dev
cp .env.example .env # Edit with your credentials
docker compose up -d
Your local site will be available at http://localhost:10080
Architecture Overview
┌─────────────────────────────────────────────────────────────────┐
│ Cloudflare │
│ dev.renewed- stage.renewed- www.renewed- │
│ renaissance.com renaissance.com renaissance.com │
└───────┬─────────────────┬─────────────────┬─────────────────────┘
│ │ │
▼ ▼ ▼
┌─────────┐ ┌─────────┐ ┌─────────┐
│ 01_dev │ │ 02_stage│ │ 03_prod │
│ :10080 │ │ :9080 │ │ :8080 │
└─────────┘ └─────────┘ └─────────┘
Environments
| Environment | URL | Port | Purpose |
|---|---|---|---|
| Development | dev.renewed-renaissance.com | 10080 | Live editing with volume mounts |
| Staging | stage.renewed-renaissance.com | 9080 | Pre-production testing |
| Production | www.renewed-renaissance.com | 8080 | Live site with Cloudflare tunnel |
Services
| Service | Description |
|---|---|
| WordPress | PHP 8.3 + Apache + WordPress 6.8 + WooCommerce |
| MariaDB | Database server (11.5.2) |
| Redis | Object cache for performance |
| MailDev | Local email testing at localhost:31080 |
| SonarQube | Code quality analysis (dev only) |
| Cloudflared | Cloudflare tunnel (prod only) |
Local Development
Directory Structure
├── src/wordpress/ # Docker image source
│ ├── Dockerfile
│ ├── wordpress/ # WordPress installation
│ ├── apache2/ # Apache config
│ └── php/ # PHP config
├── deploy/
│ ├── 01_dev/ # Dev environment (volume mounts)
│ ├── 02_stage/ # Staging (built image)
│ └── 03_prod/ # Production (built image + tunnel)
├── 01_infrastructure/ # Vagrant/VM provisioning
└── 02_configuration/ # Ansible playbooks
Volume Mounts (Development)
Development uses volume mounts for live code editing:
./wordpress:/var/www/html– WordPress files./apache2/apache2.conf:/etc/apache2/apache2.conf./php/php.ini:/usr/local/etc/php/php.ini
Changes take effect immediately without rebuilding.
Environment Variables
# Database
MYSQL_ROOT_PASSWORD=your_root_password
MYSQL_DATABASE=wordpress
MYSQL_USER=wp_user
MYSQL_PASSWORD=wp_password
# WordPress
WORDPRESS_DB_HOST=db
WORDPRESS_DB_NAME=wordpress
WORDPRESS_DB_USER=wp_user
WORDPRESS_DB_PASSWORD=wp_password
# Cloudflare (production only)
CF_TUNNEL_TOKEN=your_tunnel_token
Common Commands
# Start all services
docker compose up -d
# View logs
docker compose logs -f wordpress
# Access WordPress CLI
docker compose exec wordpress wp --info
# Rebuild after Dockerfile changes
docker compose build wordpress
docker compose up -d
# Stop all services
docker compose down
Testing Email
All emails are captured by MailDev. View them at http://localhost:31080
See Email & MailDev documentation for details.
Building Images
# Build for staging
cd deploy/02_stage
docker compose build wordpress
# Build directly with tag
docker build -t ghcr.io/wilsonify/renewed-renaissance-woocommerce:1.0.0 \
-f src/wordpress/Dockerfile src/wordpress/
Contributing
Workflow
- Create a feature branch from
main - Make your changes in
deploy/01_dev - Test thoroughly in the dev environment
- Run code quality checks (SonarQube)
- Submit a pull request
Code Style
- Follow WordPress Coding Standards for PHP
- Use meaningful commit messages
- Keep PRs focused on a single change
Testing
- Test in development environment first
- Verify email flows via MailDev
- Check WP-CLI doctor checks pass
- Run SonarQube analysis:
http://localhost:9000
Troubleshooting
Container won't start
# Check logs
docker compose logs wordpress
# Verify .env file exists and has correct values
cat .env
Database connection errors
# Ensure db container is running
docker compose ps db
# Check database logs
docker compose logs db
Permission issues
# Fix WordPress file permissions
docker compose exec wordpress chown -R www-data:www-data /var/www/html