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**
|
||||
|
||||
## 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
|
||||
|
||||
### Lua-Runtime Anforderungen
|
||||
|
|
@ -68,26 +106,39 @@ Lua sucht Module über `LUA_PATH`-Environment-Variable. furt erweitert Standard-
|
|||
|
||||
**Pfad-Auflösung:**
|
||||
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)
|
||||
|
||||
## Schritt-für-Schritt Installation
|
||||
|
||||
### 1. Systemanforderungen prüfen
|
||||
|
||||
**Lua-Installation validieren:**
|
||||
**Lua-Installation validieren mit automatischer Command-Detection:**
|
||||
|
||||
```bash
|
||||
# Lua 5.1 verfügbar?
|
||||
lua5.1 -v
|
||||
# Lua-Command erkennen (plattformspezifisch)
|
||||
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:
|
||||
# Lua 5.1.5 Copyright (C) 1994-2012 Lua.org, PUC-Rio
|
||||
|
||||
# Required modules testen
|
||||
lua5.1 -e "require('socket')"
|
||||
lua5.1 -e "require('cjson')"
|
||||
$LUA_CMD -e "require('socket')"
|
||||
$LUA_CMD -e "require('cjson')"
|
||||
```
|
||||
|
||||
**Warum Command-Detection:** OpenBSD installiert Lua als `lua`, Linux-Distributionen oft als `lua5.1`.
|
||||
|
||||
**Fehlende Module installieren:**
|
||||
|
||||
*Arch Linux:*
|
||||
|
|
@ -138,7 +189,7 @@ chown _furt:_furt /var/log/furt
|
|||
*Linux:*
|
||||
```bash
|
||||
mkdir -p /etc/furt
|
||||
mkdir -p /usr/local/share/furt
|
||||
mkdir -p /usr/local/share/furt
|
||||
mkdir -p /var/log/furt
|
||||
chown furt:furt /var/log/furt
|
||||
```
|
||||
|
|
@ -147,9 +198,13 @@ chown furt:furt /var/log/furt
|
|||
|
||||
**Source-Code kopieren:**
|
||||
```bash
|
||||
# In furt-source-Verzeichnis (aus Schritt 0)
|
||||
cd /tmp/furt-source
|
||||
|
||||
# Haupt-Bibliothek installieren
|
||||
cp -r src/ /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/
|
||||
|
||||
# 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
|
||||
chmod -R 644 /usr/local/share/furt
|
||||
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
|
||||
#!/bin/sh
|
||||
# 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
|
||||
# start.sh-Funktionalität testen
|
||||
cd /usr/local/share/furt
|
||||
./scripts/start.sh
|
||||
|
||||
# Lua-Interpreter mit main.lua starten
|
||||
exec lua5.1 src/main.lua "$@"
|
||||
# Erwartete Ausgabe:
|
||||
# Auto-detected lua command: lua
|
||||
# Furt HTTP-Server started on 127.0.0.1:7811
|
||||
# [...]
|
||||
```
|
||||
|
||||
*Linux* - `/usr/local/bin/furt`:
|
||||
```bash
|
||||
#!/bin/bash
|
||||
# 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
|
||||
|
||||
# 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.
|
||||
**Warum start.sh statt direkter Lua-Aufruf:**
|
||||
- Automatische Lua-Command-Detection (lua vs lua5.1)
|
||||
- Service-vs-Interactive-Mode-Erkennung
|
||||
- Plattformspezifische Pfad-Anpassungen
|
||||
- Robuste Daemon-Integration
|
||||
|
||||
### 5. Konfiguration verstehen
|
||||
|
||||
|
|
@ -225,7 +264,7 @@ log_level = info
|
|||
|
||||
[smtp_default]
|
||||
host = mail.dragons-at-work.de
|
||||
port = 465
|
||||
port = 465
|
||||
user = noreply@dragons-at-work.de
|
||||
password = smtp-password-hier-eintragen
|
||||
use_ssl = true
|
||||
|
|
@ -240,7 +279,7 @@ mail_from = noreply@dragons-at-work.de
|
|||
mail_subject_prefix = "[DAW] "
|
||||
|
||||
# Monitoring ohne Mail-Weiterleitung
|
||||
[api_key "monitoring-health-key"]
|
||||
[api_key "monitoring-health-key"]
|
||||
name = "Monitoring Service"
|
||||
permissions = health:check
|
||||
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:*
|
||||
```bash
|
||||
chmod 640 /etc/furt/furt.conf
|
||||
chmod 640 /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
|
||||
|
||||
# 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
|
||||
```
|
||||
|
||||
|
|
@ -282,32 +321,26 @@ chmod 640 /etc/furt/furt.conf # Linux
|
|||
# OpenBSD/FreeBSD
|
||||
doas -u _furt /usr/local/share/furt/scripts/start.sh
|
||||
|
||||
# Linux
|
||||
# Linux
|
||||
sudo -u furt /usr/local/share/furt/scripts/start.sh
|
||||
```
|
||||
|
||||
### 6. Service-Integration
|
||||
|
||||
**OpenBSD rc.d-Script** - `/etc/rc.d/furt`:
|
||||
```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
|
||||
```
|
||||
|
||||
**OpenBSD rc.d-Script aus Repository-Template:**
|
||||
```bash
|
||||
# Template aus Repository verwenden
|
||||
cp deployment/openbsd/rc.d-furt /etc/rc.d/furt
|
||||
chmod +x /etc/rc.d/furt
|
||||
echo "furt_flags=" >> /etc/rc.conf.local
|
||||
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`:
|
||||
```ini
|
||||
[Unit]
|
||||
|
|
@ -318,12 +351,12 @@ After=network.target
|
|||
Type=simple
|
||||
User=furt
|
||||
Group=furt
|
||||
ExecStart=/usr/local/bin/furt
|
||||
ExecStart=/usr/local/share/furt/scripts/start.sh start
|
||||
WorkingDirectory=/usr/local/share/furt
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
StandardOutput=journal
|
||||
StandardError=journal
|
||||
WorkingDirectory=/usr/local/share/furt
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
|
@ -381,7 +414,7 @@ curl http://127.0.0.1:7811/health
|
|||
|
||||
**Was diese Response bedeutet:**
|
||||
- `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
|
||||
|
||||
### 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" \
|
||||
-d '{
|
||||
"name": "Installation Test",
|
||||
"email": "test@example.com",
|
||||
"email": "test@example.com",
|
||||
"subject": "furt Installation erfolgreich",
|
||||
"message": "Das furt API-Gateway ist betriebsbereit."
|
||||
}'
|
||||
|
|
@ -455,7 +488,7 @@ mail_from = noreply@kunde-server.com
|
|||
# Überschreibt smtp_default-Einstellungen
|
||||
mail_smtp_host = mail.kunde-server.com
|
||||
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_ssl = true
|
||||
```
|
||||
|
|
@ -479,7 +512,7 @@ mail_smtp_ssl = true
|
|||
- JSON-Request mit name, email, subject, message Feldern
|
||||
|
||||
**GET /v1/auth/status**
|
||||
- API-Key-Validierung und Permission-Check
|
||||
- API-Key-Validierung und Permission-Check
|
||||
- Für Frontend-Authentifizierungs-Status-Prüfung
|
||||
- Response enthält aktive Permissions
|
||||
|
||||
|
|
@ -540,7 +573,7 @@ openssl s_client -connect mail.dragons-at-work.de:465
|
|||
|
||||
**Diagnose:**
|
||||
```bash
|
||||
# merkwerk-Installation prüfen
|
||||
# merkwerk-Installation prüfen
|
||||
which merkwerk
|
||||
merkwerk --version
|
||||
|
||||
|
|
@ -564,4 +597,4 @@ tail -f /var/log/daemon # OpenBSD
|
|||
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