diff --git a/docs/docs/deployment.md b/docs/docs/deployment.md index 0688c82bc274c3a912bd9bfef71c433a16cd3b9c..e60de0ff95c2af9448952674c81979380075298d 100644 --- a/docs/docs/deployment.md +++ b/docs/docs/deployment.md @@ -2,127 +2,98 @@ ## Local Deployment -### Login in the docker registry +### System Requirements +Before you begin installing the Polaris Learning Infrastructure, ensure that your system meets the following requirements: -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. +#### Recommended System Requirements: +- **Operating System**: Linux (Debian 11+, Ubuntu 20.04+ recommended) +- **Processor**: At least 4 CPU cores (8 recommended for larger installations) +- **RAM**: Minimum of 8 GB RAM (16 GB or more recommended for larger user bases) +- **Storage**: Minimum of 50 GB free disk space (expandable based on data volume) +- **Network**: Stable internet connection for updates and container downloads -```bash -docker login registry.git.rwth-aachen.de -``` - -### Create Docker network +#### Software Requirements: +- **Docker** (minimum version 20.10) +- **Docker Compose** (minimum version 1.29) +- **Git** (for downloading configuration files) +- **cURL or Wget** (for fetching external dependencies) -Different containers communicate via a Docker network `web`, which must be created before Docker compose files are executed. +### Installing Docker and Docker Compose +If Docker is not yet installed, you can set it up on Debian or Ubuntu using the following commands: ```bash -docker network create web -``` - -### Create private/public keys and .env +# Add Docker's official GPG key: +sudo apt-get update +sudo apt-get install ca-certificates curl +sudo install -m 0755 -d /etc/apt/keyrings +sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc +sudo chmod a+r /etc/apt/keyrings/docker.asc -Please change all passwords in the configuration file and leave the passphrase empty. - -```bash -cd single-compose -ssh-keygen -b 4096 -f id_rsa -cp .env.sample .env +# Add the repository to Apt sources: +echo \ + "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \ + $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" | \ + sudo tee /etc/apt/sources.list.d/docker.list > /dev/null +sudo apt-get update ``` -### Start containers +Install Docker and Docker Compose: ```bash -docker compose up -d +sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin ``` -Please check whether all services started successfully. +Verify that Docker is installed: ```bash -docker compose ps +docker --version +docker-compose --version +sudo docker run hello-world ``` -After that you should be able to visit http://localhost:8004/ and see the rights engine. - -### Migrate analytics-engine database (only required once after first start) +### Docker Login to the RWTH Aachen Registry +If you are not already logged in, you must authenticate using your GitLab username and password. +If you have enabled two-factor authentication (2FA), you will need a Personal Access Token (PAT) instead. ```bash -docker compose exec -it scheduler sh -c 'scheduler create-db' +echo "YOUR-TOKEN" | docker login registry.git.rwth-aachen.de -u YOUR-USERNAME --password-stdin ``` -### Adding analytics engine jobs - -Analytics engines jobs are configured via yml files and read from the `configuration` directory, which is a volume. - -Example configuration file `configuration/h5p_engines.yml` +After a successful login, the following message will appear: -```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" +```bash +Login Succeeded ``` -Example configuration file `configuration/moodle_engines.yml` - -```yml -moodle_statements_count_engine: - crontab: "*/1 * * * *" - repo: "https://scheduler:glpat-MsDsrHMH-k3-DzEfNRgk@gitlab.digitallearning.gmbh/polaris/engines/dummy-engine.git" - analytics_token: "0482a0f3259c966dfddb38de867573a95995ee5e10898bb71f9ae0e99efe54ef" -``` +#### Create Private/Public Keys and .env File -Update analytics engine scheduler +Please change all passwords in the configuration file and leave the passphrase empty. ```bash -docker compose exec -it scheduler sh -c 'scheduler read-configs' +ssh-keygen -b 4096 -f id_rsa +cp .env.sample .env ``` -### Create visualization token +#### Start Containers ```bash -curl -X POST http://localhost:8004/api/v1/provider/visualization-tokens/create --data '{"engines": ["count_h5p_statements", "count_moodle_statements"]}' -H "Content-Type: application/json" -``` - -Returns JWT Token for dashboard - -``` -{"token":[JWT_TOKEN]"} -``` - -### Loading JSON statements - -It is recommended to import a set of sample statements into the LRS so that the analytics engines can work on this data. Furhtermore, users (user1@polaris.com and user2@polaris.com) can test the data disclousure and data deletion process. - -```console -$ docker compose exec -it mongodb_container sh -c 'mongoimport --authenticationDatabase admin --username root --password CHANGE_ME --db lrs --collection statements --drop --file ./lrs_statements_dump.json' +docker compose up -d ``` -### Start dashboard - -1. Clone  - - `cd dashboard-example` -2. Download latest `@polaris/dashboard-sdk-X.X.X.tgz` from registry and `npm install @polaris/dashboard-sdk-1.0.2.tgz` it (TODO: improve with npm login) -3. Update `TOKEN` in `dashboard-example/src/js/app.js` -4. Run `npm run dev` -5. Visit http://localhost:8005/ - -### (Optional) Filling DB with random statements - -1. Clone rights-engine -2. Create provider config +Please check whether all services started successfully: ```bash -$ cd rights-engine/tools/xapi-statement-generator -$ cp provider_config.json.example provider_config.json +docker compose ps ``` -3. Open `provider_config.json` and insert Application Tokens (visible at http://localhost:8004 (Rights Engine UI), if you login as a provider) -4. Run `python generator.py -t http://localhost:8003/xapi/statements -r` +After that, you should be able to visit http://localhost:8004/ and see the rights engine. -## Remote Deployment via Gitlab CI Pipeline -It is recommended to deploy the rights engine through a Gitlab CI pipeline. The deployment repository contains a suitable pipeline that should be adapted to the deployment target. +## Expermimental: Remote Deployment via Gitlab CI Pipeline -## Remote Deployment on three VMs +It is recommended to deploy the rights engine in production through a Gitlab CI pipeline. The process is currrently expermimental and need an adjustment to the concrete setup. + +### Remote Deployment on three VMs Instead of using a Gitlab CI Pipeline, one can use three VMs for the Polaris deployment. Each VM is responsible one of the three Polaris components _Rights Engine_, _Analytics Engine_ and _Mongo (LRS)_. @@ -136,9 +107,9 @@ Requirements 1. Machines must be able to access the Gitlab from Aachen, full int > Docker creates folder, if the corresponding volume not exists. -### Mongo (LRS) VM setup +#### Mongo (LRS) VM setup -#### 1. Clone deployment repository +##### 1. Clone deployment repository Clone the deployment repository for a quick start. ```console