This repository contains the backend for the Memory 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/memory repository.
- The installation manual and setup instructions can be found here.
Make sure you have the following installed:
- Java: JDK 17 or higher
- Maven: Maven 3.6.3
- Docker: Docker latest or higher
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.
Start all dependencies with our docker-compose files. Check the manual for starting the dependencies with docker-compose .
mvn install
in the folder of the project. Go to the target folder and run
java -jar memory-service-0.0.1-SNAPSHOT.jar
Build the Docker container with
docker build -t memory-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 memory-backend-dev memory-backend-dev
To monitor, stop and remove the container you can use the following commands:
docker ps -a -f name=memory-backend-dev
docker stop memory-backend-dev
docker rm memory-backend-dev
To 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 memory-backend ghcr.io/gamify-it/memory-backend:latest
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 memory-database postgres
To stop and remove it simply type
docker stop memory-database
Rest mappings are defined in
- Config
controller:
src/main/java/de/unistuttgart/memorybackend/controller/ConfigController.java
- Game result
controller:
src/main/java/de/unistuttgart/memorybackend/controller/GameResultController.java
When the service is started (see Getting started), you can access the API documentation:
Open http://localhost/minigames/memory/api/v1/swagger-ui/index.html#/ and
fill http://localhost/minigames/memory/api/v1/v3/api-docs
into the input field in the navbar.