ComposePress/README.md

123 lines
2.6 KiB
Markdown

# 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:
```bash
COMPOSE_PROJECT_NAME=test
WORDPRESS_VERSION=6-fpm
```
### Database Host Configuration
To avoid conflicts, use the following format for the database host:
```bash
WORDPRESS_DB_HOST=${COMPOSE_PROJECT_NAME}-database-1:3306
```
## Environment Variables
### Docker Images
```bash
# Web and Database Images
IMAGE_WEB=test_web_staging
IMAGE_DATABASE=mariadb:11.5
```
### Let's Encrypt Configuration
```bash
VIRTUAL_HOST=test.test.org
LETSENCRYPT_HOST=test.test.org
LETSENCRYPT_EMAIL=test@test.com
LETSENCRYPT_TEST=true
```
### Database Configuration
```bash
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
```bash
# 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:
```bash
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)
```
2. Update WordPress version:
- Modify version in `Dockerfile.wordpress_fpm`
- Update `IMAGE_WEB` in `.env` file
3. Build and test the new environment:
```bash
# 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
```
4. Migrate content:
```bash
# 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/
```
5. Optional: Update database if needed:
```bash
(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](LICENSE)