Skip to content

Numera User Service

This README explains how to run the service locally in a command line terminal.

Check out the Numera new joiner guide for additional information.

Contents

Prerequisites

Basically, you need to prepare the following:

  • Create GitHub token
  • Configure settings

The details of these steps are explained in the following sections.

Create a GitHub token

Create an access token in Github. After creating the token, copy and paste it to a safe place. Once you leave that view, the token will not be visible to you anymore.

Make sure to configure SSO for this token, authorizing PIT-Numera and PIT-User-Tools.

Create a .settings.xml file

Copy the following settings to a file called settings.xml, located in ${HOME}/.m2:

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">

    <activeProfiles>
        <activeProfile>github</activeProfile>
    </activeProfiles>

    <profiles>
        <profile>
            <id>github</id>
            <repositories>
                <repository>
                    <id>github</id>
                    <url>https://maven.pkg.github.com/PIT-Numera/maven-packages/</url>
                    <snapshots>
                        <enabled>true</enabled>
                    </snapshots>
                </repository>
            </repositories>
        </profile>
    </profiles>

    <servers>
        <server>
            <id>github</id>
            <username>your-github-user-name</username>
            <password>your-github-token</password>
        </server>
    </servers>
</settings>

where your-github-user-name is your GitHub username (something like firstname-lastname_statista) and your-github-token is the token (some string starting with ghp_) you created in the previous step.

Run the service

Get the source code

Open another terminal window and get the latest version of the service by calling

git clone git@github.com:PIT-Numera/user-service.git
cd user-service

Building via maven

Test the service installation by calling

./mvnw clean package

(If mvn is installed on your machine, you can of course also call that instead of ./mvnw.)

run service locally

You can run the service against a local docker container of postgres

docker run --name some-postgres -e POSTGRES_PASSWORD=mysecretpassword -d -p 5432:5432 postgres
docker exec -it <CONTAINER_ID> bash
psql -U postgres
CREATE USER numera WITH PASSWORD 'numera';
CREATE DATABASE userws;
ALTER DATABASE userws OWNER to numera;
GRANT ALL PRIVILEGES ON DATABASE userws to numera;
GRANT ALL ON SCHEMA public TO numera;

Run the service by calling

./mvnw spring-boot:run -Dspring-boot.run.profiles=localdb -DskipTests

Run service against dev DB

In order to connect the service against a running DB on a testsystem, you have to use a jumphost. Please follow https://github.com/PIT-Numera/infrastructure/tree/main/jump-host in order to configure it.

Run the service by calling

./mvnw spring-boot:run -Dspring-boot.run.profiles=devdb -DskipTests

Generating a new RSA Keypair

To generate a new key pair, which you could use for locally running Numera, you can run the following 2 commands in your local console. The first one creates the private key and the second creates the public key belonging to that private key

openssl genrsa -out private.pem 2048

openssl rsa -in private.pem -outform PEM -pubout -out public.pem
After this you can move these two files to your userws-rest resources folder and they will be picked up by the RSAKeyStore