From c1c92d1169a536393a22675c01b517c4e17e86a7 Mon Sep 17 00:00:00 2001 From: Bjoern Runden Date: Fri, 11 Sep 2026 12:14:23 +0200 Subject: [PATCH 1/3] env-raus --- .env => env-sample | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .env => env-sample (100%) diff --git a/.env b/env-sample similarity index 100% rename from .env rename to env-sample From 96c9ceafc161d71fe2fdf96e62901570031ca0e9 Mon Sep 17 00:00:00 2001 From: Bjoern Runden Date: Fri, 11 Sep 2026 15:01:51 +0200 Subject: [PATCH 2/3] =?UTF-8?q?kleinigkeiten=20f=C3=BCr=20deploy=20prozess?= =?UTF-8?q?...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 ++ App_Server/Dockerfile | 4 +-- NGINX_Server/Dockerfile | 28 ++++++++++++++++--- docker-compose.base.yaml | 60 +++++++++++++++++++--------------------- docker-compose.dev.yaml | 43 +++++++++++++++------------- shenv.sh | 7 +++++ 6 files changed, 87 insertions(+), 57 deletions(-) create mode 100755 shenv.sh diff --git a/.gitignore b/.gitignore index bb63d26..26953de 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,5 @@ node_modules tsout kbp_crm*.js App_Server/data/ +.env +kbcrm \ No newline at end of file diff --git a/App_Server/Dockerfile b/App_Server/Dockerfile index e1d0023..1ccabe6 100644 --- a/App_Server/Dockerfile +++ b/App_Server/Dockerfile @@ -52,8 +52,8 @@ RUN curl -fsSL https://deb.nodesource.com/setup_${NODE_VERSION}.x | bash - && \ # --- 9. TypeScript + Rollup installieren --- # Das Script inittypescriptdev.sh wird in der Entwicklungsumgebung ausgeführt, um die TypeScript-Umgebung zu initialisieren. # Daher ist es nicht notwendig, es hier zu kopieren und auszuführen. -# COPY ./scripts/inittypescriptdev.sh /usr/opt/pythonapp/App_Server/scripts/inittypescriptdev.sh -# RUN chmod +x /usr/opt/pythonapp/App_Server/scripts/inittypescriptdev.sh +#COPY ./scripts/inittypescriptdev.sh /usr/opt/pythonapp/App_Server/scripts/inittypescriptdev.sh +#RUN chmod +x /usr/opt/pythonapp/App_Server/scripts/inittypescriptdev.sh ENTRYPOINT ["sh", "/usr/opt/pythonapp/App_Server/scripts/inittypescriptdev.sh"] CMD ["/usr/opt/pythonapp/env/bin/python", "root/runserver.py", "-D"] diff --git a/NGINX_Server/Dockerfile b/NGINX_Server/Dockerfile index c4da972..e2956a5 100644 --- a/NGINX_Server/Dockerfile +++ b/NGINX_Server/Dockerfile @@ -1,4 +1,24 @@ -ARG NGINX_VERSION -FROM nginx:${NGINX_VERSION} -RUN ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime -RUN mkdir /etc/certs \ No newline at end of file +ARG NGINX_VERSION + +# --- Stage 1: Build the Client (TypeScript -> JS) --- +FROM node:18-slim AS client-builder +WORKDIR /usr/opt/pythonapp + +# Wir brauchen die Projekt-Dateien +COPY Client/ ./Client/ +COPY App_Server/ ./App_Server/ +COPY NGINX_Server/ ./NGINX_Server/ + +# Abhängigkeiten installieren und bauen +WORKDIR /usr/opt/pythonapp/Client +RUN npm install +RUN npx tsc && npx rollup -c + +# --- Stage 2: NGINX Server (Final Image) --- +FROM nginx:${NGINX_VERSION} + +RUN ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime +RUN mkdir /etc/certs + +# Statischen HTML-Ordner inklusive des frischen JS aus Stage 1 kopieren +COPY --from=client-builder /usr/opt/pythonapp/NGINX_Server/html /usr/share/nginx/html diff --git a/docker-compose.base.yaml b/docker-compose.base.yaml index 2142ece..1fc0555 100644 --- a/docker-compose.base.yaml +++ b/docker-compose.base.yaml @@ -1,32 +1,28 @@ -name: kbpbase -services: - nginx-proxy: - build: - context: NGINX_Server - args: # Übergibt die ARGS an das dockerfile - NGINX_VERSION: ${NGINX_VERSION} - - ports: - - ${NGINX_HOST_PORT}:4430 - volumes: - - ${NGINX_STATIC_DIR}:/usr/share/nginx/html:ro - - ${NGINX_CONFIG_TEMPLATE_DIR}:/etc/nginx/templates - - ${NGINX_CERTS}:/etc/certs - environment: - - NGINX_CERT=${NGINX_CERT} - - NGINX_CERT_KEY=${NGINX_CERT_KEY} - - NGINX_SERVER_NAME=${NGINX_SERVER_NAME} - pythonapp: - build: - context: App_Server - # target: kommt aus dem prod oder dev dockerfile - args: # Übergibt die ARGS an das dockerfile - PYTHON_VERSION: ${PYTHON_VERSION} - volumes: - #- ${PYTHON_APP_DIR}:/usr/opt/pythonapp/root - - ${PYTHON_DB_DIR}:/usr/var/pythonappdb - - python-venv:/usr/opt/pythonapp/env - # - ${PYTHON_ENV_DIR}:/usr/opt/pythonapp/env - -volumes: - python-venv: \ No newline at end of file +name: kbpbase +services: + nginx-proxy: + build: + context: . # Build context im root, damit Client/ und NGINX_Server/ verfügbar sind + dockerfile: NGINX_Server/Dockerfile + args: + NGINX_VERSION: ${NGINX_VERSION} + ports: + - ${NGINX_HOST_PORT}:4430 + volumes: + - ${NGINX_CONFIG_TEMPLATE_DIR}:/etc/nginx/templates + - ${NGINX_CERTS}:/etc/certs + env_file: + - .env + pythonapp: + build: + context: App_Server + args: + PYTHON_VERSION: ${PYTHON_VERSION} + env_file: + - .env + volumes: + - ${PYTHON_DB_DIR}:/usr/var/pythonappdb + - python-venv:/usr/opt/pythonapp/env + +volumes: + python-venv: diff --git a/docker-compose.dev.yaml b/docker-compose.dev.yaml index d139892..ee3fb93 100644 --- a/docker-compose.dev.yaml +++ b/docker-compose.dev.yaml @@ -1,19 +1,24 @@ -name: kbpdev -services: - pythonapp: - extends: - file: docker-compose.base.yaml - service: pythonapp - build: - target: dev - args: # Übergibt die ARGS an das dockerfile - # PYTHON_VERSION: ${PYTHON_VERSION} - NODE_VERSION: ${NODE_VERSION:-18} - NPM_VERSION: ${NPM_VERSION:-8} - volumes: - - ${PYTHON_DEV_DIR}:/usr/opt/pythonapp - # - ${TYPESCRIPT_SRC_DIR}:/usr/opt/typescript - - node-modules:/usr/opt/typescript/node_modules - -volumes: - node-modules: \ No newline at end of file +name: kbpdev +services: + nginx-proxy: + extends: + file: docker-compose.base.yaml + service: nginx-proxy + volumes: + - ${NGINX_STATIC_DIR}:/usr/share/nginx/html:ro + + pythonapp: + extends: + file: docker-compose.base.yaml + service: pythonapp + build: + target: dev + args: + NODE_VERSION: ${NODE_VERSION:-18} + NPM_VERSION: ${NPM_VERSION:-8} + volumes: + - ${PYTHON_DEV_DIR}:/usr/opt/pythonapp + - node-modules:/usr/opt/typescript/node_modules + +volumes: + node-modules: diff --git a/shenv.sh b/shenv.sh new file mode 100755 index 0000000..77ff724 --- /dev/null +++ b/shenv.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +# legt variablen zur Laufzeit fest. +source ./.env +local env="${BUILD_ENVIRONMENT:-dev}" +echo "$env umbgebung wird gesetzt" +export COMPOSE_FILE="./docker-compose.base.yaml:./docker-compose.${env}.yaml" +echo "jetzt einfach docker compose [build | up | down | logs] ausführen" \ No newline at end of file From bdb43292401da84c500a46a250ad0300efdfcfa2 Mon Sep 17 00:00:00 2001 From: Bjoern Runden Date: Fri, 11 Sep 2026 15:15:44 +0200 Subject: [PATCH 3/3] oidc sample compose stack files in .env --- env-sample | 38 ++++++++++++++++++++++++++++++++++++++ shenv.sh | 7 ------- 2 files changed, 38 insertions(+), 7 deletions(-) delete mode 100755 shenv.sh diff --git a/env-sample b/env-sample index e1cd840..c08643d 100644 --- a/env-sample +++ b/env-sample @@ -18,3 +18,41 @@ PYTHON_DB_DIR=/home/schoschi/Entwicklung/Projekte_Runden/kbcrm/App_Server/data # Parameter für Dev-Mode (Development-Container für VS-Code) NODE_VERSION=lts NPM_VERSION=latest + +# welche Umgebung? (prod,dev) +BUILD_ENVIRONMENT=dev +COMPOSE_FILE=docker-compose.base.yaml:docker-compose.${BUILD_ENVIRONMENT}.yaml + +# ============================================================================= +# ZITADEL OIDC SETTINGS +# ============================================================================= + +# Zitadel Issuer URL (OIDC Provider) +# Example: https://your-zitadel-instance.zitadel.cloud +ZITADEL_ISSUER=https://id.vmlx.de + +# OIDC Client ID from Zitadel +ZITADEL_CLIENT_ID=###client## + +# OIDC Client Secret from Zitadel # not for PKCE +ZITADEL_CLIENT_SECRET=####secret ### + +# Redirect URI for OIDC callback +# Default: http://localhost:5000/auth/callback +#ZITADEL_REDIRECT_URI=http://localhost:8000/auth/callback +ZITADEL_REDIRECT_URI=https://kbp_crm.mylocal.de/auth/callback + +# OIDC Scopes (comma-separated) +ZITADEL_SCOPES=openid,profile,email + +# ============================================================================= +# EMAIL SETTINGS (for notifications) +# ============================================================================= + +# SMTP Server +# SMTP_SERVER=localhost +# SMTP_PORT=587 +# SMTP_USERNAME= +# SMTP_PASSWORD= +# SMTP_USE_TLS=true +# EMAIL_FROM=formeleon@yourdomain.com \ No newline at end of file diff --git a/shenv.sh b/shenv.sh deleted file mode 100755 index 77ff724..0000000 --- a/shenv.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash -# legt variablen zur Laufzeit fest. -source ./.env -local env="${BUILD_ENVIRONMENT:-dev}" -echo "$env umbgebung wird gesetzt" -export COMPOSE_FILE="./docker-compose.base.yaml:./docker-compose.${env}.yaml" -echo "jetzt einfach docker compose [build | up | down | logs] ausführen" \ No newline at end of file