integrate kontor-angular

This commit is contained in:
2026-04-19 20:05:50 +02:00
parent 57129c2d37
commit aca9a1aa4a
18 changed files with 101 additions and 20 deletions
+3 -1
View File
@@ -5,7 +5,8 @@ from fastapi import APIRouter, Body, HTTPException, status, Depends, Response
from fastapi.security import OAuth2PasswordRequestForm from fastapi.security import OAuth2PasswordRequestForm
from src.core.config import settings from src.core.config import settings
from src.core.security import create_access_token, authenticate_user_by_email, get_current_active_user from src.core.log_conf import logger
from src.core.security import create_access_token, authenticate_user_by_email, authenticate_user_by_username, get_current_active_user
from src.db.models.admin import Profile from src.db.models.admin import Profile
from src.schema.admin import Token, ProfileModel from src.schema.admin import Token, ProfileModel
from src.webapps.auth.forms import LoginForm from src.webapps.auth.forms import LoginForm
@@ -16,6 +17,7 @@ router = APIRouter()
@router.post("/token") @router.post("/token")
def login_for_access_token(form_data: Annotated[OAuth2PasswordRequestForm, Depends()]) -> Token: def login_for_access_token(form_data: Annotated[OAuth2PasswordRequestForm, Depends()]) -> Token:
user = authenticate_user_by_username(form_data.username, form_data.password) user = authenticate_user_by_username(form_data.username, form_data.password)
logger.info(f"Request /token: login with {form_data.username}")
if not user: if not user:
raise HTTPException( raise HTTPException(
status_code=status.HTTP_401_UNAUTHORIZED, status_code=status.HTTP_401_UNAUTHORIZED,
+1
View File
@@ -8,6 +8,7 @@ COPY . /app
RUN npm run build RUN npm run build
FROM docker.io/library/nginx:stable-alpine FROM docker.io/library/nginx:stable-alpine
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=build /app/dist /usr/share/nginx/html COPY --from=build /app/dist /usr/share/nginx/html
EXPOSE 80 EXPOSE 80
CMD ["nginx", "-g", "daemon off;"] CMD ["nginx", "-g", "daemon off;"]
+38
View File
@@ -0,0 +1,38 @@
server {
listen 8700;
# Root-Verzeichnis für den Server setzen (wir kopieren unsere Anwendung hierher)
root /usr/share/nginx/html;
# Definieren der Standard-Indexdatei (Angular erstellt die Datei index.html für uns und sie befindet sich im oben genannten Verzeichnis)
index index.html;
# Cache-Header für Medien-ASsets
location ~* \.(?:cur|jpe?g|gif|htc|ico|png|xml|otf|ttf|eot|woff|woff2|svg)$ {
access_log off;
add_header Pragma "must-revalidate, public";
add_header Cache-Control "must-revalidate, public";
expires max;
tcp_nodelay off;
}
# Cache-Header für HTML, CSS und JS-Dateien
location ~* \.(?:css|js|html)$ {
access_log off;
add_header Pragma "must-revalidate, public";
add_header Cache-Control "must-revalidate, public";
expires 2d;
tcp_nodelay off;
}
# Konfiguration für den /-Pfad
location / {
# Zunächst versuchen wir die angeforderte URI auzuliefern
# Klappt das nicht, versuchen wir es mit einem abschließenden Slash
# Klappt auch das nicht, liefern wir die index.html aus.
# Das ist nötig, damit Angular-Routen korrekt augeflöst und ausgeliefert werden
try_files $uri $uri/ /index.html;
}
}
+3 -3
View File
@@ -5,12 +5,12 @@ const API_URL = "http://localhost:8200/";
class AuthService { class AuthService {
login(user) { login(user) {
return axios return axios
.post(API_URL + "login", { .post(API_URL + "api/login/token", {
email: user.username, username: user.username,
password: user.password, password: user.password,
}) })
.then((response) => { .then((response) => {
if (response.data.accessToken) { if (response.data.access_token) {
localStorage.setItem("user", JSON.stringify(response.data)); localStorage.setItem("user", JSON.stringify(response.data));
} }
return response.data; return response.data;
+1 -1
View File
@@ -29,7 +29,7 @@ else
-p 8400:8400 \ -p 8400:8400 \
-p 8500:8500 \ -p 8500:8500 \
-p 8600:8600 \ -p 8600:8600 \
-p 8700:80 \ -p 8700:8700 \
-p 8800:8800 \ -p 8800:8800 \
-p 8900:8080 \ -p 8900:8080 \
-p 61616:61616 \ -p 61616:61616 \
-1
View File
@@ -9,7 +9,6 @@ cd "$(dirname "$0")/.."
echo "==> Stopping and removing pod kontor" echo "==> Stopping and removing pod kontor"
if podman pod exists kontor; then if podman pod exists kontor; then
podman pod stop kontor podman pod stop kontor
podman pod rm kontor
fi fi
script/cibuild script/cibuild
+1 -1
View File
@@ -1,6 +1,6 @@
# container-activemq.service # container-activemq.service
# autogenerated by Podman 4.9.3 # autogenerated by Podman 4.9.3
# Sun Apr 12 17:24:24 CEST 2026 # Sun Apr 19 16:28:14 CEST 2026
[Unit] [Unit]
Description=Podman container-activemq.service Description=Podman container-activemq.service
+1 -1
View File
@@ -1,6 +1,6 @@
# container-adminer.service # container-adminer.service
# autogenerated by Podman 4.9.3 # autogenerated by Podman 4.9.3
# Sun Apr 12 17:24:24 CEST 2026 # Sun Apr 19 16:28:14 CEST 2026
[Unit] [Unit]
Description=Podman container-adminer.service Description=Podman container-adminer.service
+40
View File
@@ -0,0 +1,40 @@
# container-kontor-angular.service
# autogenerated by Podman 4.9.3
# Sun Apr 19 16:28:14 CEST 2026
[Unit]
Description=Podman container-kontor-angular.service
Documentation=man:podman-generate-systemd(1)
Wants=network-online.target
After=network-online.target
RequiresMountsFor=%t/containers
BindsTo=pod-kontor.service
After=pod-kontor.service
[Service]
Environment=PODMAN_SYSTEMD_UNIT=%n
Restart=on-failure
TimeoutStopSec=70
ExecStart=/usr/bin/podman run \
--cidfile=%t/%n.ctr-id \
--cgroups=no-conmon \
--rm \
--pod-id-file %t/pod-kontor.pod-id \
--sdnotify=conmon \
-d \
--replace \
--name kontor-angular \
--label io.containers.autoupdate=local \
--label PODMAN_SYSTEMD_UNIT=container-kontor-angular.service localhost/kontor-angular:0.3.0
ExecStop=/usr/bin/podman stop \
--ignore -t 10 \
--cidfile=%t/%n.ctr-id
ExecStopPost=/usr/bin/podman rm \
-f \
--ignore -t 10 \
--cidfile=%t/%n.ctr-id
Type=notify
NotifyAccess=all
[Install]
WantedBy=default.target
+1 -1
View File
@@ -1,6 +1,6 @@
# container-kontor-api.service # container-kontor-api.service
# autogenerated by Podman 4.9.3 # autogenerated by Podman 4.9.3
# Sun Apr 12 17:24:24 CEST 2026 # Sun Apr 19 16:28:14 CEST 2026
[Unit] [Unit]
Description=Podman container-kontor-api.service Description=Podman container-kontor-api.service
+1 -1
View File
@@ -1,6 +1,6 @@
# container-kontor-echo.service # container-kontor-echo.service
# autogenerated by Podman 4.9.3 # autogenerated by Podman 4.9.3
# Sun Apr 12 17:24:24 CEST 2026 # Sun Apr 19 16:28:14 CEST 2026
[Unit] [Unit]
Description=Podman container-kontor-echo.service Description=Podman container-kontor-echo.service
+1 -1
View File
@@ -1,6 +1,6 @@
# container-kontor-fiber.service # container-kontor-fiber.service
# autogenerated by Podman 4.9.3 # autogenerated by Podman 4.9.3
# Sun Apr 12 17:24:24 CEST 2026 # Sun Apr 19 16:28:14 CEST 2026
[Unit] [Unit]
Description=Podman container-kontor-fiber.service Description=Podman container-kontor-fiber.service
+1 -1
View File
@@ -1,6 +1,6 @@
# container-kontor-javalin.service # container-kontor-javalin.service
# autogenerated by Podman 4.9.3 # autogenerated by Podman 4.9.3
# Sun Apr 12 17:24:24 CEST 2026 # Sun Apr 19 16:28:14 CEST 2026
[Unit] [Unit]
Description=Podman container-kontor-javalin.service Description=Podman container-kontor-javalin.service
+1 -1
View File
@@ -1,6 +1,6 @@
# container-kontor-quarkus.service # container-kontor-quarkus.service
# autogenerated by Podman 4.9.3 # autogenerated by Podman 4.9.3
# Sun Apr 12 17:24:24 CEST 2026 # Sun Apr 19 16:28:14 CEST 2026
[Unit] [Unit]
Description=Podman container-kontor-quarkus.service Description=Podman container-kontor-quarkus.service
+1 -1
View File
@@ -1,6 +1,6 @@
# container-kontor-spring.service # container-kontor-spring.service
# autogenerated by Podman 4.9.3 # autogenerated by Podman 4.9.3
# Sun Apr 12 17:24:24 CEST 2026 # Sun Apr 19 16:28:14 CEST 2026
[Unit] [Unit]
Description=Podman container-kontor-spring.service Description=Podman container-kontor-spring.service
+1 -1
View File
@@ -1,6 +1,6 @@
# container-kontor-vue.service # container-kontor-vue.service
# autogenerated by Podman 4.9.3 # autogenerated by Podman 4.9.3
# Sun Apr 12 17:24:24 CEST 2026 # Sun Apr 19 16:28:14 CEST 2026
[Unit] [Unit]
Description=Podman container-kontor-vue.service Description=Podman container-kontor-vue.service
+1 -1
View File
@@ -1,6 +1,6 @@
# container-postgres.service # container-postgres.service
# autogenerated by Podman 4.9.3 # autogenerated by Podman 4.9.3
# Sun Apr 12 17:24:24 CEST 2026 # Sun Apr 19 16:28:14 CEST 2026
[Unit] [Unit]
Description=Podman container-postgres.service Description=Podman container-postgres.service
+5 -4
View File
@@ -1,6 +1,6 @@
# pod-kontor.service # pod-kontor.service
# autogenerated by Podman 4.9.3 # autogenerated by Podman 4.9.3
# Sun Apr 12 17:24:24 CEST 2026 # Sun Apr 19 16:28:14 CEST 2026
[Unit] [Unit]
Description=Podman pod-kontor.service Description=Podman pod-kontor.service
@@ -8,8 +8,8 @@ Documentation=man:podman-generate-systemd(1)
Wants=network-online.target Wants=network-online.target
After=network-online.target After=network-online.target
RequiresMountsFor=/run/user/1000/containers RequiresMountsFor=/run/user/1000/containers
Wants=container-activemq.service container-adminer.service container-kontor-api.service container-kontor-echo.service container-kontor-fiber.service container-kontor-javalin.service container-kontor-quarkus.service container-kontor-spring.service container-kontor-vue.service container-postgres.service Wants=container-activemq.service container-adminer.service container-kontor-angular.service container-kontor-api.service container-kontor-echo.service container-kontor-fiber.service container-kontor-javalin.service container-kontor-quarkus.service container-kontor-spring.service container-kontor-vue.service container-postgres.service
Before=container-activemq.service container-adminer.service container-kontor-api.service container-kontor-echo.service container-kontor-fiber.service container-kontor-javalin.service container-kontor-quarkus.service container-kontor-spring.service container-kontor-vue.service container-postgres.service Before=container-activemq.service container-adminer.service container-kontor-angular.service container-kontor-api.service container-kontor-echo.service container-kontor-fiber.service container-kontor-javalin.service container-kontor-quarkus.service container-kontor-spring.service container-kontor-vue.service container-postgres.service
[Service] [Service]
Environment=PODMAN_SYSTEMD_UNIT=%n Environment=PODMAN_SYSTEMD_UNIT=%n
@@ -28,7 +28,8 @@ ExecStartPre=/usr/bin/podman pod create \
-p 8400:8400 \ -p 8400:8400 \
-p 8500:8500 \ -p 8500:8500 \
-p 8600:8600 \ -p 8600:8600 \
-p 8700:80 \ -p 8700:8700 \
-p 8800:8800 \
-p 8900:8080 \ -p 8900:8080 \
-p 61616:61616 \ -p 61616:61616 \
-p 8161:8161 \ -p 8161:8161 \