Licence Connect enables schools, school boards, and federal German states to manage educational resources by buying them, assigning them, and making them available to users at schools.
Licence Connect Core provides a way of accessing licences in a unified way.
The documentation on Licence Connect consists of the following artifacts:
| Artifact | Where to Find | Purpose |
|---|---|---|
| Readme | Top-level folder in Licence Connect repository (here) | Basic information on the project, instructions for dev setup |
| Architectural Documentation | doc folder in Licence Connect repository | Architectural documentation containing relevant knowledge for decisions and active development, following the arc42 template |
| BMI (Bildungsmedieninfrastruktur) Docs | Source: https://github.com/FWU-DE/bmi-docs, Deployed: https://fwu-de.github.io/bmi-docs/ |
Public consumer documentation of licence connect with focus on purpose, features and APIs |
This chapter describes the setup of the licence connect core api located in api/.
| Prerequisite | Purpose | Notes |
|---|---|---|
| bun | dev scripts | |
| Java 21 | LC Core Development | |
| Docker & Docker Compose | Running dependencies, building for production | |
| Python 3 | Development of LC Halt & mock licence servers | |
| virtualenv | Development of LC Halt & mock licence servers |
The application requires several environment variables to be set for proper configuration.
Inside the root folder, there is an .env.example file containing all possible (required and optional) variables as well as some explanatory comments.
This file should be used as a template for the actual .env file.
All environment variables must be set before running any local mvn commands or trying to run the app without docker.
Several profiles allow for different configurations of the application. The following profiles are available:
auto-start-mocks: Automatically starts the dockerized mock-serverslocal: Configures the application to query against the local mock servers If the profile is set toauto-start-mockswhen running the application (e.g.mvn test -Dspring.profiles.active=auto-start-mocks, the mock servers will be started automatically.
To run the application from the command line, use the following command:
bun run:coreWhen using IntellIJ, a run configuration called LcCoreApplication should be available.
Running that already uses the correct dev profile and .env file.
On local development, the swagger UI can be accessed at http://localhost:8080/swagger-ui/index.html
To run the tests using the mock licence servers run:
bun run test:mockedTo run the tests against external systems run:
bun run testTo build the Docker image locally, use the following command:
./mvnw spring-boot:build-image -DskipTestsBefore running docker, make sure to change the ownership of the db folder to the user running the docker container. This is necessary because the docker container runs as a different user and needs write access to the db folder.
sudo chown -R 1002:1000 ${DB_FILE_PATH} # default is ./docker/dbTo run the Docker image locally, use the following command:
docker run -e BILO_V1_PASSWORD=<password> -e BILO_V2_CLIENT_ID=<client_id> -e BILO_V2_CLIENT_SECRET=<client_secret> -e VIDIS_API_KEY=<unprivileged_key> -e API_KEY_ADMIN=<admin_key> -e H2_DB_USER=<db user> -e H2_DB_USER_PASSWORD=<db password> -p 8080:8080 lc-core:latestor use the provided downup.sh script:
./downup.shCAUTION: Docker in rootless mode does not seem to work with the spring-boot:build-image command.
When running in docker, it is possible to store logs in loki and display them with grafana.
To configure grafana to use loki, enter the following link: http://localhost:3000/connections/add-new-connection
choose loki as the data source and enter the following URL into the field connection->url: http://loki:3100
Then, you can query the logs in the explore tab like so: 
The Grafana container is only started for the debug docker service profile, i.e. when you start the docker compose project with either the --profile=debug argument,
or supply the COMPOSE_PROFILES=debug variable either directly before the command or via the environment. On the deployment-VM, the Grafana container should not run,
as instead an existing Grafana instance will use the Loki container as a data source.
The architectural documentation and it's diagrams can be rendered using either:
- VSCode with the AsciiDoc extension and kroki enabled (this is also recommended in the repo settings)
- IntelliJ (Kroki needs to be enabled manually)
- Check if code is in releasable state on branch
develop - Check and potentially adapt version numbers in
api/pom.xmlfor LC Core andlc-halt/pyproject.tomlandlc-halt/app/main.pyfor LC Halt - Create Merge Request from
developtomain - Make sure that the .env file on the deployment VM is up to date with the latest environment variables
- If there are new environment variables, add them to the
.envfile on the deployment VM - If there are removed environment variables, remove them from the
.envfile on the deployment VM - If there are changed environment variables, change them in the
.envfile on the deployment VM
- If there are new environment variables, add them to the
- Validate Deployment
- Make sure that the latest docker images for LC Core and LC Halt have been pulled by the deployment step in the pipeline
- Make sure that the deployment pipeline runs successfully and the apps are reachable via
https://api.licenceconnect.schule/andhttps://halt.licenceconnect.schule/ - Check if the swagger UIs are available at
https://api.licenceconnect.schule/swaggerandhttps://halt.licenceconnect.schule/docs
- Create release tag on the merge commit on
main- If LC Core was changed, add a tag with the format
x.y.z - If LC Halt was changed, add a tag with the format
lc-halt_x.y.z
- If LC Core was changed, add a tag with the format
The app is deployed for every push to the main branch.
It is deployed onto the licence-connect-api.fwu.nhnbg VM, which can be reached via the VPN provided by Netz-Haut GmbH for the FWU.
The user used to deploy and run the app is docker, whose home directory on the VM is /var/docker.
The app resides in /var/docker/apps/licenceconnect
Externally, the app can be reached via https://api.licenceconnect.schule/, with a publicly available swagger UI on https://api.licenceconnect.schule/swagger.
The exact deployment process can be seen inside .gitlab-ci.yml, but essentially, the pipeline
- builds a new docker image
- copies the
docker/docker-compose.yamlfile and thedocker/nginxdirectory to the VM - restarts the docker services
On the server, instead of providing the environment variables directly to the docker compose command, there is an .env file located in the app folder in which all required environment variables must be set.
To allow easy local testing and testing without being dependent on the availability of external systems, we provide a mock for every licence server we support in mock-licence-servers.
Currently, this includes:
- Arix
- Bildungslogin V1
- Bildungslogin V2
All licence servers can be individually started in a docker container. All licence servers can be started simultaneously by running
docker compose -f mock-licence-servers/docker-compose.yml up -dThere are two versions of Arix mock servers:
arix-acceptingto allow testing the connection to an Arix server that has whitelisted lc core.arix-rejectingto allow testing the connection to an Arix server that has not whitelisted lc core.
Please be aware that neither is a complete Arix server but rather only provides the functionality needed for the tests currently implemented.
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
The BiLo endpoints reference licence endpoints from "Bildungslogin". The github of the Bildungslogin public API can be found under https://github.com/BILDUNGSLOGIN/public_api_docs and is licensed with https://github.com/BILDUNGSLOGIN/public_api_docs/blob/main/LICENSE.txt.
In the Licence Connect public API
- the bilo-v-1-controller references https://github.com/BILDUNGSLOGIN/public_api_docs/blob/main/bilo-licenseretrieval_v1.json
- the bilo-v-2-controller references https://github.com/BILDUNGSLOGIN/public_api_docs/blob/main/bilo-licenseretrieval_v2.json