Developer Guide

Set up your local environment and start contributing.

Quick Start

  1. Clone the repository
  2. Copy and configure environment variables
  3. Start the Docker containers
  4. 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

EnvironmentURLPortPurpose
Developmentdev.renewed-renaissance.com10080Live editing with volume mounts
Stagingstage.renewed-renaissance.com9080Pre-production testing
Productionwww.renewed-renaissance.com8080Live site with Cloudflare tunnel

Services

ServiceDescription
WordPressPHP 8.3 + Apache + WordPress 6.8 + WooCommerce
MariaDBDatabase server (11.5.2)
RedisObject cache for performance
MailDevLocal email testing at localhost:31080
SonarQubeCode quality analysis (dev only)
CloudflaredCloudflare 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:

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

  1. Create a feature branch from main
  2. Make your changes in deploy/01_dev
  3. Test thoroughly in the dev environment
  4. Run code quality checks (SonarQube)
  5. Submit a pull request

Code Style

Testing

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

Resources