Statistics website for the worlds ActionFreewar and ChaosFreewar in the browser game freewar.de.
PHP 8.2, Bulma CSS, SQLite, Vanilla JS, Apache httpd with mod_php. All of this is shipped as a single docker image.
- PHPUnit: Unit tests and application tests against a database
- PHPStan: Level max, 100% type coverage, strict rules + own custom rules
- PHP-CS-Fixer: PSR-12
Creating a new tag and pushing this tag to GitHub runs a GitHub action which builds a new container image, tags the image with the new tag and pushes this image to the GitHub container registry. After this I will just stop the running container on my server and start a new one. No rolling update needed, not like I have tons of users. π€·ββοΈ
Check the newest docker image here.
docker compose up -d
Use the docker container to install composer packages. This way it's not important which PHP version you have installed locally, and you do not run into any errors.
docker compose exec php composer install
docker compose exec php php bin/console.php app:database-migration
docker compose exec php php bin/console.php app:database-fixtures
Open your browser and visit http://localhost:8080. A test account with username admin
and password Password12345
was also created for you.
docker volume create fwstats-prod
docker run --detach --volume fwstats-prod:/var/www/html/data/database --publish 8888:80 --name fwstats-prod ghcr.io/jesperbeisner/fwstats:latest
docker exec fwstats-prod php bin/console.php app:database-migration
*/5 * * * * docker exec fwstats-prod php bin/console.php app:run > /dev/null 2>&1
In addition to the cronjob, there is also a cronjob endpoint (/cronjob
) that does the same thing as the normal cronjob. You need to send a post request with your bearer token which you can find in the admin panel when you log in.
For this to run reliably, a service such as cron-job.org can be used. Just call the endpoint every 5 minutes and that's it.
Point your reverse proxy on your published port (In this example 8888) and visit your domain. You can log in with the automatically created credentials admin
as username and Password12345
as password. Change the password and e-mail after your first login. That's it, you're done. π
docker rm -f fwstats-prod
docker rmi -f ghcr.io/jesperbeisner/fwstats:latest
docker run --detach --volume fwstats-prod:/var/www/html/data/database --publish 8888:80 --name fwstats-prod ghcr.io/jesperbeisner/fwstats:latest
docker exec fwstats-prod php bin/console.php app:database-migration
Upgrade is done. You are now running the newest version. π