feat: migrate Redis installer and integrate into coordinator

- Created coordinator installer
- Migrated Redis installer to new modular pattern (_model.v, _actions.v, _factory_.v)
- Fixed Redis config template for 7.0.15 compatibility (commented out unsupported directives)
- Added Redis dependency check to coordinator installer
- Coordinator now auto-installs and starts Redis if not available
- Added progress indicators to coordinator build process
- Consolidated Redis example scripts
- All tests passing: Redis installation, coordinator build, and idempotency verified
This commit is contained in:
peternashaat
2025-11-14 13:25:35 +00:00
parent 759870e01e
commit eada09135c
19 changed files with 3857 additions and 5 deletions

View File

@@ -0,0 +1,39 @@
#!/usr/bin/env -S v -n -w -gc none -cc tcc -d use_openssl -enable-globals run
import incubaid.herolib.installers.base
import incubaid.herolib.osal.core as osal
import time
println('=== Redis Installer Example ===\n')
// Check if redis is already installed
if osal.cmd_exists_profile('redis-server') {
println(' redis-server is already installed')
// Check if it's running
if base.check(port: 6379) {
println(' Redis is running and responding')
} else {
println(' Redis is installed but not running, starting it...')
// Use systemctl to start redis
osal.exec(cmd: 'systemctl start redis-server')!
// Wait a moment for redis to start
time.sleep(1000)
if base.check(port: 6379) {
println(' Redis started successfully')
} else {
println(' Failed to start redis')
}
}
} else {
println('Redis not found, installing...')
// Install and start redis
base.redis_install(port: 6379, start: true)!
println(' Redis installed and started successfully')
}
println('\n Done!')

View File

@@ -0,0 +1,24 @@
#!/usr/bin/env -S v -n -w -gc none -cc tcc -d use_openssl -enable-globals run
import incubaid.herolib.installers.base
println('=== Testing Redis Template Application ===\n')
// Stop redis first
println('Stopping redis...')
base.stop() or {}
// Start redis (this will apply the template)
println('Starting redis with template...')
base.start(port: 6379, datadir: '/root/hero/var/redis')!
println(' Redis started')
// Verify it's running
if base.check(port: 6379) {
println(' Redis is responding to ping')
} else {
println(' Redis is not responding')
}
println('\n Done!')

Binary file not shown.

View File

@@ -0,0 +1,30 @@
#!/usr/bin/env -S v -n -w -gc none -cc tcc -d use_openssl -enable-globals run
import incubaid.herolib.installers.infra.herocoordinator
// Example usage of herocoordinator installer
// This will:
// 1. Check and install Redis if not running (required dependency)
// 2. Install Rust if not already installed
// 3. Clone the horus repository
// 4. Build the herocoordinator binary
// Build and install herocoordinator
// This will automatically check and install Redis and Rust if needed
println('Building coordinator from horus repository...')
println('(This will install Redis and Rust if not already installed)\n')
// Call build_coordinator - it will handle all dependencies
herocoordinator.build_coordinator()!
println('\n Herocoordinator built and installed successfully!')
println('Binary location: /hero/var/bin/coordinator')
// Note: To start the service, uncomment the lines below
// (requires proper zinit or screen session setup)
// herocoordinator.start()!
// if herocoordinator.running()! {
// println('Herocoordinator is running!')
// }
// herocoordinator.stop()!
// herocoordinator.destroy()!