readme angepasst
This commit is contained in:
@@ -75,27 +75,59 @@ location /api/assets/ {
|
|||||||
|
|
||||||
### Voraussetzungen
|
### Voraussetzungen
|
||||||
|
|
||||||
- Node.js 20 LTS
|
- Node.js 20 LTS (via nvm empfohlen)
|
||||||
- Angular CLI 17.x (`npm install -g @angular/cli`)
|
- Angular CLI 21.x (`npm install -g @angular/cli`)
|
||||||
- Docker + Docker Compose auf dem Zielhost (Synology NAS)
|
- Docker + Docker Compose auf dem Zielhost (Synology NAS)
|
||||||
|
|
||||||
### Production Build
|
### Node.js installieren (einmalig)
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# 1. Dependencies installieren (einmalig nach Clone)
|
# nvm installieren
|
||||||
npm install
|
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
|
||||||
|
source ~/.bashrc
|
||||||
|
|
||||||
# 2. Production Build
|
# Node 20 LTS installieren und als Default setzen
|
||||||
ng build
|
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
|
```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/ \
|
rsync -av --delete dist/ang-university-httpclient/browser/ \
|
||||||
hans@nas.neugasse.lan:/volume1/docker/landingpage/dist/
|
hans@nas.neugasse.lan:/volume1/docker/landingpage/dist/
|
||||||
|
|
||||||
|
echo "==> Fertig."
|
||||||
```
|
```
|
||||||
|
|
||||||
### Docker-Container starten
|
### Docker-Container starten
|
||||||
@@ -111,7 +143,7 @@ Der Container lauscht auf Port `9999` und wird vom Nginx Proxy Manager nach auß
|
|||||||
|
|
||||||
## Lokale Entwicklung
|
## Lokale Entwicklung
|
||||||
|
|
||||||
### Dev-Proxy einrichten
|
### Dev-Proxy
|
||||||
|
|
||||||
`proxy.conf.json` wird nicht ins Repository committed (siehe `.gitignore`).
|
`proxy.conf.json` wird nicht ins Repository committed (siehe `.gitignore`).
|
||||||
Vorlage kopieren und Token eintragen:
|
Vorlage kopieren und Token eintragen:
|
||||||
@@ -121,13 +153,16 @@ cp proxy.conf.example.json proxy.conf.json
|
|||||||
# Token eintragen
|
# Token eintragen
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Der Proxy ist in `angular.json` unter `serve.options.proxyConfig` eingetragen.
|
||||||
|
|
||||||
### Dev-Server starten
|
### Dev-Server starten
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
ng serve
|
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
|
│ │ ├── links.ts # Interfaces: Links, LinksResponse
|
||||||
│ │ └── socket.interface.ts # Interface: TasmotaSocket
|
│ │ └── socket.interface.ts # Interface: TasmotaSocket
|
||||||
│ └── environments/
|
│ └── environments/
|
||||||
│ ├── environment.ts # Dev
|
│ ├── environment.ts # Dev (in .gitignore)
|
||||||
│ └── environment.prod.ts # Prod
|
│ ├── environment.example.ts # Vorlage ohne Token
|
||||||
|
│ └── environment.prod.ts # Prod (kein Token)
|
||||||
├── webserver-docker/
|
├── webserver-docker/
|
||||||
│ ├── docker-compose.yml # nginx:stable-alpine, Port 9999
|
│ ├── docker-compose.yml # nginx:stable-alpine, Port 9999
|
||||||
│ └── nginx.conf # SPA-Routing, Gzip, Cache-Header
|
│ └── nginx.conf # SPA-Routing, Gzip, Cache-Header
|
||||||
|
├── deploy.sh # Build + Deploy auf NAS
|
||||||
├── proxy.conf.example.json # Dev-Proxy Vorlage (ohne Token)
|
├── proxy.conf.example.json # Dev-Proxy Vorlage (ohne Token)
|
||||||
└── apacheconfs/ # Veraltet — nicht mehr verwendet
|
└── apacheconfs/ # Veraltet — nicht mehr verwendet
|
||||||
```
|
```
|
||||||
@@ -173,5 +210,6 @@ Weitere Steckdosen können im `sockets`-Array in `tasmota.service.ts` ergänzt w
|
|||||||
## Sicherheitshinweise
|
## Sicherheitshinweise
|
||||||
|
|
||||||
- Der Directus API-Token gehört **ausschließlich** in die NPM-Konfiguration — nie in den Quellcode oder ins Repository
|
- 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`)
|
- 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
|
||||||
|
|||||||
Reference in New Issue
Block a user