docs: simplify README and remove FreeBSD support
- Strip README to essentials with wiki references only - Remove non-existent API docs and troubleshooting links - Focus on quick start and actual integrations (merkwerk) - Remove FreeBSD support from all installation scripts - Clean up platform detection logic in scripts - Maintain OpenBSD and Linux support only Reduces maintenance burden and aligns with actual project scope.
This commit is contained in:
parent
6c60d88f62
commit
8b7806670c
10 changed files with 58 additions and 306 deletions
159
README.md
159
README.md
|
|
@ -1,160 +1,83 @@
|
||||||
# Furt API Gateway
|
# Furt API Gateway
|
||||||
|
|
||||||
**HTTP-Server in Lua für Service-Integration**
|
**Pure Lua HTTP-Server für digitale Souveränität**
|
||||||
|
|
||||||
## Überblick
|
## Überblick
|
||||||
|
|
||||||
Furt ist ein HTTP-Server der verschiedene Services unter einer API vereint. Aktuell unterstützt es Mail-Versendung über SMTP und bietet eine einfache JSON-API für Web-Integration.
|
Furt ist ein minimalistisches HTTP-Server in Lua 5.1 für Mail-Versendung über SMTP. Es bietet eine einfache JSON-API für Web-Integration und Multi-Tenant-Unterstützung über API-Keys.
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
- HTTP-Server mit JSON-APIs
|
- HTTP-Server mit JSON-APIs
|
||||||
- Mail-Versendung über SMTP
|
- Multi-Tenant Mail-Routing über SMTP
|
||||||
- Request-Routing und Authentication
|
- API-Key-basierte Authentifizierung
|
||||||
- Health-Check-Endpoints
|
- Health-Check-Endpoints
|
||||||
- Konfigurierbare Rate-Limiting
|
- Rate-Limiting pro API-Key
|
||||||
- Hugo/Website-Integration
|
- CORS-Support für Frontend-Integration
|
||||||
|
|
||||||
## Dependencies
|
## Quick Start
|
||||||
|
|
||||||
**Erforderlich:**
|
**Dependencies installieren:**
|
||||||
- `lua` 5.4+
|
```bash
|
||||||
- `lua-socket` (HTTP-Server)
|
# OpenBSD
|
||||||
- `lua-cjson` (JSON-Verarbeitung)
|
doas pkg_add lua lua-socket lua-cjson luasec
|
||||||
|
|
||||||
|
# Debian/Ubuntu
|
||||||
|
sudo apt install lua5.1 lua-socket lua-cjson lua-sec
|
||||||
|
|
||||||
|
# Arch Linux
|
||||||
|
sudo pacman -S lua51 lua51-socket lua51-dkjson lua51-sec
|
||||||
|
```
|
||||||
|
|
||||||
**Installation:**
|
**Installation:**
|
||||||
```bash
|
```bash
|
||||||
# Arch Linux
|
git clone https://smida.dragons-at-work.de/DAW/furt.git
|
||||||
pacman -S lua lua-socket lua-cjson
|
|
||||||
|
|
||||||
# Ubuntu/Debian
|
|
||||||
apt install lua5.4 lua-socket lua-cjson
|
|
||||||
```
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Repository klonen
|
|
||||||
git clone <repository-url>
|
|
||||||
cd furt
|
cd furt
|
||||||
|
sudo ./install.sh
|
||||||
# Scripts ausführbar machen
|
|
||||||
chmod +x scripts/*.sh
|
|
||||||
|
|
||||||
# Server starten
|
|
||||||
./scripts/start.sh
|
|
||||||
```
|
```
|
||||||
|
|
||||||
**Server läuft auf:** http://127.0.0.1:8080
|
**Server läuft auf:** http://127.0.0.1:7811
|
||||||
|
|
||||||
## API-Endpoints
|
## API-Endpoints
|
||||||
|
|
||||||
### Health Check
|
**Health Check:**
|
||||||
```bash
|
```bash
|
||||||
GET /health
|
curl http://127.0.0.1:7811/health
|
||||||
→ {"status":"healthy","service":"furt","version":"1.0.0"}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Mail senden
|
**Mail senden:**
|
||||||
```bash
|
```bash
|
||||||
POST /v1/mail/send
|
curl -X POST http://127.0.0.1:7811/v1/mail/send \
|
||||||
Content-Type: application/json
|
-H "X-API-Key: your-api-key" \
|
||||||
|
|
||||||
{
|
|
||||||
"name": "Name",
|
|
||||||
"email": "sender@example.com",
|
|
||||||
"message": "Nachricht"
|
|
||||||
}
|
|
||||||
|
|
||||||
→ {"success":true,"message":"Mail sent"}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Konfiguration
|
|
||||||
|
|
||||||
**Environment Variables (.env):**
|
|
||||||
```bash
|
|
||||||
FURT_MAIL_HOST=mail.example.com
|
|
||||||
FURT_MAIL_PORT=587
|
|
||||||
FURT_MAIL_USERNAME=user@example.com
|
|
||||||
FURT_MAIL_PASSWORD=password
|
|
||||||
FURT_MAIL_TO=empfaenger@example.com
|
|
||||||
```
|
|
||||||
|
|
||||||
**Server-Config (config/server.lua):**
|
|
||||||
- Port und Host-Einstellungen
|
|
||||||
- API-Key-Konfiguration
|
|
||||||
- Rate-Limiting-Parameter
|
|
||||||
|
|
||||||
## Testing
|
|
||||||
|
|
||||||
**Automatische Tests:**
|
|
||||||
```bash
|
|
||||||
lua tests/test_http.lua
|
|
||||||
```
|
|
||||||
|
|
||||||
**Manuelle Tests:**
|
|
||||||
```bash
|
|
||||||
./scripts/test_curl.sh
|
|
||||||
|
|
||||||
# Oder direkt:
|
|
||||||
curl -X POST http://127.0.0.1:8080/v1/mail/send \
|
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d '{"name":"Test","email":"test@example.com","message":"Test"}'
|
-d '{"name":"Test","email":"test@example.com","subject":"Test","message":"Test-Nachricht"}'
|
||||||
```
|
```
|
||||||
|
|
||||||
## Deployment
|
## Dokumentation
|
||||||
|
|
||||||
**OpenBSD:**
|
**Installation & Konfiguration:** [Furt Wiki](https://smida.dragons-at-work.de/DAW/furt/wiki)
|
||||||
- rc.d-Script in `deployment/openbsd/`
|
|
||||||
- Systemd-Integration über Scripts
|
|
||||||
|
|
||||||
**Production-Setup:**
|
|
||||||
```bash
|
|
||||||
# Environment-Config kopieren
|
|
||||||
cp .env.example .env.production
|
|
||||||
# → SMTP-Credentials anpassen
|
|
||||||
|
|
||||||
# Production-Mode starten
|
|
||||||
export FURT_ENV=production
|
|
||||||
./scripts/start.sh
|
|
||||||
```
|
|
||||||
|
|
||||||
## Projektstruktur
|
## Projektstruktur
|
||||||
|
|
||||||
```
|
```
|
||||||
furt/
|
furt/
|
||||||
├── src/ # Lua-Source-Code
|
├── src/ # Lua-Source-Code
|
||||||
│ ├── main.lua # HTTP-Server
|
├── config/ # Konfiguration
|
||||||
│ ├── routes/ # API-Endpoints
|
├── scripts/ # Installation & Management
|
||||||
│ └── smtp.lua # Mail-Integration
|
└── deployment/ # System-Integration
|
||||||
├── config/ # Konfiguration
|
|
||||||
├── scripts/ # Start/Test-Scripts
|
|
||||||
├── tests/ # Test-Suite
|
|
||||||
└── deployment/ # System-Integration
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Hugo-Integration
|
## Integration
|
||||||
|
|
||||||
**Shortcode-Beispiel:**
|
**merkwerk:** Versionierte Furt-Deployment über [merkwerk](https://smida.dragons-at-work.de/DAW/merkwerk)
|
||||||
```html
|
|
||||||
<form action="http://your-server:8080/v1/mail/send" method="POST">
|
|
||||||
<input name="name" type="text" required>
|
|
||||||
<input name="email" type="email" required>
|
|
||||||
<textarea name="message" required></textarea>
|
|
||||||
<button type="submit">Senden</button>
|
|
||||||
</form>
|
|
||||||
```
|
|
||||||
|
|
||||||
## Development
|
## License
|
||||||
|
|
||||||
**Code-Struktur:**
|
ISC - Siehe [LICENSE](LICENSE) für Details.
|
||||||
- Module unter 200 Zeilen
|
|
||||||
- Funktionen unter 50 Zeilen
|
|
||||||
- Klare Fehlerbehandlung
|
|
||||||
- Testbare Komponenten
|
|
||||||
|
|
||||||
**Dependencies minimal halten:**
|
## Links
|
||||||
- Nur lua-socket und lua-cjson
|
|
||||||
- Keine externen HTTP-Libraries
|
- **Repository:** [Forgejo](https://smida.dragons-at-work.de/DAW/furt)
|
||||||
- Standard-Lua-Funktionen bevorzugen
|
- **Dokumentation:** [Wiki](https://smida.dragons-at-work.de/DAW/furt/wiki)
|
||||||
|
- **Projekt:** [Dragons@Work](https://dragons-at-work.de)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,176 +0,0 @@
|
||||||
# Multi-Tenant furt Setup-Anleitung
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
### 1. Dateien platzieren
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# OpenBSD/FreeBSD
|
|
||||||
mkdir -p /usr/local/etc/furt
|
|
||||||
mkdir -p /usr/local/share/furt
|
|
||||||
|
|
||||||
# Oder Linux
|
|
||||||
mkdir -p /etc/furt
|
|
||||||
mkdir -p /usr/local/share/furt
|
|
||||||
|
|
||||||
# Source code
|
|
||||||
cp -r src/ /usr/local/share/furt/
|
|
||||||
cp -r config/ /usr/local/share/furt/
|
|
||||||
```
|
|
||||||
|
|
||||||
### 2. Konfiguration erstellen
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Beispiel-Config kopieren und anpassen
|
|
||||||
# OpenBSD/FreeBSD:
|
|
||||||
cp furt.conf.example /usr/local/etc/furt/furt.conf
|
|
||||||
|
|
||||||
# Linux:
|
|
||||||
cp furt.conf.example /etc/furt/furt.conf
|
|
||||||
|
|
||||||
# Config editieren
|
|
||||||
vi /usr/local/etc/furt/furt.conf # oder /etc/furt/furt.conf
|
|
||||||
```
|
|
||||||
|
|
||||||
### 3. Start-Script
|
|
||||||
|
|
||||||
```bash
|
|
||||||
#!/bin/sh
|
|
||||||
# /usr/local/bin/furt
|
|
||||||
|
|
||||||
cd /usr/local/share/furt
|
|
||||||
lua src/main.lua
|
|
||||||
```
|
|
||||||
|
|
||||||
## Multi-Tenant Konfiguration
|
|
||||||
|
|
||||||
### Beispiel für 3 Websites
|
|
||||||
|
|
||||||
```ini
|
|
||||||
[server]
|
|
||||||
host = 127.0.0.1
|
|
||||||
port = 8080
|
|
||||||
|
|
||||||
[smtp_default]
|
|
||||||
host = mail.dragons-at-work.de
|
|
||||||
port = 465
|
|
||||||
user = noreply@dragons-at-work.de
|
|
||||||
password = your-smtp-password
|
|
||||||
|
|
||||||
# Website 1: Dragons@Work
|
|
||||||
[api_key "daw-key-abc123"]
|
|
||||||
name = "Dragons@Work Website"
|
|
||||||
permissions = mail:send
|
|
||||||
allowed_ips = 1.2.3.4/32, 10.0.0.0/8
|
|
||||||
mail_to = admin@dragons-at-work.de
|
|
||||||
mail_from = noreply@dragons-at-work.de
|
|
||||||
mail_subject_prefix = "[DAW] "
|
|
||||||
|
|
||||||
# Website 2: Biocodie (gleiche SMTP, andere Empfänger)
|
|
||||||
[api_key "bio-key-def456"]
|
|
||||||
name = "Biocodie Website"
|
|
||||||
permissions = mail:send
|
|
||||||
allowed_ips = 5.6.7.8/32
|
|
||||||
mail_to = contact@biocodie.de
|
|
||||||
mail_from = noreply@biocodie.de
|
|
||||||
mail_subject_prefix = "[Biocodie] "
|
|
||||||
|
|
||||||
# Website 3: Kunde mit eigenem SMTP
|
|
||||||
[api_key "kunde-key-ghi789"]
|
|
||||||
name = "Kunde X Website"
|
|
||||||
permissions = mail:send
|
|
||||||
allowed_ips = 9.10.11.12/32
|
|
||||||
mail_to = info@kunde-x.de
|
|
||||||
mail_from = noreply@kunde-x.de
|
|
||||||
mail_smtp_host = mail.kunde-x.de
|
|
||||||
mail_smtp_user = noreply@kunde-x.de
|
|
||||||
mail_smtp_pass = kunde-smtp-password
|
|
||||||
```
|
|
||||||
|
|
||||||
## Admin-Workflow
|
|
||||||
|
|
||||||
### Neue Website hinzufügen
|
|
||||||
|
|
||||||
1. **Config editieren:**
|
|
||||||
```bash
|
|
||||||
vi /usr/local/etc/furt/furt.conf
|
|
||||||
```
|
|
||||||
|
|
||||||
2. **Neuen API-Key-Block hinzufügen:**
|
|
||||||
```ini
|
|
||||||
[api_key "neue-website-key"]
|
|
||||||
name = "Neue Website"
|
|
||||||
permissions = mail:send
|
|
||||||
allowed_ips = 12.34.56.78/32
|
|
||||||
mail_to = contact@neue-website.de
|
|
||||||
mail_from = noreply@neue-website.de
|
|
||||||
```
|
|
||||||
|
|
||||||
3. **furt neu starten:**
|
|
||||||
```bash
|
|
||||||
systemctl restart furt
|
|
||||||
# oder
|
|
||||||
pkill -f "lua.*main.lua" && /usr/local/bin/furt &
|
|
||||||
```
|
|
||||||
|
|
||||||
### Website testen
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Test mit curl
|
|
||||||
curl -X POST http://localhost:8080/v1/mail/send \
|
|
||||||
-H "X-API-Key: neue-website-key" \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-d '{
|
|
||||||
"name": "Test User",
|
|
||||||
"email": "test@example.com",
|
|
||||||
"subject": "Test Message",
|
|
||||||
"message": "This is a test message"
|
|
||||||
}'
|
|
||||||
```
|
|
||||||
|
|
||||||
## Vorteile des Multi-Tenant-Systems
|
|
||||||
|
|
||||||
### ✅ Ein Server, viele Websites
|
|
||||||
- Alle Websites nutzen eine furt-Instanz
|
|
||||||
- Jede Website hat eigenen API-Key
|
|
||||||
- Verschiedene Empfänger-Adressen
|
|
||||||
- Verschiedene SMTP-Server möglich
|
|
||||||
|
|
||||||
### ✅ Admin-freundlich
|
|
||||||
- Nginx-style Config-Format
|
|
||||||
- Einfach neue Websites hinzufügen
|
|
||||||
- Klare Struktur pro Website
|
|
||||||
- Kommentare möglich
|
|
||||||
|
|
||||||
### ✅ Sicher
|
|
||||||
- IP-Restrictions pro Website
|
|
||||||
- Permissions pro API-Key
|
|
||||||
- Separate SMTP-Credentials möglich
|
|
||||||
- Rate-Limiting bleibt erhalten
|
|
||||||
|
|
||||||
### ✅ Flexibel
|
|
||||||
- Default SMTP + website-spezifische SMTP
|
|
||||||
- Subject-Prefix pro Website
|
|
||||||
- Verschiedene Mail-Adressen
|
|
||||||
- Beliebig viele Websites
|
|
||||||
|
|
||||||
## Backward Compatibility
|
|
||||||
|
|
||||||
Das neue System ist **vollständig kompatibel** mit der alten config/server.lua API. Bestehende Module (auth.lua, main.lua, etc.) funktionieren ohne Änderungen.
|
|
||||||
|
|
||||||
## Troubleshooting
|
|
||||||
|
|
||||||
### Config-Parsing-Fehler
|
|
||||||
```bash
|
|
||||||
# Config-Syntax prüfen
|
|
||||||
lua -e "require('src.config_parser').parse_file('/usr/local/etc/furt/furt.conf')"
|
|
||||||
```
|
|
||||||
|
|
||||||
### Mail-Routing testen
|
|
||||||
```bash
|
|
||||||
# Logs anschauen
|
|
||||||
tail -f /var/log/furt.log
|
|
||||||
|
|
||||||
# Debug-Mode
|
|
||||||
FURT_DEBUG=true lua src/main.lua
|
|
||||||
```
|
|
||||||
|
|
@ -102,7 +102,7 @@ else
|
||||||
echo ""
|
echo ""
|
||||||
echo "Next steps:"
|
echo "Next steps:"
|
||||||
echo "1. Edit configuration file:"
|
echo "1. Edit configuration file:"
|
||||||
if [ "$(uname)" = "OpenBSD" ] || [ "$(uname)" = "FreeBSD" ]; then
|
if [ "$(uname)" = "OpenBSD" ]; then
|
||||||
echo " /usr/local/etc/furt/furt.conf"
|
echo " /usr/local/etc/furt/furt.conf"
|
||||||
else
|
else
|
||||||
echo " /etc/furt/furt.conf"
|
echo " /etc/furt/furt.conf"
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Detect operating system for config directory
|
# Detect operating system for config directory
|
||||||
if [ "$(uname)" = "OpenBSD" ] || [ "$(uname)" = "FreeBSD" ]; then
|
if [ "$(uname)" = "OpenBSD" ]; then
|
||||||
CONFIG_DIR="/usr/local/etc/furt"
|
CONFIG_DIR="/usr/local/etc/furt"
|
||||||
USER="_furt"
|
USER="_furt"
|
||||||
GROUP="_furt"
|
GROUP="_furt"
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Detect operating system
|
# Detect operating system
|
||||||
if [ "$(uname)" = "OpenBSD" ] || [ "$(uname)" = "FreeBSD" ]; then
|
if [ "$(uname)" = "OpenBSD" ]; then
|
||||||
# BSD systems use _furt user convention
|
# BSD systems use _furt user convention
|
||||||
groupadd _furt 2>/dev/null || true
|
groupadd _furt 2>/dev/null || true
|
||||||
useradd -g _furt -s /bin/false -d /var/empty _furt 2>/dev/null || true
|
useradd -g _furt -s /bin/false -d /var/empty _furt 2>/dev/null || true
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ echo -e "${GREEN}=== Furt Lua HTTP-Server Startup ===${NC}"
|
||||||
LUA_COMMAND=""
|
LUA_COMMAND=""
|
||||||
|
|
||||||
# Config check first
|
# Config check first
|
||||||
if [ "$(uname)" = "OpenBSD" ] || [ "$(uname)" = "FreeBSD" ]; then
|
if [ "$(uname)" = "OpenBSD" ]; then
|
||||||
CONFIG_FILE="/usr/local/etc/furt/furt.conf"
|
CONFIG_FILE="/usr/local/etc/furt/furt.conf"
|
||||||
PID_FILE="/var/run/furt/furt.pid"
|
PID_FILE="/var/run/furt/furt.pid"
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -24,8 +24,13 @@ cp -r integrations/ "$TARGET/"
|
||||||
[ -f "VERSION" ] && cp VERSION "$TARGET/"
|
[ -f "VERSION" ] && cp VERSION "$TARGET/"
|
||||||
[ -f ".version_history" ] && cp .version_history "$TARGET/"
|
[ -f ".version_history" ] && cp .version_history "$TARGET/"
|
||||||
|
|
||||||
# Set proper permissions
|
# Set proper permissions based on operating system
|
||||||
chown -R root:wheel "$TARGET" 2>/dev/null || chown -R root:root "$TARGET"
|
if [ "$(uname)" = "OpenBSD" ]; then
|
||||||
|
chown -R root:wheel "$TARGET"
|
||||||
|
else
|
||||||
|
chown -R root:root "$TARGET"
|
||||||
|
fi
|
||||||
|
|
||||||
chmod -R 644 "$TARGET"
|
chmod -R 644 "$TARGET"
|
||||||
find "$TARGET" -type d -exec chmod 755 {} \;
|
find "$TARGET" -type d -exec chmod 755 {} \;
|
||||||
chmod +x "$TARGET/scripts/start.sh"
|
chmod +x "$TARGET/scripts/start.sh"
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Detect config file location
|
# Detect config file location
|
||||||
if [ "$(uname)" = "OpenBSD" ] || [ "$(uname)" = "FreeBSD" ]; then
|
if [ "$(uname)" = "OpenBSD" ]; then
|
||||||
CONFIG_FILE="/usr/local/etc/furt/furt.conf"
|
CONFIG_FILE="/usr/local/etc/furt/furt.conf"
|
||||||
else
|
else
|
||||||
CONFIG_FILE="/etc/furt/furt.conf"
|
CONFIG_FILE="/etc/furt/furt.conf"
|
||||||
|
|
|
||||||
|
|
@ -215,7 +215,7 @@ end
|
||||||
function ConfigParser.load_config()
|
function ConfigParser.load_config()
|
||||||
-- Try different locations based on OS
|
-- Try different locations based on OS
|
||||||
local config_paths = {
|
local config_paths = {
|
||||||
"/usr/local/etc/furt/furt.conf", -- OpenBSD/FreeBSD
|
"/usr/local/etc/furt/furt.conf", -- OpenBSD
|
||||||
"/etc/furt/furt.conf", -- Linux
|
"/etc/furt/furt.conf", -- Linux
|
||||||
"config/furt.conf", -- Development
|
"config/furt.conf", -- Development
|
||||||
"furt.conf" -- Current directory
|
"furt.conf" -- Current directory
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue