Installation aktualisiert
parent
d158bad84f
commit
d6eff3cc50
1 changed files with 99 additions and 66 deletions
165
Installation.md
165
Installation.md
|
|
@ -2,6 +2,44 @@
|
||||||
|
|
||||||
**Lua API-Gateway für digitale Souveränität**
|
**Lua API-Gateway für digitale Souveränität**
|
||||||
|
|
||||||
|
## Source-Code beschaffen
|
||||||
|
|
||||||
|
### Git-Repository clonen
|
||||||
|
|
||||||
|
furt-Quellen aus dem Dragons@Work-Repository beschaffen:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Repository clonen
|
||||||
|
git clone https://smida.dragons-at-work.de/DAW/furt.git /tmp/furt-source
|
||||||
|
cd /tmp/furt-source
|
||||||
|
```
|
||||||
|
|
||||||
|
**Repository-Struktur validieren:**
|
||||||
|
```bash
|
||||||
|
# Erforderliche Verzeichnisse prüfen
|
||||||
|
ls -la src/main.lua config/furt.conf.example scripts/start.sh integrations/
|
||||||
|
|
||||||
|
# Erwartete Struktur:
|
||||||
|
# src/ - Lua-Quellcode
|
||||||
|
# config/ - Konfigurationsbeispiele
|
||||||
|
# scripts/ - Helper-Scripts (start.sh)
|
||||||
|
# integrations/ - merkwerk-Integration
|
||||||
|
# docs/ - Dokumentation
|
||||||
|
# VERSION - Versions-Information
|
||||||
|
```
|
||||||
|
|
||||||
|
**Git-Installation falls erforderlich:**
|
||||||
|
|
||||||
|
*OpenBSD:*
|
||||||
|
```bash
|
||||||
|
doas pkg_add git
|
||||||
|
```
|
||||||
|
|
||||||
|
*Debian/Ubuntu:*
|
||||||
|
```bash
|
||||||
|
apt install git
|
||||||
|
```
|
||||||
|
|
||||||
## Systemanforderungen verstehen
|
## Systemanforderungen verstehen
|
||||||
|
|
||||||
### Lua-Runtime Anforderungen
|
### Lua-Runtime Anforderungen
|
||||||
|
|
@ -68,26 +106,39 @@ Lua sucht Module über `LUA_PATH`-Environment-Variable. furt erweitert Standard-
|
||||||
|
|
||||||
**Pfad-Auflösung:**
|
**Pfad-Auflösung:**
|
||||||
1. Aktuelle Verzeichnis (`./config.server` für Development)
|
1. Aktuelle Verzeichnis (`./config.server` für Development)
|
||||||
2. furt-Module (`/usr/local/share/furt/?.lua`)
|
2. furt-Module (`/usr/local/share/furt/?.lua`)
|
||||||
3. System-Lua-Module (Standard-Pfade)
|
3. System-Lua-Module (Standard-Pfade)
|
||||||
|
|
||||||
## Schritt-für-Schritt Installation
|
## Schritt-für-Schritt Installation
|
||||||
|
|
||||||
### 1. Systemanforderungen prüfen
|
### 1. Systemanforderungen prüfen
|
||||||
|
|
||||||
**Lua-Installation validieren:**
|
**Lua-Installation validieren mit automatischer Command-Detection:**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Lua 5.1 verfügbar?
|
# Lua-Command erkennen (plattformspezifisch)
|
||||||
lua5.1 -v
|
if command -v lua5.1 >/dev/null 2>&1; then
|
||||||
|
LUA_CMD="lua5.1"
|
||||||
|
elif command -v lua >/dev/null 2>&1; then
|
||||||
|
LUA_CMD="lua"
|
||||||
|
else
|
||||||
|
echo "Kein Lua gefunden"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Lua-Version prüfen
|
||||||
|
$LUA_CMD -v
|
||||||
|
|
||||||
# Erwartete Ausgabe:
|
# Erwartete Ausgabe:
|
||||||
# Lua 5.1.5 Copyright (C) 1994-2012 Lua.org, PUC-Rio
|
# Lua 5.1.5 Copyright (C) 1994-2012 Lua.org, PUC-Rio
|
||||||
|
|
||||||
# Required modules testen
|
# Required modules testen
|
||||||
lua5.1 -e "require('socket')"
|
$LUA_CMD -e "require('socket')"
|
||||||
lua5.1 -e "require('cjson')"
|
$LUA_CMD -e "require('cjson')"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**Warum Command-Detection:** OpenBSD installiert Lua als `lua`, Linux-Distributionen oft als `lua5.1`.
|
||||||
|
|
||||||
**Fehlende Module installieren:**
|
**Fehlende Module installieren:**
|
||||||
|
|
||||||
*Arch Linux:*
|
*Arch Linux:*
|
||||||
|
|
@ -138,7 +189,7 @@ chown _furt:_furt /var/log/furt
|
||||||
*Linux:*
|
*Linux:*
|
||||||
```bash
|
```bash
|
||||||
mkdir -p /etc/furt
|
mkdir -p /etc/furt
|
||||||
mkdir -p /usr/local/share/furt
|
mkdir -p /usr/local/share/furt
|
||||||
mkdir -p /var/log/furt
|
mkdir -p /var/log/furt
|
||||||
chown furt:furt /var/log/furt
|
chown furt:furt /var/log/furt
|
||||||
```
|
```
|
||||||
|
|
@ -147,9 +198,13 @@ chown furt:furt /var/log/furt
|
||||||
|
|
||||||
**Source-Code kopieren:**
|
**Source-Code kopieren:**
|
||||||
```bash
|
```bash
|
||||||
|
# In furt-source-Verzeichnis (aus Schritt 0)
|
||||||
|
cd /tmp/furt-source
|
||||||
|
|
||||||
# Haupt-Bibliothek installieren
|
# Haupt-Bibliothek installieren
|
||||||
cp -r src/ /usr/local/share/furt/
|
cp -r src/ /usr/local/share/furt/
|
||||||
cp -r config/ /usr/local/share/furt/
|
cp -r config/ /usr/local/share/furt/
|
||||||
|
cp -r scripts/ /usr/local/share/furt/
|
||||||
cp -r integrations/ /usr/local/share/furt/
|
cp -r integrations/ /usr/local/share/furt/
|
||||||
|
|
||||||
# Versions-Dateien für merkwerk-Integration
|
# Versions-Dateien für merkwerk-Integration
|
||||||
|
|
@ -161,47 +216,31 @@ chown -R root:wheel /usr/local/share/furt # OpenBSD/FreeBSD
|
||||||
chown -R root:root /usr/local/share/furt # Linux
|
chown -R root:root /usr/local/share/furt # Linux
|
||||||
chmod -R 644 /usr/local/share/furt
|
chmod -R 644 /usr/local/share/furt
|
||||||
find /usr/local/share/furt -type d -exec chmod 755 {} \;
|
find /usr/local/share/furt -type d -exec chmod 755 {} \;
|
||||||
|
chmod +x /usr/local/share/furt/scripts/start.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
### 4. Startup-Script erstellen
|
**Warum scripts/ inkludieren:** Das `start.sh`-Script löst Service-vs-Interactive-Detection und Lua-Command-Erkennung.
|
||||||
|
|
||||||
**Wrapper-Script für Lua-Pfad-Management:**
|
### 4. Startup-Script konfigurieren
|
||||||
|
|
||||||
|
**furt nutzt das integrierte `start.sh`-Script für plattformspezifische Anpassungen:**
|
||||||
|
|
||||||
*OpenBSD/FreeBSD* - `/usr/local/bin/furt`:
|
|
||||||
```bash
|
```bash
|
||||||
#!/bin/sh
|
# start.sh-Funktionalität testen
|
||||||
# furt HTTP API-Gateway
|
|
||||||
|
|
||||||
# Lua-Module-Pfad für furt erweitern
|
|
||||||
export LUA_PATH="/usr/local/share/furt/?.lua;;"
|
|
||||||
|
|
||||||
# Working Directory für relative Pfade
|
|
||||||
cd /usr/local/share/furt
|
cd /usr/local/share/furt
|
||||||
|
./scripts/start.sh
|
||||||
|
|
||||||
# Lua-Interpreter mit main.lua starten
|
# Erwartete Ausgabe:
|
||||||
exec lua5.1 src/main.lua "$@"
|
# Auto-detected lua command: lua
|
||||||
|
# Furt HTTP-Server started on 127.0.0.1:7811
|
||||||
|
# [...]
|
||||||
```
|
```
|
||||||
|
|
||||||
*Linux* - `/usr/local/bin/furt`:
|
**Warum start.sh statt direkter Lua-Aufruf:**
|
||||||
```bash
|
- Automatische Lua-Command-Detection (lua vs lua5.1)
|
||||||
#!/bin/bash
|
- Service-vs-Interactive-Mode-Erkennung
|
||||||
# furt HTTP API-Gateway
|
- Plattformspezifische Pfad-Anpassungen
|
||||||
|
- Robuste Daemon-Integration
|
||||||
# Lua-Module-Pfad für furt erweitern
|
|
||||||
export LUA_PATH="/usr/local/share/furt/?.lua;;"
|
|
||||||
|
|
||||||
# Working Directory für relative Pfade
|
|
||||||
cd /usr/local/share/furt
|
|
||||||
|
|
||||||
# Lua-Interpreter mit main.lua starten
|
|
||||||
exec lua5.1 src/main.lua "$@"
|
|
||||||
```
|
|
||||||
|
|
||||||
```bash
|
|
||||||
chmod +x /usr/local/bin/furt
|
|
||||||
```
|
|
||||||
|
|
||||||
**Warum ein Wrapper-Script:** Lua benötigt explizite Pfad-Konfiguration für Module-Erkennung. Das Script setzt `LUA_PATH` ohne globale Environment-Änderungen.
|
|
||||||
|
|
||||||
### 5. Konfiguration verstehen
|
### 5. Konfiguration verstehen
|
||||||
|
|
||||||
|
|
@ -225,7 +264,7 @@ log_level = info
|
||||||
|
|
||||||
[smtp_default]
|
[smtp_default]
|
||||||
host = mail.dragons-at-work.de
|
host = mail.dragons-at-work.de
|
||||||
port = 465
|
port = 465
|
||||||
user = noreply@dragons-at-work.de
|
user = noreply@dragons-at-work.de
|
||||||
password = smtp-password-hier-eintragen
|
password = smtp-password-hier-eintragen
|
||||||
use_ssl = true
|
use_ssl = true
|
||||||
|
|
@ -240,7 +279,7 @@ mail_from = noreply@dragons-at-work.de
|
||||||
mail_subject_prefix = "[DAW] "
|
mail_subject_prefix = "[DAW] "
|
||||||
|
|
||||||
# Monitoring ohne Mail-Weiterleitung
|
# Monitoring ohne Mail-Weiterleitung
|
||||||
[api_key "monitoring-health-key"]
|
[api_key "monitoring-health-key"]
|
||||||
name = "Monitoring Service"
|
name = "Monitoring Service"
|
||||||
permissions = health:check
|
permissions = health:check
|
||||||
allowed_ips = 127.0.0.1, 10.0.0.0/8
|
allowed_ips = 127.0.0.1, 10.0.0.0/8
|
||||||
|
|
@ -261,7 +300,7 @@ chown root:_furt /usr/local/etc/furt/furt.conf
|
||||||
|
|
||||||
*Linux:*
|
*Linux:*
|
||||||
```bash
|
```bash
|
||||||
chmod 640 /etc/furt/furt.conf
|
chmod 640 /etc/furt/furt.conf
|
||||||
chown root:furt /etc/furt/furt.conf
|
chown root:furt /etc/furt/furt.conf
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -273,7 +312,7 @@ chmod 644 /usr/local/etc/furt/furt.conf # OpenBSD/FreeBSD
|
||||||
chmod 644 /etc/furt/furt.conf # Linux
|
chmod 644 /etc/furt/furt.conf # Linux
|
||||||
|
|
||||||
# Nach Testing wieder sichern
|
# Nach Testing wieder sichern
|
||||||
chmod 640 /usr/local/etc/furt/furt.conf # OpenBSD/FreeBSD
|
chmod 640 /usr/local/etc/furt/furt.conf # OpenBSD/FreeBSD
|
||||||
chmod 640 /etc/furt/furt.conf # Linux
|
chmod 640 /etc/furt/furt.conf # Linux
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -282,32 +321,26 @@ chmod 640 /etc/furt/furt.conf # Linux
|
||||||
# OpenBSD/FreeBSD
|
# OpenBSD/FreeBSD
|
||||||
doas -u _furt /usr/local/share/furt/scripts/start.sh
|
doas -u _furt /usr/local/share/furt/scripts/start.sh
|
||||||
|
|
||||||
# Linux
|
# Linux
|
||||||
sudo -u furt /usr/local/share/furt/scripts/start.sh
|
sudo -u furt /usr/local/share/furt/scripts/start.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
### 6. Service-Integration
|
### 6. Service-Integration
|
||||||
|
|
||||||
**OpenBSD rc.d-Script** - `/etc/rc.d/furt`:
|
**OpenBSD rc.d-Script aus Repository-Template:**
|
||||||
```bash
|
|
||||||
#!/bin/ksh
|
|
||||||
|
|
||||||
daemon="/usr/local/bin/furt"
|
|
||||||
daemon_flags=""
|
|
||||||
daemon_user="_furt"
|
|
||||||
daemon_logger="daemon.info"
|
|
||||||
|
|
||||||
. /etc/rc.d/rc.subr
|
|
||||||
|
|
||||||
rc_cmd $1
|
|
||||||
```
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
# Template aus Repository verwenden
|
||||||
|
cp deployment/openbsd/rc.d-furt /etc/rc.d/furt
|
||||||
chmod +x /etc/rc.d/furt
|
chmod +x /etc/rc.d/furt
|
||||||
echo "furt_flags=" >> /etc/rc.conf.local
|
echo "furt_flags=" >> /etc/rc.conf.local
|
||||||
rcctl enable furt
|
rcctl enable furt
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**Das Template `deployment/openbsd/rc.d-furt` enthält:**
|
||||||
|
- Service-vs-Interactive-Detection über `start.sh`
|
||||||
|
- Korrekte Daemon-Konfiguration für OpenBSD
|
||||||
|
- Prozess-Pattern für `rcctl`-Integration
|
||||||
|
|
||||||
**Linux systemd-Unit** - `/etc/systemd/system/furt.service`:
|
**Linux systemd-Unit** - `/etc/systemd/system/furt.service`:
|
||||||
```ini
|
```ini
|
||||||
[Unit]
|
[Unit]
|
||||||
|
|
@ -318,12 +351,12 @@ After=network.target
|
||||||
Type=simple
|
Type=simple
|
||||||
User=furt
|
User=furt
|
||||||
Group=furt
|
Group=furt
|
||||||
ExecStart=/usr/local/bin/furt
|
ExecStart=/usr/local/share/furt/scripts/start.sh start
|
||||||
|
WorkingDirectory=/usr/local/share/furt
|
||||||
Restart=always
|
Restart=always
|
||||||
RestartSec=5
|
RestartSec=5
|
||||||
StandardOutput=journal
|
StandardOutput=journal
|
||||||
StandardError=journal
|
StandardError=journal
|
||||||
WorkingDirectory=/usr/local/share/furt
|
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
|
@ -381,7 +414,7 @@ curl http://127.0.0.1:7811/health
|
||||||
|
|
||||||
**Was diese Response bedeutet:**
|
**Was diese Response bedeutet:**
|
||||||
- `merkwerk_integrated: true` - Versions-Tracking funktioniert
|
- `merkwerk_integrated: true` - Versions-Tracking funktioniert
|
||||||
- `smtp_configured: true` - SMTP-Konfiguration erkannt
|
- `smtp_configured: true` - SMTP-Konfiguration erkannt
|
||||||
- `content_hash` - Eindeutige Code-Identifikation für Integritäts-Prüfung
|
- `content_hash` - Eindeutige Code-Identifikation für Integritäts-Prüfung
|
||||||
|
|
||||||
### Mail-Funktionalität testen
|
### Mail-Funktionalität testen
|
||||||
|
|
@ -392,7 +425,7 @@ curl -X POST http://127.0.0.1:7811/v1/mail/send \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d '{
|
-d '{
|
||||||
"name": "Installation Test",
|
"name": "Installation Test",
|
||||||
"email": "test@example.com",
|
"email": "test@example.com",
|
||||||
"subject": "furt Installation erfolgreich",
|
"subject": "furt Installation erfolgreich",
|
||||||
"message": "Das furt API-Gateway ist betriebsbereit."
|
"message": "Das furt API-Gateway ist betriebsbereit."
|
||||||
}'
|
}'
|
||||||
|
|
@ -455,7 +488,7 @@ mail_from = noreply@kunde-server.com
|
||||||
# Überschreibt smtp_default-Einstellungen
|
# Überschreibt smtp_default-Einstellungen
|
||||||
mail_smtp_host = mail.kunde-server.com
|
mail_smtp_host = mail.kunde-server.com
|
||||||
mail_smtp_port = 587
|
mail_smtp_port = 587
|
||||||
mail_smtp_user = api@kunde-server.com
|
mail_smtp_user = api@kunde-server.com
|
||||||
mail_smtp_pass = kunde-smtp-passwort
|
mail_smtp_pass = kunde-smtp-passwort
|
||||||
mail_smtp_ssl = true
|
mail_smtp_ssl = true
|
||||||
```
|
```
|
||||||
|
|
@ -479,7 +512,7 @@ mail_smtp_ssl = true
|
||||||
- JSON-Request mit name, email, subject, message Feldern
|
- JSON-Request mit name, email, subject, message Feldern
|
||||||
|
|
||||||
**GET /v1/auth/status**
|
**GET /v1/auth/status**
|
||||||
- API-Key-Validierung und Permission-Check
|
- API-Key-Validierung und Permission-Check
|
||||||
- Für Frontend-Authentifizierungs-Status-Prüfung
|
- Für Frontend-Authentifizierungs-Status-Prüfung
|
||||||
- Response enthält aktive Permissions
|
- Response enthält aktive Permissions
|
||||||
|
|
||||||
|
|
@ -540,7 +573,7 @@ openssl s_client -connect mail.dragons-at-work.de:465
|
||||||
|
|
||||||
**Diagnose:**
|
**Diagnose:**
|
||||||
```bash
|
```bash
|
||||||
# merkwerk-Installation prüfen
|
# merkwerk-Installation prüfen
|
||||||
which merkwerk
|
which merkwerk
|
||||||
merkwerk --version
|
merkwerk --version
|
||||||
|
|
||||||
|
|
@ -564,4 +597,4 @@ tail -f /var/log/daemon # OpenBSD
|
||||||
journalctl -u furt -f # Linux
|
journalctl -u furt -f # Linux
|
||||||
```
|
```
|
||||||
|
|
||||||
Diese Installation führt zu einem produktions-tauglichen furt-System mit mandanten-fähiger Architektur und merkwerk-basiertem Versions-Tracking.
|
Diese Installation führt zu einem produktions-tauglichen furt-System mit mandanten-fähiger Architektur und merkwerk-basiertem Versions-Tracking.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue