diff --git a/README.md b/README.md index eca5bab9a3f2ecffe9b7ba2ccceaa25ba42ba743..1d253942a82b9b3791e7e14447570b49ff36e403 100644 --- a/README.md +++ b/README.md @@ -21,84 +21,71 @@ end # Getting started Each folder contains one of the components of -## Login in the docker registry +## Local Deployment + +### Login in the docker registry If you are not already logged in, you need to authenticate to the Container Registry by using your GitLab username and password. If you have Two-Factor Authentication enabled, use a Personal Access Token instead of a password. ```bash docker login registry.digitallearning.gmbh ``` -## Create Docker Network +### Create Docker network Different containers communicate via a Docker network `web`, which must be created before Docker compose files are executed. ```bash docker network create web ``` -## LRS / MongoDB -First we need a database or LRS to store the xAPI Statements. In a local setup, you can use the docker container in the mongodb folder. -Rename or copy the sample configuration. Please change all passwords in the configuration file. +### Create private/public keys and .env + +Please change all passwords in the configuration file and leave the passphrase empty. ```bash -cd mongodb +cd single-compose +ssh-keygen -t rsa -b 4096 -m PEM -f id_rsa +openssl rsa -in id_rsa -pubout -outform PEM -out id_rsa.pub cp .env.sample .env ``` -Now you can start the mongodb with the following command + +### Start containers + ```bash docker compose up -d ``` -Please check that the database is created: +Please check whether all services started successfully. ```bash docker compose ps ``` +After that you should be able to visit http://localhost:80/ and see the rights engine. -## Rights engine -First create some jwt keys with the following command: - -```bash -cd rights-engine -ssh-keygen -t rsa -b 4096 -m PEM -f id_rsa -openssl rsa -in id_rsa -pubout -outform PEM -out id_rsa.pub -``` - -Leave the passphrase empty. -Rename or copy the sample configuration. Please change all passwords in the configuration file. -```bash -cp .env.sample .env -``` +### Migrate rights-engine database (only required once after first start) -At the first run, create the database with the following command: ```bash docker compose exec -it rights-engine sh -c 'python3 manage.py sqlflush | sed s/TRUNCATE/DROP\ TABLE\ IF\ EXISTS/g | python3 manage.py dbshell && echo DROP\ TABLE\ IF\ EXISTS\ django_migrations\; | python3 manage.py dbshell && python3 manage.py migrate && python3 manage.py loaddata fixtures/initial_db.json' ``` -Now you can start the rights engine with the following command -```bash -docker compose up -d -``` +### Migrate analytics-engine database (only required once after first start) -Please check that all services are started: ```bash -docker compose ps +docker compose exec -it scheduler sh -c 'scheduler create-db' ``` -After that you should be able to visit http://localhost:80/ and see the rights engine. +### Adding analytics engine jobs -## Analytics engine -Rename or copy the sample configuration. Please change all passwords in the configuration file. -```bash -cd analytics-engine -cp .env.sample .env -``` +Analytics engines jobs are configured via yml files and read from the `configuration` directory, which is a volume. -At the first run, you need to seed the database with the following command -```bash -docker compose down && docker compose up -d && sleep 30 && docker compose exec -it scheduler sh -c 'scheduler create-db' && docker compose exec -it scheduler sh -c 'scheduler read-configs' +Example configuration file `configuration/h5p_engines.yml` +```yml +h5p_statements_count_engine: + crontab: "*/1 * * * *" + repo: "https://scheduler:glpat-MsDsrHMH-k3-DzEfNRgk@gitlab.digitallearning.gmbh/polaris/engines/dummy-engine.git" + analytics_token: "b6a4ec069ef9f688e781161d46c2a85c14a761a4eaf0074099656c7de44a65d9" ``` -Now you can start the analytics engine with the following command +Update analytics engine scheduler ```bash -docker compose up -d +docker compose exec -it scheduler sh -c 'scheduler read-configs' ``` ## Update Docker Images