Skip to content
Snippets Groups Projects
Commit 75783fa3 authored by Björn Fischer's avatar Björn Fischer :new_moon_with_face:
Browse files

Merge branch 'develop' into 'main'

2.0.0-beta1

See merge request !41
parents 7b35b9a4 de41de99
No related branches found
Tags 2.0.0-beta1
1 merge request!412.0.0-beta1
Pipeline #12925 passed
Showing
with 416 additions and 66 deletions
......@@ -6,15 +6,8 @@ SUBATO2_VER=latest
SUBATO2_DB_USER=sep
SUBATO2_DB_PASSWORD=wl1npon
# Speicherort von Dateien zu Lösungen, Aufgaben etc.
SUBATO2_DATA_DIR=subato2-data
# Regelmäßige Löschung von anonymen Lösungen
SUBATO2_SOLUTION_CLEANUP_ENABLED=false
# Regelmäßige Aktualisierung von Aufgaben-Pools mit Git Verknüpfung
SUBATO2_TASK_POOL_SYNC_ENABLED=false
# Login/Token Name (in GitLab) für Bot, der für Pool-Sync verwendet wird (sls/aufgaben-pool)
SUBATO2_TASK_POOL_SYNC_GIT_USER=Subato
# SUBATO2_TASK_POOL_SYNC_GIT_TOKEN= <Passwort Safe>
\ No newline at end of file
......@@ -2,4 +2,5 @@
.postgresql-data/
.env
.sql/
.data/
\ No newline at end of file
.data/
.runner/
\ No newline at end of file
......@@ -5,9 +5,6 @@ variables:
http_proxy: "http://proxy.cs.hs-rm.de:8080"
https_proxy: "http://proxy.cs.hs-rm.de:8080"
NO_PROXY: "docker,.cs.hs-rm.de"
SERVER_USER: "root"
SERVER_IP: "subato-test2.local.cs.hs-rm.de"
APP_HOME: "/data/app/subato2"
build-docs:
rules:
......@@ -56,6 +53,11 @@ build-test:
- sh update_version.sh $SUBATO2_VER
- sh build.sh test
deploy-test:
environment: subato-test2.local.cs.hs-rm.de
variables:
SERVER_USER: "root"
SERVER_IP: "subato-test2.local.cs.hs-rm.de"
APP_HOME: "/data/app/subato2"
image: alpine:latest
tags:
- docker
......@@ -66,3 +68,19 @@ deploy-test:
- chmod og= $ID_RSA
- apk update && apk add openssh-client
- ssh -i $ID_RSA -o StrictHostKeyChecking=no $SERVER_USER@$SERVER_IP "cd $APP_HOME && git pull && ./run.sh"
deploy-prod:
environment: subato.local.cs.hs-rm.de
variables:
SERVER_USER: "root"
SERVER_IP: "subato.local.cs.hs-rm.de"
APP_HOME: "/data/app/subato2"
image: alpine:latest
tags:
- docker
stage: deploy
only:
- tags
script:
- chmod og= $ID_RSA
- apk update && apk add openssh-client
- ssh -i $ID_RSA -o StrictHostKeyChecking=no $SERVER_USER@$SERVER_IP "cd $APP_HOME && git pull && ./run.sh"
......@@ -38,6 +38,9 @@ This software includes third party software components:
- https://github.com/springdoc/springdoc-openapi
- https://jdbc.postgresql.org/license/
- https://github.com/h2database/h2database
- https://github.com/ben-manes/caffeine
- https://github.com/MarcGiffing/bucket4j-spring-boot-starter
- https://github.com/angular/angular
- https://github.com/angular-slider/ngx-slider
- https://github.com/scttcper/ngx-codemirror
......
......@@ -6,32 +6,49 @@ fi
echo "Registry = $REGISTRY"
IMAGE="${REGISTRY}/subato2"
IMAGE="${REGISTRY}/subato2-runner"
TAG="${SUBATO2_VER}"
echo "Building image $IMAGE:$TAG..."
docker build -t "$IMAGE:$TAG" subato --build-arg HTTP_PROXY=$http_proxy
docker build -t "$IMAGE:$TAG" -f subato/Dockerfile.runner subato --build-arg HTTP_PROXY=$http_proxy
docker tag ${IMAGE}:${TAG} ${IMAGE}:latest
echo "Pushing image $IMAGE:$TAG..."
docker push "$IMAGE:$TAG"
docker push "$IMAGE:latest"
if [ "$1" = "prod" ] ; then
IMAGE="${REGISTRY}/subato2/prod"
TAG="${SUBATO2_VER}"
echo "Building image $IMAGE:$TAG..."
docker build -t "$IMAGE:$TAG" subato --build-arg HTTP_PROXY=$http_proxy --target prod
docker tag ${IMAGE}:${TAG} ${IMAGE}:latest
echo "Pushing image $IMAGE:$TAG..."
docker push "$IMAGE:$TAG"
docker push "$IMAGE:latest"
IMAGE="${REGISTRY}/subato2-web/prod"
TAG="${SUBATO2_VER}"
echo "Building image $IMAGE:$TAG..."
docker build -t "$IMAGE:$TAG" subato-web --build-arg HTTP_PROXY=$http_proxy --build-arg build_param=build:prod
docker build -t "$IMAGE:$TAG" subato-web --build-arg HTTP_PROXY=$http_proxy --build-arg build_param=build:prod --target prod
docker tag ${IMAGE}:${TAG} ${IMAGE}:latest
echo "Pushing image $IMAGE:$TAG..."
docker push "$IMAGE"
docker push "$IMAGE:latest"
else
IMAGE="${REGISTRY}/subato2-web/test"
IMAGE="${REGISTRY}/subato2/test"
TAG="${SUBATO2_VER}"
echo "Building image $IMAGE:$TAG..."
docker build -t "$IMAGE:$TAG" subato-web --build-arg HTTP_PROXY=$http_proxy --build-arg build_param=build:test
docker build -t "$IMAGE:$TAG" subato --build-arg HTTP_PROXY=$http_proxy --target default
docker tag ${IMAGE}:${TAG} ${IMAGE}:latest
echo "Pushing image $IMAGE:$TAG..."
docker push "$IMAGE:$TAG"
docker push "$IMAGE:latest"
fi
IMAGE="${REGISTRY}/subato2-web/test"
TAG="${SUBATO2_VER}"
echo "Building image $IMAGE:$TAG..."
docker build -t "$IMAGE:$TAG" subato-web --build-arg HTTP_PROXY=$http_proxy --build-arg build_param=build:test --target default
docker tag ${IMAGE}:${TAG} ${IMAGE}:latest
echo "Pushing image $IMAGE:$TAG..."
docker push "$IMAGE:$TAG"
docker push "$IMAGE:latest"
fi
\ No newline at end of file
version: '3'
services:
subato:
container_name: subato-runner-core-data
image: gitlab.cs.hs-rm.de:4567/sls/subato2/subato2-runner:${SUBATO2_VER}
pull_policy: always
volumes:
- '.runner/core-data.json:/conf/core-data.json'
command: import:core /conf/core-data.json
\ No newline at end of file
......@@ -9,10 +9,11 @@ services:
environment:
POSTGRES_USER: sep
POSTGRES_PASSWORD: wl1npon
#POSTGRES_DB: subato2
POSTGRES_DB: subato2
subato-web:
build:
context: ./subato-web
target: default
args:
build_param: build
ports:
......@@ -20,6 +21,7 @@ services:
subato:
build:
context: ./subato
target: default
ports:
- '8081:8080'
- '9000:8000'
......
......@@ -11,25 +11,33 @@ services:
image: gitlab.cs.hs-rm.de:4567/sls/subato2/subato2-web/prod:${SUBATO2_VER}
pull_policy: always
ports:
- '8080:80'
- '8080:443'
environment:
- VIRTUAL_HOST=subato-test2.local.cs.hs-rm.de
- VIRTUAL_PORT=80
- VIRTUAL_HOST=subato.cs.hs-rm.de,subato.local.cs.hs-rm.de
- VIRTUAL_PORT=443
- VIRTUAL_PROTO=https
volumes:
- '/data/volumes/certs/subato.local.cs.hs-rm.de.key:/usr/local/apache2/conf/server.key'
- '/data/volumes/certs/subato.local.cs.hs-rm.de.crt:/usr/local/apache2/conf/server.crt'
subato:
image: gitlab.cs.hs-rm.de:4567/sls/subato2/subato2:${SUBATO2_VER}
image: gitlab.cs.hs-rm.de:4567/sls/subato2/subato2/prod:${SUBATO2_VER}
pull_policy: always
ports:
- '8081:8080'
- '8081:8443'
volumes:
- '${SUBATO2_DATA_DIR}:/usr/local/tomcat/subato2-data'
- /data/volumes/certs:/usr/local/tomcat/ssl
env_file: .env
environment:
- VIRTUAL_HOST=api.subato.cs.hs-rm.de
- VIRTUAL_PORT=8080
- SUBATO2_DATA_DIR=subato2-data
- VIRTUAL_HOST=api.subato.cs.hs-rm.de,api.subato.local.cs.hs-rm.de
- VIRTUAL_PORT=8443
- VIRTUAL_PROTO=https
- SUBATO2_DB_HOST=db
- SUBATO2_DB_PORT=5432
- SUBATO2_EVALUATOR_URL=eva.local.cs.hs-rm.de
- SUBATO2_EVALUATOR_PORT=8081
- SUBATO2_KEYCLOAK_HOST=kc.subato-test2.local.cs.hs-rm.de
- SUBATO2_KEYCLOAK_PORT=80
\ No newline at end of file
- SUBATO2_EVALUATOR_PORT=5081
- SUBATO2_DATA_DIR=subato2-data
- SPRING_PROFILES_ACTIVE=prod
- SUBATO2_KEYCLOAK_URL=https://kc.sls.cs.hs-rm.de
- SUBATO2_SWAGGER_DOCS_URL=http://docs.subato.cs.hs-rm.de/
- SUBATO2_SWAGGER_WEBSITE_URL=http://sls.cs.hs-rm.de/
\ No newline at end of file
version: '3'
services:
subato:
container_name: subato-runner-term-data
image: gitlab.cs.hs-rm.de:4567/sls/subato2/subato2-runner:${SUBATO2_VER}
pull_policy: always
volumes:
- '.runner/term-data:/conf/term-data'
command: import:term /conf/term-data
\ No newline at end of file
......@@ -18,7 +18,7 @@ services:
- VIRTUAL_HOST=subato-test2.local.cs.hs-rm.de
- VIRTUAL_PORT=80
subato:
image: gitlab.cs.hs-rm.de:4567/sls/subato2/subato2:${SUBATO2_VER}
image: gitlab.cs.hs-rm.de:4567/sls/subato2/subato2/test:${SUBATO2_VER}
pull_policy: always
ports:
- '8081:8080'
......@@ -30,10 +30,9 @@ services:
- VIRTUAL_HOST=api.subato-test2.local.cs.hs-rm.de
- VIRTUAL_PORT=8080
- 'JPDA_ADDRESS=*:8000'
- SUBATO2_DATA_DIR=subato2-data
- SUBATO2_DB_HOST=db
- SUBATO2_DB_PORT=5432
- SUBATO2_DATA_DIR=subato2-data
- SUBATO2_EVALUATOR_URL=eva-api
- SUBATO2_EVALUATOR_PORT=8081
- SUBATO2_KEYCLOAK_HOST=kc.subato-test2.local.cs.hs-rm.de
- SUBATO2_KEYCLOAK_PORT=80
\ No newline at end of file
- SPRING_PROFILES_ACTIVE=test
\ No newline at end of file
......@@ -4,16 +4,23 @@ services:
networks:
- subato2
image: 'postgres:14.4'
environment:
- TZ=Europe/Berlin
- PGTZ=Europe/Berlin
subato-web:
networks:
- sls
- subato2
environment:
- TZ=Europe/Berlin
subato:
networks:
- sls
- subato2
depends_on:
- db
environment:
- TZ=Europe/Berlin
networks:
subato2:
......
# Konfiguration
## Datenbank
Konfiguration über:
- `$SUBATO2_DB_HOST`
- `$SUBATO2_DB_PORT`
- `$SUBATO2_DB_USER`
- `$SUBATO2_DB_PASSWORD`
## Datenverzeichnis
Der Pfad zum [subato2-data](persistence.md#subato2-data) Verzeichnis kann über `$SUBATO2_DATA_DIR` konfiguriert werden.
## Git-Synchronisation von Aufgaben-Pools
Aktivierung/Deaktivierung der automatischen Synchronisation über `$SUBATO2_TASK_POOL_SYNC_ENABLED`.
Die Synchronisation erfolgt dann automatisch um 3 Uhr jeden Tag.
Zugangsdaten des Git-Benutzers konfigurierbar über:
- `$SUBATO2_TASK_POOL_SYNC_GIT_USER`
- `$SUBATO2_TASK_POOL_SYNC_GIT_TOKEN`
## Keycloak
URL zum Keycloak Server über `$SUBATO2_KEYCLOAK_URL` setzen.
:::caution
Es muss ein Realm `SLS` und einen Client mit dem Namen `subato-backend` geben.
:::
## Eva
Das [Eva](/eva)-System kann über
- `$SUBATO2_EVALUATOR_URL`
- `$SUBATO2_EVALUATOR_PORT`
- `$SUBATO2_EVALUATOR_REGISTRY_PORT`
- `$SUBATO2_EVALUATOR_TIMEOUT`
konfiguriert werden.
## Automatische Ergänzung von Kursen nach Erstellung
An der Hochschule RheinMain nutzen wir das AoR-System um Veranstaltungen zu Kursen automatisch zu importieren, sobald diese erstellt werden. Sollen nach Erstellung eines Kurses Daten (wie z.B. Veranstaltungen) automatisch aus einer eigenen Datenquelle importiert werden, kann die Schnittstelle `CourseSupplement` implementiert werden. In den JavaDocs zur Schnittstelle `CourseSupplement` finden sich weitere Informationen, als Orientierung kann die bestehende `AoRCourseSupplement` Implementierung genutzt werden.
## Automatischer Cleanup von anonymen Lösungen
Aktivierung über `$SUBATO2_SOLUTION_CLEANUP_ENABLED`. Cleanup erfolgt alle 5 Minuten.
\ No newline at end of file
# Sicherheit
## Rate Limiting
Bei der API handelt es sich um eine interne API, die nicht dafür ausgelegt ist, dass diese für eigene Zwecke (inoffizielle Clients) verwendet wird. Zur Vereinfachung wird die API aber nicht zusätzlich abgesichert - jeder Benutzer mit einem Token kann eigene Skripte/Clients entwickeln und darauf zugreifen.
Um zu vermeiden, dass solche Clients/Skripte die Rechenleistung komplett selbst in Anspruch nehmen, wird Rate Limiting eingesetzt, um die Rechenleistung fair aufzuteilen. Für anonyme Benutzer gibt es ein Limit von **100 Anfragen/Minute**, für authentifizierte Benutzer **200 Anfragen/Minute**. Die verleibenden Requests werden über den Header `X-Rate-Limit-Remaining` kommuniziert, bei Überschreitung werden Anfragen mit dem HTTP Status 429 zurückgewiesen.
# Testumgebung
Für die Testumgebung existiert eine separate Konfiguration (`src/test/resources`), in der eine H2 In-Memory Datenbank
verwendet wird. Bei Start der Integration Tests wird eine Verbindung zu der Datenbank aufgebaut, wodurch alle Repositories
die Daten daraus ziehen. Repositories/Services sind im Fall von Unit-Tests zu mocken, wenn nötig. Für Integration-Tests werden
Fixtures verwendet, die nachfolgend erklärt werden.
Für die Testumgebung existiert eine separate Konfiguration (`src/test/resources/application.properties`), in der eine H2 In-Memory Datenbank verwendet wird. Bei Start der Integration Tests wird eine Verbindung zu der Datenbank aufgebaut, wodurch alle Repositories die Daten daraus ziehen. Repositories/Services sind im Fall von Unit-Tests zu mocken, wenn nötig.
:::caution VPN
Einige Integration Tests hängen von externen Systemen (z.B. GitLab oder [Eva](/eva)) ab. Diese Systeme befinden sich teilweise in der Testumgebung, wodurch die Tests ggf. nur über ein VPN ausgeführt werden können
:::
:::caution Zugangsdaten
Einige Tests erfordern die Konfiguration von Zugangsdaten vor Ausführung. Betroffen ist:
- [Git-Synchronisation von Aufgaben-Pools](../config.md#git-synchronisation-von-aufgaben-pools)
:::
## Fixtures
In `src/test/resources/data.sql` werden die Fixtures initialisiert. Die SQL-Datei wird zu Beginn der Tests für die Initialisierung
In den Tests werden Fixtures verwendet, die nachfolgend erklärt werden. Diese werden in `src/test/resources/data.sql` initialisiert. Die SQL-Datei wird zu Beginn der Tests für die Initialisierung
der Datenbank geladen. Soll die Datenbank bei jedem Test neu initialisiert werden, ist die Testklasse wie folgt zu annotieren:
```
......
---
sidebar_position: 2
sidebar_position: 3
---
# Deployment
## Release-Workflow
- Mit `update_version.sh <version>` an sämtlichen Stellen in der Codebase (geht leider nicht anders) die neue Version setzen und die Änderungen comitten.
- In GitLab einen neuen Tag `<version>` erstellen, [dadurch wird die Pipeline getriggert](#gitlab-pipelines), die die Images erzeugt
- Auf Testumgebung deployen und testen, anschließend auf Produktivumgebung
- Datenbank-Backups nicht vergessen!
## Bauen der Images
Builds werden über die Docker Container Registry in GitLab verwaltet. Dev-Builds werden nach einer bestimmten Zeit bzw. nach einer bestimmten Anzahl (über GitLab Cleanup Policies) regelmäßig gelöscht. Reguläre Builds zu Versionen bleiben bestehen, bis sie manuell gelöscht werden.
## Initiale Einrichtung auf Staging/Produktivumgebung
- Sicherstellen dass [Infrastruktur](https://gitlab.cs.hs-rm.de/sls/core) läuft und erreichbar ist (Test-Executor, Keycloak)
- Repository clonen
- `.env`-Datei für [Konfiguration](backend/config.md) entsprechend anpassen. Bei Testumgebung `SUBATO2_ENV` auf `test` setzen, sonst `prod`. **Die `.env` Datei auf keinen Fall in Git einchecken!**
Für die SPA müssen 3 verschiedene Images (für `test`, `prod` und lokal) gebaut werden, da URLs (wie z.B das Backend) nicht dynamisch zur Laufzeit mitgegeben werden können. Die SPA wird beim Bau des Images in eine statische Webseite kompiliert, in der die URLs fest verankert sind. Beim Backend kann die Konfiguration dynamisch über Umgebungsvariablen erfolgen, weshalb es dafür nur ein Image gibt.
## Build und Deployment
Nachdem der Server eingerichtet ist, können die Images gebaut und deployed werden.
### Manuell
Vorher `SUBATO2_VER` Variable exportieren und auf gewünschten Tag setzen, mit dem die Images zum aktuellen Code getaggt werden sollen. Manuelle Ausführung dann über: `./build.sh <test|prod>`
Siehe [Docker](docker.md). Anschließend mit `git pull && /run.sh` im Repository auf Staging/Produktivumgebung das neue Image ziehen und neu starten.
### GitLab Pipelines
GitLab Pipeline wird getriggert bei
- Erstellung von neuem Tag (Production-Build): `SUBATO2_VER` entspricht Name des Tags
- Manueller Ausführung der Pipeline in Weboberfläche von GitLab (Dev-Build): `SUBATO2_VER` entspricht dem Schema `YYYY-MM-DD-Commithash`
Die Pipeline deployt automatisch bei manueller Ausführung (nicht bei neuem Tag) in die Testumgebung. Dafür muss ein SSH Key in der Variable `ID_RSA` hinterlegt sein. (aktuell als Variable der `sls`-Gruppe in GitLab konfiguriert)
Die Pipeline deployt automatisch in die entsprechende Umgebung. Dafür muss ein SSH Key in der Variable `ID_RSA` hinterlegt sein. (aktuell als Variable der `sls`-Gruppe in GitLab konfiguriert)
## Deployen auf Testumgebung/Produktivumgebung
- Sicherstellen dass [Infrastruktur](https://gitlab.cs.hs-rm.de/sls/core) läuft und erreichbar ist (Test-Executor, Keycloak)
- Repository clonen
- `.env`-Datei entsprechend anpassen. Bei Testumgebung `SUBATO2_ENV` auf `test` setzen, sonst `prod`. Eine Übersicht der konfigurierbaren Einstellungen bietet die `.env.example`. **Die `.env` Datei auf keinen Fall in Git einchecken!**
- `run.sh`: starten (stoppt vorher ggf. Container wenn bereits gestartet, lädt die Images aus der Registry)
- Erneutes Deployment über `git pull && ./run.sh` (oder über Pipeline)
\ No newline at end of file
## Release-Workflow
- Mit `update_version.sh <version>` an sämtlichen Stellen in der Codebase (geht leider nicht anders) die neue Version setzen und die Änderungen comitten.
- In GitLab einen neuen Tag `<version>` erstellen, [dadurch wird die Pipeline getriggert](#gitlab-pipelines), die die Images erzeugt
- Auf Testumgebung deployen und testen, anschließend auf Produktivumgebung
- Datenbank-Backups nicht vergessen!
\ No newline at end of file
---
sidebar_position: 2
---
# Docker
Das System kann über Docker automatisch gebaut und anschließend mit docker compose betrieben werden. Das `build.sh`-Skript ermöglicht den automatischen Build der Images und lädt diese anschließend in die Image Registry auf GitLab hoch. Artefakte (wie z.B. die .war-Datei des Backends oder die SPA) sind dann Teil der Images.
Vor Ausführung des `build.sh`-Skripts muss die `SUBATO2_VER` Variable auf den gewünschten Tag gesetzt werden, mit dem die Images zum aktuellen Code getaggt werden sollen:
```
SUBATO2_VER=2.0.0 ./build.sh <test|prod>
```
* `test`: Staging-Umgebung, HTTP
* `prod`: Produktivumgebung, HTTPS
Für die SPA müssen 3 verschiedene Images (für `test`, `prod` und lokal) gebaut werden, da URLs (wie z.B das Backend) nicht dynamisch zur Laufzeit mitgegeben werden können. Die SPA wird beim Bau des Images in eine statische Webseite kompiliert, in der die URLs fest verankert sind.
Beim Backend kann die Konfiguration zwar theoretisch dynamisch über Umgebungsvariablen erfolgen, sodass es dafür nur ein Image geben müsste. Da die Produktivumgebung aber eine HTTPS Konfiguration erfordert, gibt es auch beim Backend für jede Umgebung ein separates Image, da die Konfiguration fest im Image verankert ist.
## Runner
Damit die in [Runner](backend/runner.md) beschriebenen CommandLine Runner in der Staging/Produktivumgebung ausgeführt werden können (um z.B. Semesterdaten/Stammdaten zu importieren), muss das Backend zusätzlich (zum *.war-Format) als *.jar-Datei gebaut werden. Hierfür wird ein separates Image `subato2-runner` über das `build.sh`-Skript bei jedem regulären Build mitgebaut und veröffentlicht.
Für jeden Runner muss dann eine `docker-compose.yml` angelegt werden. Die von den Runnern benötigten Dateien werden im Verzeichnis `.runner` organisiert und dann per Volume eingebunden.
`docker-compose.term-data.yml` stellt ein Beispiel dar, welches alle .json-Dateien im Verzeichnis `.runner/term-data` einliest und die Semesterdaten importiert. Mit `./runner.sh <core-data|term-data>` müssen die jeweiligen Runner gestartet werden. Dabei wird zunächst das aktuell laufende System heruntergefahren. Anschließend startet das Backend, führt den Runner aus und terminiert dann wieder.
## Verwaltung der Images
Builds werden über die Docker Container Registry in GitLab verwaltet. Dev-Builds werden nach einer bestimmten Zeit bzw. nach einer bestimmten Anzahl (über GitLab Cleanup Policies) regelmäßig gelöscht. Reguläre Builds zu Versionen bleiben bestehen, bis sie manuell gelöscht werden.
\ No newline at end of file
# Lazy Loading
Lazy Loading für Module wird nicht verwendet. Es wird zwar generell empfohlen, allerdings erfordert die Anzeige von Breadcrumbs, dass Routes vorher geladen werden. Ist Lazy Loading aktiviert, werden Routes nur vorher geladen, wenn die jeweiligen Module importiert werden. Da das Laden sämtlicher benötigter Module zirkulare Abhängigkeiten verursachen würde, wird auf Lazy Loading verzichtet.
Aktuell ist die Anwendung noch nicht groß genug, weshalb dies kein Problem darstellt. Mit Lazy Loading beträgt die Bundle-Size etwa 4-5 MB, ohne etwa 15 MB.
\ No newline at end of file
......@@ -3,4 +3,3 @@ sidebar_position: 8
---
# Frontend und Backend
Hallo
\ No newline at end of file
......@@ -4,10 +4,15 @@ sidebar_position: 1
# Dev-Setup
- Docker + docker compose installieren und konfigurieren
- `subato2-data` aus Nextcloud besorgen, nach `<REPO_DIR>/subato/subato2-data` entpacken
- Datenbank Dump (`.sql`-Datei) aus Nextcloud besorgen, Ordner `.sql` in Repository-Root anlegen und Dump im Ordner platzieren. DB-Container starten. Wenn nachträglich: DB-Container herunterfahren, `.postgresql-data`-Ordner löschen, Container starten.
- VPN einrichten
- Für Passwörter oder Aktivierung von bestimmten Features: `cp .env.example .env` (für Docker, bei lokaler Ausführung des Backends die Umgebungsvariablen über die IDE konfigurieren)
- Bereits vorhandenes Datenverzeichnis `subato2-data` nach `<REPO_DIR>/subato/subato2-data` entpacken
- Bereits vorhandenen Datenbank Dump (`.sql`-Datei) in Ordner `.sql` in Repository-Root verschieben (Ordner ggf. vorher anlegen).
- Überschreiben der [Standardkonfiguration](backend/config.md): `cp .env.example .env` (für Docker, bei lokaler Ausführung des Backends die Umgebungsvariablen über die IDE konfigurieren)
- Über Docker die DB und die Dienste starten, an denen nicht entwickelt wird (`docker compose up db -d`, evtl. noch `subato`/`subato-web`)
- VPN einrichten und Verbindung herstellen
:::warning Datenbank zurücksetzen
Wenn die DB bereits gestartet wurde, muss der DB-Container herunterfahren werden. Anschließend muss das Verzeichnis `.postgresql-data` gelöscht werden. Anschließend den Container starten. Wird das Verzeichnis nicht gelöscht, wird eine neue Datenbank unter `.sql` nicht berücksichtigt!
:::
## Backend
- JDK 17 installieren
......@@ -22,8 +27,4 @@ sidebar_position: 1
- Erforderlich sind diverse build-Packages unter Linux (build-essentials, python 2 etc.)
- Pakete installieren in `subato-web` Verzeichnis: `npm i`
- Angular CLI mit NPM global installieren: `npm i @angular/cli@13.3.9`
- Starten in `subato-web` Verzeichnis: `ng serve`
## Docker
- Über Docker die DB und das starten, woran nicht entwickelt wird
- `docker compose up db -d` (evtl. + `subato`, `subato-web`)
\ No newline at end of file
- Starten in `subato-web` Verzeichnis: `ng serve`
\ No newline at end of file
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright {yyyy} {name of copyright owner}
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment