2025-06-02 00:50:27 +00:00
2025-06-02 00:50:27 +00:00
2025-06-02 00:50:27 +00:00
2025-06-01 20:47:21 -04:00
2025-06-02 00:50:27 +00:00
2025-06-02 00:50:27 +00:00

ComposePress

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.

Project Configuration

Project Name

This project requires a project name and wordpress version, which should be defined in an .env file:

COMPOSE_PROJECT_NAME=test
WORDPRESS_VERSION=6-fpm

Database Host Configuration

To avoid conflicts, use the following format for the database host:

WORDPRESS_DB_HOST=${COMPOSE_PROJECT_NAME}-database-1:3306

Environment Variables

Docker Images

# Web and 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=${COMPOSE_PROJECT_NAME}-database-1:3306
WORDPRESS_DB_PASSWORD=wordpress
MYSQL_ROOT_PASSWORD=wordpress
MYSQL_DATABASE=wordpress
MYSQL_USER=wordpress
MYSQL_PASSWORD=wordpress

Volume Configuration

# External Volumes
DB_VOLUME=test_db_staging
CONTENT_VOLUME=test_content_staging

# Recreated Volumes
HTML_VOLUME=test_html_staging

Usage

Upgrade Process

  1. Stop the current containers and remove volumes:
docker compose down -v

# Optional Steps

# Clean volumes
grep -E 'DB_VOLUME|CONTENT_VOLUME' .env | cut -d '=' -f2 | xargs -I {} sh -c 'docker volume rm {} 2>/dev/null; docker volume create {}'

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

  1. Update WordPress version:

    • Modify version in Dockerfile.wordpress_fpm
    • Update IMAGE_WEB in .env file
  2. Build and test the new environment:

# Build initial configuration
docker compose -f docker-compose.first.yml build 

# Test the build
docker compose -f docker-compose.first.yml up -d

# Stop test environment
docker compose -f docker-compose.first.yml down

# Start production environment
docker compose up -d
  1. Migrate content:
# In the wordpress service, copy new content to production
cp -a wp-content-new/* wp-content/

# Verify permissions on wp-content directory
chmod -R [appropriate-permissions] wp-content/
  1. Optional: Update database if needed:
(In 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

@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