-
Notifications
You must be signed in to change notification settings - Fork 0
Setup
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. For instructions see below.
Install Git and clone the repository, by entering this to a command-line terminal:
git clone https://github.com/BreakOutEvent/breakout-backend
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. First, install Docker Desktop. You can create a database by running this command in a command-line terminal:
docker run --name breakout-mariadb -e MYSQL_DATABASE=breakout -e MYSQL_ROOT_PASSWORD=root -p "3306:3306" -d mariadb
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.
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
!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
After you ran the backend for the first time (see below) and the DB was initialized, you need to update the database with following data. For this, you can use a SQL client like Heidi SQL 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.
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');