Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: Add docs about not needing a volume for DB backups #9

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ See [docker-compose.example.yml](docker-compose.example.yml) example showing how
Notes:
- Mount the [`config.php`](./config/ASP/config.php) as read-only for the `php` service so that `ASP` doesn't mutate the config file. The `ASP`'s `System > Edit Configuration` should no longer be used, since we are managing the configuration file. `System > System Tests` will fail for `config.php` since `ASP` expects the file to be writeable, but this may be ignored.
- Seed the `db` service with `schema.sql` and `data.sql` so that the database is populated on the first run. The `ASP`'s `System > System Installation` doesn't need to be used.
- Optional: For better security, define `MARIADB_USER` and `MARIADB_PASSWORD` for the `db` service, so that a regular `mariadb` user is created on the first run, instead of using the `root` user. Note that this hasn't been tested, and might break some modules in the `ASP` dashboard.
- [Backup the DB](#development) using `mysqldump` instead of the ASP. `System > Backup Stats Database` will not be allowed since the DB is on remote host. This means there is no need for provisioning a `backups-volume` volume.
- Optional: For better security, define `MARIADB_USER` and `MARIADB_PASSWORD` for the `db` service, so that a regular `mariadb` user is created on the first run, instead of using the `root` user. Note that this hasn't been tested, but it seems to work nicely, although it might break some modules in the `ASP` dashboard if they ruly on `root` privileges (any?).

## Development

Expand All @@ -32,12 +33,16 @@ iptables -A INPUT -i br+ -j ACCEPT
docker-compose -f docker-compose.test.yml up

# Dump the DB
docker exec -it <db_container> mysqldump -uroot -pascent bf2stats | gzip > bf2stats.sql.gz
docker exec $( docker-compose ps | grep db | awk '{print $1}' ) mysqldump -uroot -pascent bf2stats | gzip > bf2stats.sql.gz

# Restore the DB
zcat bf2stats.sql.gz | docker exec -i $( docker-compose ps | grep db | awk '{print $1}' ) mysql -uroot -pascent bf2stats

# Stop
docker-compose down

# Cleanup
docker-compose down
docker volume rm asp_backups-volume
docker volume rm asp_cache-volume
docker volume rm asp_logs-volume
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ services:
init-container:
image: alpine:latest
volumes:
- backups-volume:/src/ASP/system/backups
- backups-volume:/src/ASP/system/backups # This volume is effectively unused since ASP doesn't allow DB backups for a remote DB, but mount it anyway to avoid errors.
- cache-volume:/src/ASP/system/cache
- logs-volume:/src/ASP/system/logs
- snapshots-volume:/src/ASP/system/snapshots
Expand Down Expand Up @@ -57,7 +57,7 @@ services:
volumes:
- ./config/ASP/config.php:/src/ASP/system/config/config.php:ro # Customize as needed.
- ./config/php/conf.d/php.ini:/usr/local/etc/php/conf.d/php.ini:ro # Customize as needed
- backups-volume:/src/ASP/system/backups
- backups-volume:/src/ASP/system/backups # This volume is effectively unused since ASP doesn't allow DB backups for a remote DB, but mount it anyway to avoid errors.
- cache-volume:/src/ASP/system/cache
- logs-volume:/src/ASP/system/logs
- snapshots-volume:/src/ASP/system/snapshots
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ services:
image: alpine:latest
volumes:
- ./src:/src
- backups-volume:/src/ASP/system/backups
- backups-volume:/src/ASP/system/backups # This volume is effectively unused since ASP doesn't allow DB backups for a remote DB, but mount it anyway to avoid errors.
- cache-volume:/src/ASP/system/cache
- logs-volume:/src/ASP/system/logs
- snapshots-volume:/src/ASP/system/snapshots
Expand Down Expand Up @@ -63,7 +63,7 @@ services:
- ./src:/src
- ./config/ASP/config.php:/src/ASP/system/config/config.php:ro
- ./config/php/conf.d/php.ini:/usr/local/etc/php/conf.d/php.ini:ro
- backups-volume:/src/ASP/system/backups
- backups-volume:/src/ASP/system/backups # This volume is effectively unused since ASP doesn't allow DB backups for a remote DB, but mount it anyway to avoid errors.
- cache-volume:/src/ASP/system/cache
- logs-volume:/src/ASP/system/logs
- snapshots-volume:/src/ASP/system/snapshots
Expand Down