‏ ‏ ‎ ‏ ‏ ‎

1. 2024-09-26

1.1. Bezeichnungen in git-Repositories

git repo names
  • Bezeichnungen sollten immer im kebab-Casing erstellt werden:

    • Grund: beim erstellen von Docker-Images kann es zu Problemen kommen.

    • statt "FerienPass" → "ferien-pass"

1.2. Minimum Viable Product

minimum viable product

2. 2024-10-24

ci cd cd

2.1. gh-actions - Ein erster Workflow

  • ist ein Mechanismus, mit dem shell-Befehle hinterlegt werden können, die anschließend ausgeführt werden.

  • https://docs.github.com/en/actions/writing-workflows/quickstart

  • Was ist yaml?

    • Vergleichbar mit JSON, nur andere Schreibweise

  • Erstellen eines gh-Verzeichnisses

    mkdir -p .github/workflows
  • Erstellen einer Workflow Datei github-actions-demo.yaml

    name: GitHub Actions Demo
    run-name: ${{ github.actor }} is testing out GitHub Actions 🚀
    on: [push]
    jobs:
      Explore-GitHub-Actions:
        runs-on: ubuntu-latest
        steps:
          - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
          - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
          - run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
          - name: Check out repository code
            uses: actions/checkout@v4
          - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
          - run: echo "🖥️ The workflow is now ready to test your code on the runner."
          - name: List files in the repository
            run: |
              ls ${{ github.workspace }}
          - run: echo "🍏 This job's status is ${{ job.status }}."
  • Committen und pushen

    gh actions first run

2.2. Workflow zum kompilieren eines quarkus Projekts

  • löschen des bestehenden Workflow-Files oder deaktivieren mittels Anfügen der Endung disabled

  • Erstellen eines workflow-Files actions.yaml

    gh actions folder
    name: GitHub Actions Demo
    run-name: ${{ github.actor }} is compiling a quarkus project 🚀
    on: [push]
    jobs:
      Explore-GitHub-Actions:
        runs-on: ubuntu-latest
        steps:
          - uses: actions/checkout@v4
          - uses: actions/setup-java@v4 (1)
            with:
              distribution: 'temurin'
              java-version: '21'
              cache: 'maven' (2)
              cache-dependency-path: 'ci-cd/pom.xml' # optional
          - name: Build with Maven
            working-directory: ci-cd
            run: mvn -B package --file pom.xml
1 Es ist sinnvoll am gh-Marketplace eine action zu suchen. Hier bildet die java-setup-action die Grundlage.
2 Mit dieser Actions können die maven-dependencies zwischen den Läufen gecached werden. Im Fehlerfall wird der Cache gelöscht.
gh actions 2nd run

3. 2024-12-05

3.1. Rollenkonzept

rollenkonzept

3.2. Authorisierung und Authentifizierung

  • Authorization: Wer bin ich? → 401 Unauthorized

  • Authentication: Was darf ich? → 403 Forbidden

3.3. Keycloak

  • User

4. 2024-12-12

5. 2025-02-27 Security

git clone git@github.com:caberger/keycloak.git

cd compose
docker compose up --build

# Löschen der images und volumes
docker image ls -q | xargs docker image rm
docker volume ls -q | xargs docker volume rm

6. 2025-03-06 OIDC

reverse engineering
reverse engineering
authentication authorization
  • Für die Umsetzung verwenden wir Keycloak

  • RBAC: Role Based Access Control

  • Wir verwenden hier den OIDC Standard

7. 2025-03-13

7.1. RBAC

  • Role Based Access Control

  • Die Zugriffsrechte auf eine APP (API) werden oft über die API selbst definiert, dh bestimmte Endpoints sind nur mit bestimmten Rollen zugänglich

  • Bei RBAC sind dazu Annotationen im Code notwendig.

  • Eine Alternative dazu sind sogenannte Policies (Politiken), die in Keycloak definiert werden.

    • Keycloak ist ein IAM ein Identity and Access Management System.

  • Was ist eine Rolle?

    • Eine Sammlung von Rechten (Permissions)

  • Wenn ein Recht für den Zugriff auf einen Endpoint nicht vorhanden ist, wird ein 403 Forbidden zurückgegeben.

  • Voraussetzung für die Überprüfung auf ein vorhandenes Recht ist, dass der Benutzer authentifiziert ist und ein gültiges Token besitzt.

    • Wer bin ich? (Authentifizierung)

    • Was darf ich? (Autorisierung) - welche Rechte habe ich?

  • Was ist eine Resource?

    • Ein REST-Endpoint, auf den zugegriffen werden kann.

  • Annotationen in Quarkus:

    • @PermitAll: Jeder darf auf den Endpoint zugreifen

  • application.properties

    • quarkus.oidc.auth-server-url damit wird die ausstellende Stelle des Tokens definiert

  • Für Web-Frontends

8. 2025-03-27

8.1. Keycloak bei Angular-Frontend

8.1.1. Richtige (lokale) Installation von Angular

  • Man möchte sich nicht darauf verlassen, was ein anderer auf der Maschine installiert hat.

  • Angular wird lokal installiert

npm init -y
npm install @angular/cli
  • Die globale Installation verschmutzt den Pfad und legt ng in einer bestimmten Version in den globalen Path.

  • npx …​ Node Package Exceutor

npx ng new ng-demo
npm outdated
find . -type f -print | wc -l

8.1.2. Exkurs: DI in Angular

8.1.3. Übung

  • Erstellen einer Angular-App, bei der man sich an einem keycloak server authentifiziert und dann erhält man einen chuck-norris witz.

9. 2025-04-10

9.1. Frontend vs Backend

frontend vs backend

9.2. Einrichten eines nginx-Servers

reverse proxy vm
bash_history
apt-get update && apt-get dist-upgrade
apt autoremove
df -h
docker container ls -a
docker container prune
docker image ls
docker container prune
docker image prune
docker image ls -q | xargs docker image rm
docker image ls
docker volume ls
docker volume prune
docker volume prune -f
docker volume prune -a
docker volume ls
docker builder prune -f
docker network ls
docker network rm leo-iot_default
docker network rm leo-iot_quarkus
systemctl status nginx
apt install nginx
systemctl enable nginx
systemctl restart nginx
netstat -ant
apt install net-tools
netstat -ant
netstat -antp
ifconfig
cd /etc/nginx/conf.d/
cd ..
ll
cat nginx.conf
cd sites-enabled/
cat default
cd /var/www/html/
ll
nano index.nginx-debian.html

10. 2025-04-24

10.1. Erstellen einer docker-compose.yaml für Quarkus-Backend

In obigem Artikel sieht man schön, wie man mit healthcheck die Startreihenfolge der Container (Services) steuern kann.

11. 2025-04-08

11.1. Eclipse Data Store

eclipse data store

12. 2025—​06-06 Installieren von nginx auf vm

localhost
10149  nano ~/.ssh/config
10150  cd ~/.ssh/
10151  l
10152  cd -
10153  ssh vm09
10154  ssh-copy-id  vm09
10155  ssh vm09
10156  nano ~/.ssh/config
10157  cd .ssh
10158  l
10159  cat id_rsa.pub
10160  cat id_ed25519_github_ThomasStuetz.pub
10161  ssh-copy-id  -i id_rsa.pub vm09
10162  ssh vm09
10163  nano ~/.ssh/config
10164  ssh vm09
10165  l
10166  git clone git@github.com:htl-leonding/4bhitm-letsencrypt.git
10167  cd vehicle/backend
10168  mvn clean package
10169  l
10170  ./build.sh
10171  docker login ghcr.io
10172  docker push ghcr.io/htl-leonding/vehicle:latest
10173  ./build.sh
10174  l
10175  cd vehicle/compose
10176  docker compose up
10177  ./build.sh
10178  docker image ls
10179  docker system prune -a
10180  docker image ls
10181  ./build.sh
10182  docker push ghcr.io/htl-leonding/vehicle:latest
10183  docker image ls
10184  ./build.sh
10185  l
10186  quarkus dev --clean
~/.ssh/config
Host vmxy
     Hostname <IP-Address>
     User root
     IdentityFile ~/.ssh/id_rsa
vm
root@vm09:~# history
    1  apt-get update && apt-get dist-upgrade -y
    4  apt autoremove
    2  reboot
    9  exit
   18  nano /etc/ssh/ssh_config
   19  nano /etc/sshd/ssh_config
   20  nano /etc/ssh/sshd_config
   21  systemctl restart sshd
   22  exit
   45  systemctl status nginx
   46  apt install nginx
   47  systemctl enable nginx
   48  systemctl restart nginx
   49  netstat -ant
   50  apt install net-tools
   51  netstat -ant
   52  netstat -antp
   53  ifconfig
   54  cd /etc/nginx/conf.d/
   55  ls
   56  cd ..
   57  ll
   58  cat nginx.conf
   59  l
   60  ll
   61  cd sites-enabled/
   62  ll
   63  cat default
   64  cd /var/www/html/
   65  ll
   66  nano index.nginx-debian.html
   67  l
   68  ll
   69  nano index.nginx-debian.html
   70  cat .bash_history
   71  cd /etc/nginx
   72  l
   73  cd sites-enabled/
   74  cd ..
   75  cat nginx.conf
   76  cd sites-enabled/
   77  ll
   78  cat default
   79  cd /var/www
   80  ll
   81  exit
   82  apt-get update && apt-get dist-upgrade -y
   83  apt autoremove
   84  exit
   85  ls .ssh
   86  cat .ssh/authorized_keys
   87  cat /home/iotadmin/.ssh/authorized_keys >> .ssh/authorized_keys
   88  ls .ssh
   89  ssh-keygen -t rsa
   90  l
   91  ll .ssh
   92  nano .ssh/authorized_keys
   93  exit
   94  echo Password authentication aus (auch für root user)
   95  nano /etc/ssh/sshd_config
   96  cat /var/log/dmesg
   97  cat /var/log/auth.log
   98  echo PasswordAutheticatio no
   99  apt update
  100  apt upgrade
  101  apt install nginx
  102  snap install --classic certbot
  103  certbot //help
  104  certbot --help
  105  certbot --nginx
  106  ll
  107  cd /
  108  ll
  109  cd opt
  110  mkdir vehicle
  111  l
  112  ll
  113  chown -R iotadmin:iotadmin vehicle
  114  ll
  115  cd vehicle/
  116  ll
  117  chown -R iotadmin:iotadmin docker-compose.yaml
  118  ll
  119  login iotadmin
  121  history
login with filezilla
Figure 2. Login with filezilla