Skip to content

Latest commit

 

History

History
80 lines (57 loc) · 3.48 KB

backend_build_run.md

File metadata and controls

80 lines (57 loc) · 3.48 KB

Building and running the backend

Prerequisites

1. Setup Java JDK

Running Gradle always requires a Java JDK version 8 or higher. For this project it is recommended to use version 11 of the Java JDK. First download the installer for the Java JDK.

Windows

Make sure you select the appropriate operating system, architecture and version 11 of the JDK. Download and run the .msi file. Make sure the "Configure JAVA_HOME variable" option is checked. This option is disabled by default in the installer.

After the installation has finished, open CMD and check with java -version if the installation was successful.

2. Setup Gradle

Gradle is a build tool used to build the backend. Gradle version 7.1 is required for the backend. A list of the different versions can be found here. If you do not install Gradle via a package manager, there is a detailed description of how to install Gradle manually.

After the installation has finished, open CMD and check with gradle -v if the installation was successful.

3. Set up database management systems

MongoDB

The database management system Mongodb is used for the persistence of the reports to be saved. Download the latest version of MongoDB and install it. It is recommended to install MongoDBCompass with MongoDB Shell as well.

PostgreSQL

The database management system PostgreSQL is used for the persistence of user account data. Download and install the latest version of PostgreSQL.

The PostgreSQL database must be created by yourself and is not automatically generated by the project. To do this, create a PostgreSQL user with a secure password and remember the user credentials. To create a database in PostgreSQL, the latest version of pgAdmin is recommended.

4. Get the Project

You can download the project as a ZIP file or clone it with:

   git clone https://github.com/informatik-heilbronn/transparenz-cockpit

If you downloaded the zip file, extract the project to a path of your choosing.

Build

Make sure you have met the prerequisites for the backend. Open CMD, navigate to the project folder and run the following command:

   gradle backend:build

Run

Before you can run the backend, you need to create and configure the databases. Unlike the PostgreSQL database, the MongoDB database is created automatically. Accordingly, you have to create the PostgreSQL database yourself.

In the backend folder is the transparentcockpit.config.sample file, which provides a template for specifying the configuration. Enter your database information in this file using an editor. Rename the file and remove the .sample so that the file is called transparentcockpit.config afterwards.

Note: If you have not created a user for the MongoDB database, you can create a new admin user with the following commands in Mongo shell:

   use admin
   db.createUser({ user: "<user>" , pwd: "<password>", roles: ["userAdminAnyDatabase", "dbAdminAnyDatabase", "readWriteAnyDatabase"]})

After you have done all the preparations, open CMD, navigate to the project folder and run the following command:

   gradle backend:run