Backup script
This commit is contained in:
@@ -77,9 +77,38 @@ docker-compose up --build
|
||||
|
||||
## Database
|
||||
|
||||
SQLite database is stored as `drugs.db` in the project root. It's a single file that persists between container restarts. You can:
|
||||
- Backup by copying the file
|
||||
- Share with team members
|
||||
SQLite database is stored as `./data/drugs.db`. It's a single file that persists between container restarts.
|
||||
|
||||
### Backups
|
||||
|
||||
The Docker Compose stack includes a `backup` sidecar that creates a SQLite-safe compressed backup every hour and keeps backups for 7 days.
|
||||
|
||||
Backups are stored in:
|
||||
|
||||
```bash
|
||||
./data/backups/
|
||||
```
|
||||
|
||||
The latest backup is also copied to:
|
||||
|
||||
```bash
|
||||
./data/backups/latest.db.gz
|
||||
```
|
||||
|
||||
To restore a backup:
|
||||
|
||||
```bash
|
||||
docker compose stop backend backup
|
||||
gunzip -c data/backups/drugs-YYYY-MM-DDTHH-MM-SSZ.db.gz > data/drugs.db
|
||||
docker compose up -d backend backup
|
||||
```
|
||||
|
||||
Backup interval and retention can be changed with:
|
||||
|
||||
```bash
|
||||
BACKUP_INTERVAL_SECONDS=3600
|
||||
BACKUP_RETENTION_DAYS=7
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
|
||||
Reference in New Issue
Block a user