Skip to content

QuickStart

Urs Joss edited this page Mar 27, 2024 · 15 revisions

Quick Start Guide

The quick-start assists you in getting the project up and running as quickly as possible.

You need a running docker daemon not only to run integration tests but even to compile the project. jOOQ is building type-safe classes based on the database schema (migrated via Flyway beforehand).

1. Summary

In order to work with the project, execute the following steps:

  1. Ensure the preconditions on your operating system are met

  2. Clone the project from Github

  3. Build the project

  4. Run the applications

2. Preconditions

Ensure that the following preconditions are met:

  • Java 21 is installed

  • git is installed

  • Your computer has internet access

  • docker is installed and the docker daemon is running

Consult the internet on how to accomplish the installations for your operating system.

3. Clone the project

git clone https://github.com/ursjoss/scipamato.git

4. Build the project

Building the project applies the Flyway migrations to the database started in docker. jOOQ then generates type-safe classes representing the database. Make sure the docker daemon is running on your system!

Build the project.

Build the project
./gradlew assemble

Gradle downloads all dependencies, builds the project, runs the flyway migrations on the PostgreSQL database started in a docker container.

Optionally run all tests including integration tests
./gradlew check

5. Data-Transfer (optional and not part of the open-source project)

I created a separate spring-boot/spring-batch project (not open-sourced) that processes CSV files that were previously exported from the legacy application that was replaced by SciPaMaTo at SwissTPH. The maven build compiles a jar file that imports the exported and processed data into SciPaMaTo-Core.

Put this jar file into a directory, together with an application.properties file that has the correct JDBC-url, user name, and password, etc. configured for SciPaMaTo-Core.

application.properties
#
# Application-specific settings
#
##################################

#
# Logging specification
#
###########################

logging.file=log/migration.log
logging.level.root=INFO

#
# Database Configuration
#
#############################
db.schema=public
spring.datasource.type=com.zaxxer.hikari.HikariDataSource
spring.datasource.hikari.driver-class-name=org.postgresql.Driver
spring.datasource.hikari.jdbc-url=jdbc:postgresql://localhost:5432/scipamato
spring.datasource.hikari.username=scipamadmin
spring.datasource.hikari.password=scipamadmin
spring.datasource.hikari.connection-timeout=60000
spring.datasource.hikari.maximum-pool-size=7

To run the jar:

Import the data containing the data from the legacy application
java -jar ./ludok-migration-0.0.1-SNAPSHOT.jar
⚠️

If you want to import the data, be sure to do it before you start the application. Currently, a bug creates the spring batch metatables with the wrong permissions. Those are both used for data import and for exporting data from core to public. If you start the application first, the data import will fail.

6. Run the applications

In order to run the application, you must point the application to a database. You can install and run a physically installed PostgreSQL database or do so in a docker container. Make sure your application.properties file points to the correct database. There is no out-of-the-box mechanism starting docker (as it is taken care of for generating classes from the database or for integration tests).

There are a few possibilities to run a spring boot project such as SciPaMaTo. This guide describes only one of them involving gradle.

6.1. Run SciPaMaTo-Core

From the root directory in the git repository:

cd implementation/scipamato/
./gradlew :core-web:bootRun

Open the web browser and access https://localhost:8080/. You can log in with username/password admin/admin.

6.2. Run SciPaMaTo-Public

From the root directory in the git repository:

cd implementation/scipamato/
./gradlew :public-web:bootRun

Open the web browser and access https://localhost:8081/. No login is required for regular usage.