Skip to content
linatic7 edited this page Apr 4, 2021 · 11 revisions

How do I run this?

There are two ways how to run this backend: You can either run the breakout-backend via the gradlew build script, or run the it from the Dockerfile

Prerequisites

Database

The breakout-backend uses MariaDB as its persistent storage, so you need to have a database up and running. The easiest way to do this is to use the mariadb image from Dockerhub. You can start a database as follows:

docker run --name breakout-mariadb -e MYSQL_DATABASE=breakout -e MYSQL_ROOT_PASSWORD=root -p "3306:3306" -d mariadb

If you are part of BreakOut e. V., you can now additionally import a data dump provided to you by some BreakOut e. V. members to have test data available.

Database seeding

You need to initialize the database with following data:

INSERT INTO `breakout`.`oauth_client_details` (`client_id`, `client_secret`, `scope`, `authorized_grant_types`, `access_token_validity`, `refresh_token_validity`) VALUES ('client_app', '123456789', 'read, write', 'password', '7200', '70000000');

Configuration File

Most configurations are done via .properties files that are located in src/main/resources/. Talk to a member of a BreakOut e. V. member to get a .properties file with all the needed secrets already filled in.

Be aware that the IP address for the database might differ if you're using Docker Toolbox.

With Gradle

You need to export the SPRING_PROFILES_ACTIVE environment variable to a matching properties file.

For example, if you want your application to pick up the properties file called application-production.properties, you would need to set SPRING_PROFILES_ACTIVE=production.

After setting the environment variable your instance of breakout-backend can be started with

./gradlew bootRun

Setting the environment variable and running the breakout-backend can also be combined to:

SPRING_PROFILES_ACTIVE=production ./gradlew bootRun

With Docker

!Warning: Does not work.!

If you don't want to develop the backend but need a local instance, you can use the Dockerfile to run it locally. You also need the database to be run locally.

Install Docker. Build the container locally with

docker build . -t breakout-backend

Then run the container with

docker run breakout-backend
Clone this wiki locally