Read Me First
Check out the Numera new joiner guide for additional information.
Please refer to our Naming Conventions when choosing names
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/statistic-service.git
cd statistic-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 contentws;
ALTER DATABASE contentws OWNER to numera;
GRANT ALL PRIVILEGES ON DATABASE contentws 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