2.6 KiB
2.6 KiB
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, which should be defined in an .env
file:
COMPOSE_PROJECT_NAME=test
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
- 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)
-
Update WordPress version:
- Modify version in
Dockerfile.wordpress_fpm
- Update
IMAGE_WEB
in.env
file
- Modify version in
-
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
- 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/
- 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