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

Fix: Mount config.php as writeable, and optionally mount armyAbbreviationMap.php, backendAwards.php, and Security.php config files #10

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
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ 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.
- Mount the [`config.php`](./config/ASP/config.php) with write permissions, or else `ASP` will throw an error. Use `System > Edit Configuration` as reference to customize the config file.
- Optional: Mount your customized [`armyAbbreviationMap.php`](./config/ASP/armyAbbreviationMap.php), [`backendAwards.php`](./config/ASP/backendAwards.php), and [`ranks.php`](./config/ASP/ranks.php) config files if you are using a customized mod. Unlike `config.php`, they don't need write permissions.
- Seed the `db` service with `schema.sql` and `data.sql` so that the database is populated on the first run. The `System > System Installation` doesn't need to be used.
- [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?).

Expand Down
204 changes: 204 additions & 0 deletions config/ASP/armyAbbreviationMap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,204 @@
<?php
/**
* BF2Statistics ASP Framework
*
* Author: Steven Wilson
* Copyright: Copyright (c) 2006-2019, BF2statistics.com
* License: GNU GPL v3
*
*/

/**
* Provides a mapping of army abbreviations from a parsed server responses to
* it's full name representation, and flag ID. Modded content will need to add
* abbreviations to display correctly.
*
* This mapping is used by the Server module and view method (/ASP/servers/view/[id])
*/
return array(
// Vanilla BF2
'us' => [
'flag' => 0,
'name' => 'United States Marine Corps'
],
'mec' => [
'flag' => 1,
'name' => 'Middle Eastern Coalition'
],
'ch' => [
'flag' => 2,
'name' => 'People\'s Liberation Army'
],

// Xpack 1 Special Forces
'seal' => [
'flag' => 0,
'name' => 'United States Navy Seals'
],
'mecsf' => [
'flag' => 1,
'name' => 'Middle Eastern Coalition Special Forces'
],
'sas' => [
'flag' => 4,
'name' => 'British Special Air Service'
],
'spetz' => [
'flag' => 5,
'name' => 'Russian Spetsnaz'
],
'chinsurgent' => [
'flag' => 7,
'name' => 'Rebels'
],
'meinsurgent' => [
'flag' => 8,
'name' => 'Insurgents'
],

// Booster Pack 1 EuroForce
'eu' => [
'flag' => 9,
'name' => 'European Union'
],

// POE2
'ger' => [
'flag' => 10,
'name' => 'German Forces'
],
'ukr' => [
'flag' => 12,
'name' => 'Ukrainian Forces'
],

// AIX
'un' => [
'flag' => 13,
'name' => 'United Nations'
],

// Hard Justice
'us2' => [
'flag' => 0,
'name' => 'United States Marine Corps'
],
'us3' => [
'flag' => 0,
'name' => 'United States Marine Corps'
],
'mec2' => [
'flag' => 1,
'name' => 'Middle Eastern Coalition'
],
'mec3' => [
'flag' => 1,
'name' => 'Middle Eastern Coalition'
],
'ch2' => [
'flag' => 2,
'name' => 'People\'s Liberation Army'
],
'ch3' => [
'flag' => 2,
'name' => 'People\'s Liberation Army'
],
'ca' => [
'flag' => 13,
'name' => 'Canadian Forces'
],

// Nations at war 8.0
'blackwater' => [
'flag' => 14,
'name' => 'Blackwater Military Contractors'
],
'taliban' => [
'flag' => 15,
'name' => 'Taliban Forces'
],
'au' => [
'flag' => 16,
'name' => 'Australian Forces'
],
'ru' => [
'flag' => 17,
'name' => 'Russian Forces'
],
'gb' => [
'flag' => 18,
'name' => 'British Forces'
],
'nato' => [
'flag' => 19,
'name' => 'NATO Forces'
],
'isis' => [
'flag' => 20,
'name' => 'ISIS Forces'
],
'iraqa' => [
'flag' => 21,
'name' => 'Iraqi Forces'
],
'usmc' => [
'flag' => 0,
'name' => 'United States Marines Corps'
],
'somalia' => [
'flag' => 23,
'name' => 'Somalian Forces'
],
'rangers' => [
'flag' => 0,
'name' => 'U.S Army Rangers'
],
'idf' => [
'flag' => 25,
'name' => 'Israel Defense Force'
],
'chsf' => [
'flag' => 2,
'name' => 'Chinese Special Forces'
],
'paras' => [
'flag' => 27,
'name' => 'British Paratroop Regiment'
],
'casf' => [
'flag' => 28,
'name' => 'Canadian Special Forces'
],
'hamas' => [
'flag' => 29,
'name' => 'Hamas Forces'
],
'hezbollah' => [
'flag' => 30,
'name' => 'Hezbollah Forces'
],
'iran' => [
'flag' => 31,
'name' => 'Iran Forces'
],
'saudi_arabia' => [
'flag' => 32,
'name' => 'Saudi Arabia Forces'
],
'syria' => [
'flag' => 33,
'name' => 'Syrian Forces'
],
'egypt' => [
'flag' => 34,
'name' => 'Egyptian Army'
],
'pakistan' => [
'flag' => 35,
'name' => 'Pakistan Army'
],
'india' => [
'flag' => 36,
'name' => 'Indian Armed forces'
],
);
Loading