From 850cdd3e4c49f089a11cae8f575167427ac41c73 Mon Sep 17 00:00:00 2001 From: Hans-Christian Payer Date: Fri, 26 Jun 2026 09:18:42 +0200 Subject: [PATCH] readme angepasst --- README.md | 66 +++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 52 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 49da370..f6d3fed 100644 --- a/README.md +++ b/README.md @@ -75,27 +75,59 @@ location /api/assets/ { ### Voraussetzungen -- Node.js 20 LTS -- Angular CLI 17.x (`npm install -g @angular/cli`) +- Node.js 20 LTS (via nvm empfohlen) +- Angular CLI 21.x (`npm install -g @angular/cli`) - Docker + Docker Compose auf dem Zielhost (Synology NAS) -### Production Build +### Node.js installieren (einmalig) ```bash -# 1. Dependencies installieren (einmalig nach Clone) -npm install +# nvm installieren +curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash +source ~/.bashrc -# 2. Production Build -ng build +# Node 20 LTS installieren und als Default setzen +nvm install 20 +nvm alias default 20 -# Output: dist/ang-university-httpclient/browser/ +# Angular CLI installieren +npm install -g @angular/cli ``` -### Deploy auf NAS +### Ersteinrichtung nach Clone ```bash +# Debian-ng aus dem Weg räumen (falls vorhanden) +sudo mv /usr/bin/ng /usr/bin/ng-editor + +# Dependencies installieren +npm install + +# Dev-Proxy einrichten +cp proxy.conf.example.json proxy.conf.json +# Token in proxy.conf.json eintragen +``` + +### Production Build & Deploy + +```bash +./deploy.sh +``` + +Das Script führt `ng build` aus und überträgt den Build via rsync auf den NAS. + +```bash +#!/bin/bash +set -e + +echo "==> Build..." +ng build + +echo "==> Deploy..." rsync -av --delete dist/ang-university-httpclient/browser/ \ hans@nas.neugasse.lan:/volume1/docker/landingpage/dist/ + +echo "==> Fertig." ``` ### Docker-Container starten @@ -111,7 +143,7 @@ Der Container lauscht auf Port `9999` und wird vom Nginx Proxy Manager nach auß ## Lokale Entwicklung -### Dev-Proxy einrichten +### Dev-Proxy `proxy.conf.json` wird nicht ins Repository committed (siehe `.gitignore`). Vorlage kopieren und Token eintragen: @@ -121,13 +153,16 @@ cp proxy.conf.example.json proxy.conf.json # Token eintragen ``` +Der Proxy ist in `angular.json` unter `serve.options.proxyConfig` eingetragen. + ### Dev-Server starten ```bash ng serve ``` -Der Proxy ist in `angular.json` unter `serve.options.proxyConfig` eingetragen und wird automatisch verwendet. +Der Directus-Token wird über `proxy.conf.json` injiziert — nicht im Code hinterlegt. +`src/environments/environment.ts` ist ebenfalls in `.gitignore` und wird nicht committed. --- @@ -157,11 +192,13 @@ Weitere Steckdosen können im `sockets`-Array in `tasmota.service.ts` ergänzt w │ │ ├── links.ts # Interfaces: Links, LinksResponse │ │ └── socket.interface.ts # Interface: TasmotaSocket │ └── environments/ -│ ├── environment.ts # Dev -│ └── environment.prod.ts # Prod +│ ├── environment.ts # Dev (in .gitignore) +│ ├── environment.example.ts # Vorlage ohne Token +│ └── environment.prod.ts # Prod (kein Token) ├── webserver-docker/ │ ├── docker-compose.yml # nginx:stable-alpine, Port 9999 │ └── nginx.conf # SPA-Routing, Gzip, Cache-Header +├── deploy.sh # Build + Deploy auf NAS ├── proxy.conf.example.json # Dev-Proxy Vorlage (ohne Token) └── apacheconfs/ # Veraltet — nicht mehr verwendet ``` @@ -173,5 +210,6 @@ Weitere Steckdosen können im `sockets`-Array in `tasmota.service.ts` ergänzt w ## Sicherheitshinweise - Der Directus API-Token gehört **ausschließlich** in die NPM-Konfiguration — nie in den Quellcode oder ins Repository -- `proxy.conf.json` ist in `.gitignore` eingetragen und wird nicht committed +- `proxy.conf.json` und `environment.ts` sind in `.gitignore` eingetragen und werden nicht committed - Tasmota-Geräte sind nur im LAN erreichbar (`*.neugasse.lan`) +- Directus-Items müssen auf `published` gesetzt sein, damit die API sie ohne zusätzliche Filter liefert