This repository contains the backend for the regexgame minigame.
It persists the game data (configurations, game results, etc.) in a database and communicates with other backend services.
- User documentation for the minigame can be found here.
- For the frontend, see the Gamify-IT/regexgame repository.
- The installation manual and setup instructions can be found here.
- Docker documentation can be found Check the here.
Rest mappings are defined in
- Game result
controller:
src/main/java/de/unistuttgart/regexgamebackend/controller/GameResultController.java - Config
controller:
src/main/java/de/unistuttgart/regexgamebackend/controller/ConfigController.java
When the service is started (see Getting started), you can access the API documentation:
Open http://localhost/minigames/regexgame/api/v1/swagger-ui/index.html#/ and
fill http://localhost/minigames/regexgame/api/v1/v3/api-docs into the input field in the navbar.
Make sure you have the following installed:
- Java: JDK 17 or higher
- Maven: Maven 3.6.3
- Docker: Docker latest
First you have to change the spring.datasource.username and the spring.datasource.password in the application.properties file. If you changed the properties of the postgres db, you also have to change spring.datasource.url.
Execute the following in the project directory to build the project locally:
mvn installThen go to the target folder and run:
java -jar regexgame-service-0.0.1-SNAPSHOT.jarBuild the Docker container with the following:
docker build -t regexgame-backend-dev .And run it at port 8000 with:
docker run -d -p 8000:80 -e POSTGRES_URL="postgresql://host.docker.internal:5432/postgres" -e POSTGRES_USER="postgres" -e POSTGRES_PASSWORD="postgres" --name regexgame-backend-dev regexgame-backend-devTo monitor, stop and remove the container you can use the following commands:
docker ps -a -f name=regexgame-backend-devdocker stop regexgame-backend-devdocker rm regexgame-backend-devTo run the prebuild container use:
docker run -d -p 8000:80 -e POSTGRES_URL="postgresql://host.docker.internal:5432/postgres" -e POSTGRES_USER="postgres" -e POSTGRES_PASSWORD="postgres" --name regexgame-backend ghcr.io/gamify-it/regexgame-backend:latestTo use the docker compose files to run your local changes as a container, use:
docker compose up --buildTo shutdown the container use:
docker compose downIf you only want to start the dependencies via docker and run the project locally, use the docker-compose-dev.yaml
file instead:
docker compose -f docker-compose-dev.yaml upTo shutdown use:
docker compose -f docker-compose-dev.yaml downYou can then run the backend locally as described above.
To setup a database with docker for testing you can use:
docker run -d -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=postgres --rm --name regexgame-database postgresTo stop and remove it use:
docker stop regexgame-database