Stack Management — {{PROJECT_NAME}}
When to Use
- Starting, stopping, or restarting the Docker stack
- Rebuilding containers after Dockerfile or compose changes
- Creating or restoring database backups
- Testing service connectivity
- Clearing Redis cache
- Troubleshooting container issues
- Monitoring logs for errors
Stack Services
| Service | Container | Health Check | Port |
|---|---|---|---|
| MySQL {{MYSQL_VERSION}} | {{DOCKER_PREFIX}}_mysql | mysqladmin ping |
127.0.0.1:{{MYSQL_PORT}} |
| Redis 7 | {{DOCKER_PREFIX}}_redis | redis-cli ping |
internal |
| WordPress {{WP_VERSION}} | {{DOCKER_PREFIX}}_wordpress | curl wp-login.php |
via Traefik |
| phpMyAdmin | {{DOCKER_PREFIX}}_phpmyadmin | curl / |
via Traefik |
Procedures
Start Stack
make up
make test # Verify all healthy
Safe Deploy (with backup)
make backup # Always backup first
make build # Rebuild without cache
make test # Verify connections
make logs # Check for errors
Troubleshoot Service
- Check status:
make status - Check logs:
make logsormake logs-wp/make logs-mysql - Enter container:
make shell-wpormake shell-mysql - Test connections:
make test - If needed, restart:
make restart
Database Backup & Restore
- Backup:
make backup→ Creates/backups/{MYSQL_DATABASE}_YYYYMMDD_HHMMSS.sql.gz - Restore:
bash scripts/restore-database.sh /backups/FILENAME.sql.gz - Rotation: Keeps last 10 backups automatically
Clear Cache
bash scripts/clear-cache.sh # Flushes Redis cache
Emergency Recovery
make backup(if MySQL is accessible)make down- Check
docker-compose.ymland.envfor issues make buildmake test- If DB corrupt:
bash scripts/restore-database.sh /backups/LATEST.sql.gz
Reference Files
Source: thormetalwork/wp-stack-template — distributed by TomeVault.