Add docker examples for restore services up
This commit is contained in:
@@ -0,0 +1,110 @@
|
||||
# Piwigo Docker Setup
|
||||
|
||||
Docker environment for running Piwigo restored from TrueNAS backup.
|
||||
|
||||
## Quick Start
|
||||
|
||||
```bash
|
||||
# 1. Copy environment template
|
||||
cp .env.example .env
|
||||
|
||||
# 2. Edit .env with your database passwords
|
||||
nano .env
|
||||
|
||||
# 3. Place your backup data in ./piwigo-data/
|
||||
# Structure should be:
|
||||
# piwigo-data/
|
||||
# ├── upload/ # From backup uploads/
|
||||
# ├── local/config/ # From backup config/
|
||||
# └── galleries/ # From backup galleries/ (if any)
|
||||
|
||||
# 4. Start containers
|
||||
docker-compose up -d
|
||||
|
||||
# 5. Access Piwigo at http://localhost:8080
|
||||
```
|
||||
|
||||
## Directory Structure
|
||||
|
||||
```
|
||||
ep-piwigo-docker/
|
||||
├── Dockerfile # Custom image with mariadb-client, fixed PHP settings
|
||||
├── docker-entrypoint.sh # Handles permissions, DB wait
|
||||
├── docker-compose.yml # MariaDB + Piwigo services
|
||||
├── .env.example # Environment template
|
||||
└── piwigo-data/ # Your data (create this)
|
||||
├── upload/
|
||||
├── local/config/
|
||||
└── galleries/
|
||||
```
|
||||
|
||||
## Restore from Backup
|
||||
|
||||
After running the restore script on the Docker host, your data will be in `../piwigo-data/`. You can either:
|
||||
|
||||
**Option A: Use this directory directly**
|
||||
```bash
|
||||
# Symlink or copy to ./piwigo-data
|
||||
ln -s ../piwigo-data ./piwigo-data
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
**Option B: Copy to this directory**
|
||||
```bash
|
||||
cp -r ../piwigo-data/* ./piwigo-data/
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
## Environment Variables
|
||||
|
||||
| Variable | Description | Default |
|
||||
|----------|-------------|---------|
|
||||
| `DB_ROOT_PASS` | MariaDB root password | **required** |
|
||||
| `DB_NAME` | Database name | `piwigo` |
|
||||
| `DB_USER` | Database user | `piwigo` |
|
||||
| `DB_PASS` | Database user password | **required** |
|
||||
| `PIWIGO_DATA_DIR` | Host data directory | `./piwigo-data` |
|
||||
| `PIWIGO_PORT` | Host port for web UI | `8080` |
|
||||
|
||||
## Custom Entrypoint Features
|
||||
|
||||
The custom `docker-entrypoint.sh`:
|
||||
- Fixes permissions on upload/, config/, galleries/ directories
|
||||
- Waits for database to be ready before starting Apache
|
||||
- Extracts DB config from existing config.inc.php if present
|
||||
|
||||
## Database
|
||||
|
||||
Uses MariaDB 10.11. Data persisted in Docker volume `db-data`.
|
||||
|
||||
## Health Checks
|
||||
|
||||
Both services have health checks:
|
||||
- MariaDB: `mysqladmin ping`
|
||||
- Piwigo: Depends on healthy DB
|
||||
|
||||
## Logs
|
||||
|
||||
```bash
|
||||
# View Piwigo logs
|
||||
docker-compose logs -f piwigo
|
||||
|
||||
# View DB logs
|
||||
docker-compose logs -f db
|
||||
```
|
||||
|
||||
## Stopping
|
||||
|
||||
```bash
|
||||
docker-compose down
|
||||
```
|
||||
|
||||
## Backup (Docker-side)
|
||||
|
||||
```bash
|
||||
# Backup database
|
||||
docker-compose exec db mariadb-dump -u root -p"$DB_ROOT_PASS" piwigo > backup_$(date +%Y%m%d).sql
|
||||
|
||||
# Backup files
|
||||
tar -czf piwigo_files_$(date +%Y%m%d).tar.gz piwigo-data/
|
||||
```
|
||||
Reference in New Issue
Block a user