-
Notifications
You must be signed in to change notification settings - Fork 1
QuickStart
The quick-start assists you in getting the project up and running as quick as possible.
❗
|
It is a common best practice that a project can successfully compile (i.e. The reason is my choice of using jOOQ to generate classes representing the database schema at build time (as opposed to committing the generated classes to the repository). This was a conscious trade-off, sacrificing unconditional compilation versus most up-to-date classes representing the database schema. So in short: Do set up the database before trying to compile the project. |
|
This quickstart guide assumes you will strictly stick to the default settings, i.e. use the exact usernames/passwords as indicated. Also PostgreSQL is expected to run on the default port 5432. It is easy to change all those settings (and you should for productive systems), but that will require additional configuration which is not within the scope of this quickstart guide. You can find more information on this further down on the page. |
In order to work with the project, execute the following steps:
-
Ensure the preconditions on your operating system are met
-
Create the databases and users
-
Clone the project from Github
-
Build the project
-
Run the applications
Ensure that the following preconditions are met:
-
Java 11 is installed
-
git is installed
-
PostgreSQL-Database is installed and running
-
You have permissions to create databases, users or can switch to a user that has them.
-
Your computer has internet access
Consult the internet on how to accomplish the installations for your operating system.
❗
|
Setting up two databases is a hard requirement for a successful compilation of the project. |
We need two databases, one for SciPaMaTo-Core and one for SciPaMaTo-Public. I run integration tests against two additional databases [1], but these are optional. Leave those out if you don’t want to use them. [2]
With PostgreSQL running and with sufficient permissions (e.g as user postgres
on Linux), run the following commands in your shell:
createdb -E utf8 scipamato
createdb -E utf8 scipamato_public
and — optionally — for the integration tests:
createdb -E utf8 scipamato_it
createdb -E utf8 scipamato_public_it
Connect to PostgreSQL (using pgsql
, PGAdmin, DBeaver or whatever tool of your choice).
Issue the following commands to create users and grant privileges as needed:
CREATE USER scipamadmin WITH CREATEROLE PASSWORD 'scipamadmin';
GRANT ALL PRIVILEGES ON DATABASE scipamato to scipamadmin WITH GRANT OPTION;
CREATE USER scipamadminpub WITH CREATEROLE PASSWORD 'scipamadminpub';
GRANT ALL PRIVILEGES ON DATABASE scipamato_public to scipamadminpub WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON DATABASE scipamato_it to scipamadmin WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON DATABASE scipamato_public_it to scipamadminpub WITH GRANT OPTION;
Building the project also applies the Flyway migrations.
Change to the gradle root directory implementation/scipamato
and build the project.
scipamato
and scipamato_public
)cd implementation/scipamato
./gradlew assemble
Gradle downloads all dependencies, builds the project, runs the flyway migrations in both regular databases that set up the tables and provide necessary reference data.
scipamato_it
and scipamato_public_it
)./gradlew check
Gradle now applies the database migrations against all four databases, compiles the project, runs the unit tests, and runs the integration tests against the integration test databases.
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 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:
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 meta tables with the wrong permissions. Those ared both used for data import and for exporting data from core to public. If you start the application first, the data import will fail. |
There are a few possibilities to run a spring boot project such as SciPaMaTo. This guide describes only one of them involving gradle.
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 login with username/password admin
/admin
.
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.
integrationTest
or check
as is instructed further down in the page.
SciPaMaTo - the Scientific Paper Management Tool