From ec4b92e679fdd4a85b58355e9c42af0ad5050b1f Mon Sep 17 00:00:00 2001 From: Leonard Jonathan Oh Date: Thu, 29 Sep 2022 01:26:40 +0000 Subject: [PATCH] Enhancement: Mount config.php as read-only --- README.md | 12 +++++++-- config/ASP/config.php | 54 ++++++++++++++++++++++++++++++++++++++ docker-compose.example.yml | 15 ++++++----- docker-compose.yml | 10 ++++--- 4 files changed, 78 insertions(+), 13 deletions(-) create mode 100644 config/ASP/config.php diff --git a/README.md b/README.md index e6bbd452..0d992bb8 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,11 @@ The new BF2Statistics 3.0 ASP, currently in public Beta. The GameSpy server to m See [docker-compose.example.yml](docker-compose.example.yml) example showing how to deploy BF2Statistics using `docker-compose`. +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. + ## Development Requires `docker` and `docker-compose`. @@ -17,8 +22,8 @@ Requires `docker` and `docker-compose`. ```sh # Start docker-compose up --build -# Dashboard now available at http://localhost/ASP, username: admin, password admin. See ./src/ASP/system/config/config.php configuration file -# phpmyadmin available at http://localhost:8080. Username: root, password: ascent. See ./src/ASP/system/config/config.php configuration file +# Dashboard now available at http://localhost/ASP, username: admin, password admin. See ./config/ASP/config.php config file +# phpmyadmin available at http://localhost:8080. Username: root, password: ascent. See ./config/ASP/config.php config file # Fix php xdebug not reaching host IDE iptables -A INPUT -i br+ -j ACCEPT @@ -26,6 +31,9 @@ iptables -A INPUT -i br+ -j ACCEPT # Test routes docker-compose -f docker-compose.test.yml up +# Dump the DB +docker exec -it mysqldump -uroot -pascent bf2stats | gzip > bf2stats.sql.gz + # Stop docker-compose down diff --git a/config/ASP/config.php b/config/ASP/config.php new file mode 100644 index 00000000..4fa69033 --- /dev/null +++ b/config/ASP/config.php @@ -0,0 +1,54 @@ +