ComposePress

ComposePress is a Docker-based toolkit designed to streamline WordPress upgrades using official images. It provides pre-configured Docker Compose files, Dockerfiles, and standardized procedures to make WordPress maintenance more predictable and reliable.


🚀 Project Configuration

Project Name & WordPress Version

Define a unique project name and WordPress version in the .env file:

COMPOSE_PROJECT_NAME=test
WORDPRESS_VERSION=6-fpm

🛠 Environment Variables

Docker Images

# Web & Database Images
IMAGE_WEB=test_web_staging
IMAGE_DATABASE=mariadb:11.5

Let's Encrypt Configuration

VIRTUAL_HOST=test.test.org
LETSENCRYPT_HOST=test.test.org
LETSENCRYPT_EMAIL=test@test.com
LETSENCRYPT_TEST=true

Database Configuration

WORDPRESS_DB_HOST=database_${COMPOSE_PROJECT_NAME}:3306
WORDPRESS_DB_PASSWORD=wordpress
MYSQL_ROOT_PASSWORD=wordpress
MYSQL_DATABASE=wordpress
MYSQL_USER=wordpress
MYSQL_PASSWORD=wordpress

Volume Configuration

# External Volumes (Persist Data)
DB_VOLUME=test_db_staging
CONTENT_VOLUME=test_content_staging

# Recreated Volumes (Rebuild On Setup)
HTML_VOLUME=test_html_staging

📂 Configuration Files

Two important Nginx configuration files are available in the project directory:

./default.conf  # Automatically generated each time the script runs
./nginx.conf    # Manually customizable configuration

⚠️ Warning: default.conf is regenerated every time generate-compose-nginx.sh runs.
Make a backup before modifying if you plan to change the project name.


🚀 Usage

Initialize a Project with a Unique COMPOSE_PROJECT_NAME

Run the following script to generate the required files:

./generate-compose-nginx.sh

🔄 Upgrade Process

1 Stop Containers & Clean Up

docker compose down -v

# Optional: Remove external database & content volume (DANGER: Only do this if you have backups)
grep -E 'DB_VOLUME|CONTENT_VOLUME' .env | cut -d '=' -f2 | xargs -I {} sh -c 'docker volume rm {} 2>/dev/null; docker volume create {}'

# Optional: Remove WordPress Image
docker rmi $(grep IMAGE_WEB .env | cut -d '=' -f2)

2 Update WordPress Version

Modify the version in .env:

WORDPRESS_VERSION=7-fpm

3 Build & Deploy

# Build custom WordPress image
docker compose -f docker-compose.first.yml build 

# Install or upgrade WordPress volume from custom image
docker compose -f docker-compose.first.yml up -d

# Stop WordPress container (but keep HTML volume)
docker compose -f docker-compose.first.yml down

# Start production environment
docker compose up -d

4 Migrate Content (Themes, Plugins)

# Copy new content to production
cp -a wp-content-new/* wp-content/

# Verify permissions on the wp-content directory
chmod -R [appropriate-permissions] wp-content/

5 Optional: Database Updates

# Inside the database container
apt-get update && \
    apt-get install -y mariadb-client && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

# From the host
./update-db

📌 Requirements

  • Docker

🤝 Contributing

For contributions, reach out to @bike.


📜 License

GNU GENERAL PUBLIC LICENSE

Description
A Docker-based toolkit that streamlines WordPress upgrades using official images. Provides pre-configured docker-compose files, Dockerfiles, and standardized procedures to make WordPress maintenance more predictable and reliable.
Readme GPL-3.0 44 KiB