Commit graph

81 commits

Author SHA1 Message Date
ecd4f68595 chore: merkwerk auto-update 2025-08-28 19:53:42 +02:00
8ec401930c fix(config): lua 5.1 compatibility and multi-tenant validation
- Replace goto statements with if-not pattern for Lua 5.1 compatibility
- Validate mail config only for API keys with mail:send permissions
- Safe display of API key info for monitoring keys without mail config
- Fix health check SMTP detection for new config structure
- Multi-tenant system tested and working on port 7811

Fixes multi-tenant config parsing, validation, and health checks.
Related to DAW/furt#89
2025-08-28 19:53:30 +02:00
a5db9a633f merge: integrate merkwerk binary detection into multi-tenant
- Add universal merkwerk binary detection from main
- Required for furt installations (no install without merkwerk)
- Maintains compatibility with multi-tenant architecture

Merges main branch changes for issue #94 into feature/issue-89-multi-tenant
2025-08-28 18:20:54 +02:00
82da58b358 chore: merkwerk auto-update 2025-08-28 17:34:36 +02:00
95dcdbaebb feat(integration): add universal merkwerk binary detection
- Check development binary (./bin/merkwerk)
- Check installed binary (/usr/local/bin/merkwerk)
- Fallback to PATH lookup (command -v merkwerk)
- Proper error handling for missing binary

Related to DAW/furt#94
2025-08-28 17:34:36 +02:00
6b2da02429 chore: merkwerk auto-update 2025-08-20 06:08:04 +02:00
62ddc17393 feat(integration): production-ready .version_history priority
- Change get_info() priority: .version_history first, merkwerk fallback
- Add read_version_history() for production deployment compatibility
- Works without merkwerk binary (tar.gz deployments)
- Maintains development fallback to merkwerk command

Production-ready: tar.gz deployments work without merkwerk installation.
2025-08-20 06:07:56 +02:00
f2d925ee57 chore: merkwerk auto-update 2025-08-19 21:36:34 +02:00
00b8a18527 feat(health): migrate VERSION file to merkwerk integration (#83)
- Replace read_version() with merkwerk.get_health_info()
- Health endpoint now returns content_hash, vcs_info, source tracking
- Add merkwerk_integrated feature flag
- Enhanced startup logs with content-hash and VCS info
- Maintain backward compatibility with version field
- lua51 compatible integration for OpenBSD deployment

Migration from static VERSION file to dynamic merkwerk version tracking.
Health endpoint now provides rich metadata for debugging and monitoring.

Resolves DAW/furt#83
2025-08-19 21:28:22 +02:00
7053af3c0d feat(core): implement file-based API versioning system (DAW/furt#83)
- Add VERSION file in repository root
- Add read_version() function with error handling
- Update /health endpoint to show file-based version
- Add version display during server startup
- Fallback to ?.?.? when VERSION file unreadable

Enables deployment tracking across dev/test/prod environments
2025-08-15 16:57:33 +02:00
5b851b8bfb fix(devdocs) delete project-tree.txt 2025-08-15 16:22:12 +02:00
3ed921312f feat(config): implement multi-tenant config system (DAW/furt#89)
- nginx-style furt.conf configuration
- Multi-tenant mail routing per API key
- Custom SMTP support per customer
- Backward compatibility via server.lua adapter

WIP: Ready for testing on werner
2025-08-15 16:18:55 +02:00
be3b9614d0 refactor: clean repository structure for v0.1.0 open source release
- Remove Go artifacts (cmd/, internal/, pkg/, go.mod)
- Move furt-lua/* content to repository root
- Restructure as clean src/, config/, scripts/, tests/ layout
- Rewrite README.md as practical tool documentation
- Remove timeline references and marketing language
- Clean .gitignore from Go-era artifacts
- Update config/server.lua with example.org defaults
- Add .env.production to .gitignore for security

Repository now ready for open source distribution with minimal,
focused structure and generic configuration templates.
close issue DAW/furt#86
2025-08-14 09:36:55 +02:00
87c935379b upd(gitignor) update tools/gitea 2025-07-20 19:34:54 +02:00
901f5eb2d8 feat(auth): implement complete API-key authentication with modular architecture (#47)
- Add comprehensive API-key authentication system with X-API-Key header validation
- Implement permission-based access control (mail:send, * for admin)
- Add rate-limiting system (60 req/hour per API key, 100 req/hour per IP)
- Refactor monolithic 590-line main.lua into 6 modular components (<200 lines each)
- Add IP-restriction support with CIDR notation (127.0.0.1, 10.0.0.0/8)
- Implement Hugo integration with CORS support for localhost:1313
- Add production-ready configuration with environment variable support
- Create comprehensive testing suite (auth, rate-limiting, stress tests)
- Add production deployment checklist and cleanup scripts

This refactoring transforms the API gateway from a single-file monolith into a
biocodie-compliant modular architecture while adding enterprise-grade security
features. Performance testing shows 79 RPS concurrent throughput with <100ms
latency. Hugo contact form integration tested and working. System is now
production-ready for deployment to walter/aitvaras.

Resolves #47
2025-06-24 22:01:38 +02:00
445e751c16 feat(api): implement CORS support with environment-based configuration
- Add CORS headers to all API responses in main.lua
- Implement OPTIONS preflight request handling
- Add environment-variable based CORS origin configuration
- Create production.env.example for deployment documentation
- Update .env.example with CORS_ALLOWED_ORIGINS setting

Resolves cross-origin request blocking for Hugo dev server integration.
CORS origins now configurable via CORS_ALLOWED_ORIGINS environment variable
for production deployments while maintaining dev-friendly defaults.

Related to #49
2025-06-24 19:42:44 +02:00
9ea0cb43e4 fix(deploy): prevent environment config overwrite and fix SMTP_HOST variable
- Fix create_environment_file() to preserve existing production config
- Change SMTP_SERVER to SMTP_HOST for consistency with other configs
- Add config existence check before creating new environment file
- Preserve permissions on existing config files
- Prevent accidental production config loss on redeployment

Fixes #50
2025-06-24 11:04:19 +02:00
0abc9791d3 fix(deployment): resolve OpenBSD rc.d service tracking and deployment workflow
- Fix OpenBSD service file pexp pattern to match actual running process
- Set pexp after sourcing rc.subr to prevent automatic override
- Update deployment script process detection from broken furt-lua pattern
- Add TTY-based daemon detection in start.sh for service vs development mode
- Implement comprehensive deployment workflow with backup and health checks
- Enable proper rcctl start/stop/check functionality on OpenBSD

Root cause: OpenBSD rc.subr automatically generates pexp from daemon+flags,
but actual process (/usr/local/bin/lua src/main.lua) differs from wrapper
(start.sh). Solution: Override pexp after rc.subr with correct Lua pattern.

Deployment script also had incorrect process detection pattern looking for
'furt-lua' string that doesn't exist in process name.

Technical details:
- Service file: pexp="/usr/local/bin/lua src/main.lua.*" after rc.subr
- Process detection: pgrep -u _furt -f 'src/main.lua'
- TTY detection: [ ! -t 0 ] for daemon vs interactive mode
- Complete deployment workflow with stop/sync/start/health-check cycle

Fixes #77 - OpenBSD rc.d service file problem resolved
Related: Deployment automation now fully functional karl→walter
2025-06-23 19:44:21 +02:00
c22b3aa691 feat(deployment): implement comprehensive karl→walter deployment script
- Add automated rsync-based file synchronization with _furt user permissions
- Implement OpenBSD rcctl service management with backup/rollback functionality
- Add port availability checks and health validation after deployment
- Include comprehensive error handling and status reporting
- Support dry-run mode for safe deployment testing
- Provide automatic service file generation with correct paths

Features:
- SSH-based secure transfer with permission preservation
- Pre-deployment backup with configurable retention (3 backups)
- Intelligent service stop/start handling for OpenBSD rcctl
- Health check validation via HTTP endpoint
- Colored output and structured logging for better UX
- Support for --dry-run, --rollback, and --force modes

Successfully deploys furt-lua from development (karl) to staging (walter).
Manual service management required due to OpenBSD rc.d pexp pattern issues.

Closes #76 (deployment automation)
Related: Service file pexp pattern matching requires follow-up investigation

Files:
- scripts/deploy/deploy_walter.sh (new)
2025-06-23 11:57:42 +02:00
e23b24d5d0 feat(smtp): implement universal SSL compatibility for luaossl and luasec (#74)
- Add automatic SSL library detection (luaossl/luasec)
- Support Arch Linux (luaossl) and OpenBSD (luasec)
- Maintain backward compatibility with existing configurations
- Enable production deployment on OpenBSD with _furt service user
- Implement transparent API abstraction for different SSL libraries

Technical improvements:
- Auto-detection prevents manual SSL library configuration
- Compatible with package managers (no custom builds required)
- Tested on karl (Arch/luaossl) and walter (OpenBSD/luasec)
- Both systems successfully send emails via Port 465 SSL
- DKIM authentication passes on both platforms

Production readiness:
- Service user compatibility (_furt on OpenBSD)
- Config detection (/usr/local/etc/furt/environment)
- Multi-distribution support (Arch + OpenBSD)
- No OpenSSL command dependencies (tech sovereignty compliance)

Fixes #74

Files modified:
- furt-lua/src/smtp.lua
2025-06-23 08:27:59 +02:00
010371a9a7 fix(config): resolve config loading path conflicts in universal start.sh (#68, #70)
- Split REPO_ROOT and PROJECT_DIR for different purposes
- REPO_ROOT: Repository-wide configs (.env, system configs)
- PROJECT_DIR: Lua-specific working directory (src/, cd)
- Fix config detection across development and production environments

Changes:
- REPO_ROOT="$(dirname "$(dirname "$SCRIPT_DIR")")" # 2 levels up for .env
- PROJECT_DIR="$(dirname "$SCRIPT_DIR")"            # 1 level up for src/
- Config loading uses REPO_ROOT (.env location)
- Working directory and Lua paths use PROJECT_DIR (furt-lua/)

Tested on:
- karl (Linux/Development): .env loading + lua51 execution 
- walter (OpenBSD/Production): system config + lua execution 

Cross-platform SMTP functionality verified:
- karl: Full E2E test with successful mail delivery
- walter: HTTP server + config detection working

Fixes #68 (Universal Config Detection)
Fixes #70 (karl start.sh regression after universal script update)
2025-06-22 20:27:11 +02:00
bb2bed80a6 fix(config): partial implementation of universal config detection (#68)
- Add multi-distribution config path detection
- Support /usr/local/etc/furt/environment (OpenBSD)
- Support /etc/furt/environment (Debian/Ubuntu/RHEL)
- Maintain .env support for development
- Add configurable Lua command via LUA_COMMAND environment variable

POSIX compatibility improvements:
- Replace command -v with [ -x ] for service user compatibility
- Change shebang from #!/bin/bash to #!/bin/sh for OpenBSD
- Replace ${BASH_SOURCE[0]} with $0 for POSIX shell compatibility

walter deployment changes:
- Migrate directory structure to /usr/local/furt/furt-lua/
- Set up _furt user permissions
- Configure system config in /usr/local/etc/furt/environment

Known issues:
- karl development environment regression (lua51 detection failed)
- walter SSL missing for SMTP (luasec vs luaossl compatibility)
- Config strategy needs comprehensive redesign for multi-implementation

Related: #68

Files modified:
- furt-lua/scripts/start.sh (POSIX compatibility + universal config)
- .env.example (added LUA_COMMAND and LUA_VERSION)
- walter: /usr/local/etc/furt/environment (system config setup)
2025-06-22 18:39:38 +02:00
6d7d8a2af8 feat(smtp): complete native Lua SMTP integration for production mail delivery
- Add native Lua SMTP client with SSL/TLS support for mail.dragons-at-work.de:465
- Implement POST /v1/mail/send endpoint with real email delivery functionality
- Add environment variable integration (SMTP_*) for secure credential management
- Add comprehensive input validation and error handling for mail requests
- Add health check endpoint with SMTP configuration status reporting
- Add multi-line SMTP response handling for robust server communication
- Add request ID tracking system for debugging and monitoring
- Update start.sh script for automatic .env loading and dependency checking
- Add complete testing suite for SMTP functionality verification

This completes the Week 2 Challenge migration from Go to pure Lua HTTP server
with full production-ready SMTP capabilities. The implementation eliminates all
Google/corporate dependencies while achieving superior performance (18ms response
time) and maintaining digital sovereignty principles.

Real mail delivery confirmed: test email successfully sent to admin@dragons-at-work.de
Ready for Hugo website integration and production deployment with security layer.

Closes #65
2025-06-19 09:52:15 +02:00
662bfc7b7a feat(furt): implement complete Lua HTTP-Server for digital sovereignty (#63)
- Add furt-lua/ directory with pure Lua implementation
- Replace planned Go implementation with Corporate-free technology
- Complete Week 1 Challenge: HTTP-Server to production-ready in 48min

- HTTP-Server in pure Lua (185 lines, lua-socket based)
- JSON API endpoints with request/response parsing
- Modular architecture: each file < 200 lines
- Error handling for 404, 400, validation scenarios

- GET /health - Service health check with timestamp
- POST /test - Development testing with request echo
- POST /v1/mail/send - Mail service foundation with validation
- Comprehensive error responses with structured JSON

- Smart startup script with dependency auto-detection
- Automated test suite with lua-socket HTTP client
- Manual curl test suite for development workflow
- Complete documentation and installation guide

- FROM: Go (Google-controlled) → TO: Lua (PUC-Rio University)
- Corporate-free dependency chain: lua-socket + lua-cjson + lua-ssl
- Performance superior: < 1ms response time, minimal memory usage
- Foundation for planned C+Lua hybrid architecture

- furt-lua/src/main.lua - HTTP-Server implementation
- furt-lua/config/server.lua - Lua-based configuration
- furt-lua/scripts/start.sh - Startup with dependency checks
- furt-lua/scripts/test_curl.sh - Manual testing suite
- furt-lua/tests/test_http.lua - Automated test framework
- furt-lua/README.md - Implementation documentation

- README.md - Document Go→Lua migration strategy
- .gitignore - Add Lua artifacts, luarocks, issue-scripts

All endpoints tested and working:
✓ Health check returns proper JSON status
✓ Test endpoint processes POST requests with JSON
✓ Mail endpoint validates required fields (name, email, message)
✓ Error handling returns appropriate HTTP status codes

Ready for Week 2: SMTP integration with mail.dragons-at-work.de

Completes #63
Related #62
2025-06-17 20:40:40 +02:00
10b795ce13 refactor(architecture): migrate Furt concept from Go to C+Lua for digital sovereignty
- Replace Go-based architecture with C+Lua hybrid approach
- Eliminate Google-controlled dependencies per tech-reference analysis
- Add master strategy document for 18-24 month migration roadmap
- Define modular architecture with <200 lines per script constraint
- Specify Pure Lua → C+Lua → OpenBSD migration path
- Document SMTP integration for mail.dragons-at-work.de

Files modified:
- devdocs/KONZEPT.md (complete rewrite)
- devdocs/MASTER_STRATEGY.md (new)

Resolves concept phase, enables Week 1 Lua implementation.
2025-06-17 19:30:34 +02:00
78b70cf06b archive: move all generation-1 scripts to archive
- create_issue.sh: 800+ lines monster (functional but unmaintainable)
- update_script_labels.sh: 15KB auto-update system (too complex)
- get_issues.sh: 7KB grown over time (needs simplification)
- update_issue.sh: 5KB functional (part of old system)

Preparing clean slate for low-tech generation-2 system
2025-06-04 18:29:48 +02:00
b5eb30caa0 feat: functional monster script (anti-pattern warning) 2025-06-04 18:27:00 +02:00
56ed910884 feat(scripts): implement self-healing label system with auto-creation
- Fix HTTP 422 errors by using label IDs instead of names
- Add silent label creation to prevent stdout pollution in JSON building
- Implement smart auto-creation of unknown labels (service-*, priority-*, etc.)
- Add safe array handling to prevent bash associative array errors
- Create tracking system for new labels (NEW_LABELS_CREATED array)

 Fixed: Label creation, issue creation, unknown label handling
 TODO: Auto-update script synchronization when new labels created

Status: Issue creation works perfectly, auto-update integration pending
2025-06-04 08:39:42 +02:00
d6d546bd95 docs(core): comprehensive development documentation and issue management system
- Complete project documentation for API gateway development
- API gateway-specific development processes and standards
- Comprehensive issue management system with script automation
- Go-specific testing guidelines for multi-service architecture

New Documentation:
- devdocs/KONZEPT.md: project philosophy, architecture, service integration patterns
- devdocs/TESTING_GUIDELINES.md: Go testing, API tests, gateway-service integration
- devdocs/development-process.md: API gateway development, multi-service coordination
- devdocs/furt-issue-management-guide.md: Furt-specific issue management workflows

Issue Management System:
- scripts/create_issue.sh: 8 preconfigured templates for API gateway development
- Furt-specific issue types: service-request, architecture, performance, security
- Script-based workflows for efficient development
- Integration with existing get_issues.sh and update_issue.sh scripts

API Gateway Development Standards:
- Service integration patterns for gateway ↔ service communication
- API-contract-first development with OpenAPI specifications
- Security-first patterns for authentication and input validation
- Multi-service testing strategies for coordinated development

This documentation enables immediate, efficient API gateway development
with clear standards, proven patterns, and automated workflows.
2025-06-03 18:45:55 +02:00
f4e8a40cdf feat: Initiale Furt API-Gateway Projektstruktur
- Go-Projektstruktur nach Low-Tech-Prinzipien
- Issue-Templates für Service-Requests und Bug-Reports
- Konfiguration für sichere Entwicklung (.env.example)
- Scripts-Verzeichnis für Build und Deployment
- Dokumentationsstruktur für Dev und User Docs
- Apache 2.0 Lizenz für Open-Source-Entwicklung

Furt (Durchgang) vereint Services unter einheitlicher API
für vollständige digitale Souveränität.
2025-06-03 16:39:17 +02:00
Michael von den Drachen
80e27a773b README.md hinzugefügt 2025-06-03 16:34:05 +02:00