generated from it-at-m/oss-repository-en-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #778 from it-at-m/742-in-doku-das-anlegen-eines-fr…
…ontend-projekt-beschreiben 742 in doku das anlegen eines frontend projekt beschreiben
- Loading branch information
Showing
4 changed files
with
136 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Erstellung eines neue Microservices | ||
|
||
Wenn ein neuer Microservice angelegt wird, sind dabei einige Themen zu beachten. | ||
|
||
## Update der Tests | ||
|
||
Im Projekt haben wir für das Naming unserer Tests [Konventionen](/technik/naming_conventions/testing) aufgestellt. Die bereitgestellten Tests der | ||
[Refarch-Templates](https://github.com/it-at-m/refarch-templates/), welches im Projekt eingesetzt wird, müssen | ||
entsprechend angepasst werden. | ||
|
||
## Workflows einrichten | ||
|
||
Im Repo gibt es diverse [Workflows](/technik/ecosystem/workflows). Die Workflows eines bestehenden Services sind zu | ||
kopieren und die Trigger anzupassen. | ||
|
||
> [!IMPORTANT] | ||
> Beim Kopieren ist das [Namensschema](/technik/naming_conventions/workflows) zu beachten. Außerdem muss zwingend für | ||
> ein Frontend-Projekt ein Frontend-Workflow und für einen Backend-Service ein Backend-Workflow dupliziert werden! | ||
## Individuelle Anpassungen | ||
|
||
Einige Einstellungen sind davon abhängig, ob es sich um einen Frontend oder Backend-Service handelt. Die folgenden | ||
Guides sollen dabei unterstützen: | ||
|
||
1. Guide zur Erstellung eines [neuen Backend-Services](/technik/guides/new-microservice/new-service-backend.md) | ||
2. Guide zur Erstellung eines [neuen Frontend-Projekts](/technik/guides/new-microservice/new-service-frontend.md) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 88 additions & 0 deletions
88
docs/src/technik/guides/new-microservice/new-service-frontend.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
# Frontend-Projekt | ||
|
||
Um ein neues Frontend-Projekt anzulegen sind zuvor die [allgemeinen Infos](/technik/guides/new-microservice/index.md) | ||
zum Einrichten eines neuen Services zu beachten. | ||
|
||
## Referenzarchitektur-Template klonen | ||
Um ein neues Frontend-Projekt anzulegen, wird das entsprechende Frontend-Template der | ||
[Referenzarchitektur](https://github.com/it-at-m/refarch-templates/tree/main/refarch-frontend) benötigt. Da wir einen | ||
neuen Frontend-Service brauchen, ist nur der Ordner `refarch-frontend` des Templates relevant. | ||
|
||
Der einfachste Weg, diesen in das WLS-Projekt zu integrieren, ist es, das Refarch-Repository zu klonen und anschließend | ||
den `refarch-frontend`-Ordner zu kopieren und lokal im Projekt einzufügen. Dafür wird der Ordner umbenannt, weil er | ||
dem Namensschema `wls-gui-<frontend-name>` entsprechen sollte. | ||
|
||
::: details Beispiel | ||
Zum Beispiel heißt der Ordner `wls-gui-wahllokalsystem` für das Wahllokalsystem und könnte `wls-gui-admintool` für das | ||
Admintool bezeichnet werden. | ||
::: | ||
|
||
## Workflow Templates | ||
|
||
::: code-group | ||
```yml {1,8-9,18} [wls-gui-<frontend-name>_push-dev.yml] | ||
name: build push dev gui <frontend-name> | ||
|
||
on: | ||
push: | ||
branches: | ||
- dev | ||
paths: | ||
- 'wls-gui-<frontend-name>/**' | ||
- '.github/workflows/wls-gui-<frontend-name>_push-dev.yml' | ||
|
||
jobs: | ||
build-github-container-image: | ||
permissions: | ||
packages: write | ||
uses: | ||
./.github/workflows/callable-create-github-container-image-frontend.yml | ||
with: | ||
service: 'wls-gui-<frontend-name>' | ||
``` | ||
```yml {1,6-7,14} [wls-gui-<frontend-name>_pull-request.yml] | ||
name: verify pull request gui <frontend-name> | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- 'wls-gui-<frontend-name>/**' | ||
- '.github/workflows/wls-gui-<frontend-name>_pull-request.yml' | ||
|
||
jobs: | ||
verify-pull-request: | ||
uses: | ||
./.github/workflows/callable-run-npm-build.yml | ||
with: | ||
package-dir: 'wls-gui-<frontend-name>' | ||
``` | ||
::: | ||
## Routing im Gateway einrichten | ||
Damit der Port und die URL für das neue Frontend-Projekt korrekt verknüpft wird, muss das | ||
[`application-routes.yml`-File](https://github.com/it-at-m/Wahllokalsystem/blob/dev/stack/gateway_config/application-routes.yml) | ||
entsprechend angepasst werden: | ||
|
||
```yaml | ||
spring: | ||
cloud: | ||
gateway: | ||
routes: | ||
# ... | ||
- id: gui-<frontend-name> // [!code focus:4] | ||
uri: http://kubernetes.docker.internal:<PORT>/ | ||
predicates: | ||
- Path=/<frontend-name>/** | ||
``` | ||
|
||
> [!IMPORTANT] | ||
> Es wird immer die erste Route verwendet, welche die Bedingungen (predicates) erfüllt. Nur `Path=/**` wäre auf alle Pfade | ||
> anwendbar, weshalb alle Routen, die danach noch kommen, nicht mehr berücksichtigt werden. Daher muss eine Route mit | ||
> dem Pfad `Path=/**` immer an letzter Stelle stehen. | ||
|
||
## Ungenutzte Refarch-Elemente entfernen | ||
|
||
Damit der Code sauber und übersichtlich bleibt, sollten die Elemente des Refarch-Templates, die nicht für das Projekt | ||
benötigt werden, wie zum Beispiel [Mucatar](https://github.com/it-at-m/Wahllokalsystem/pull/661/files) entfernt werden. |