Merge branch 'development' into development_heropods
This commit is contained in:
@@ -20,8 +20,7 @@ import incubaid.herolib.installers.lang.python
|
||||
import os
|
||||
|
||||
@if args.startupmanager
|
||||
fn startupcmd () ![]startupmanager.ZProcessNewArgs{
|
||||
mut installer := get()!
|
||||
fn (self &${args.classname}) startupcmd() ![]startupmanager.ZProcessNewArgs {
|
||||
mut res := []startupmanager.ZProcessNewArgs{}
|
||||
//THIS IS EXAMPLE CODEAND NEEDS TO BE CHANGED
|
||||
// res << startupmanager.ZProcessNewArgs{
|
||||
@@ -36,8 +35,7 @@ fn startupcmd () ![]startupmanager.ZProcessNewArgs{
|
||||
|
||||
}
|
||||
|
||||
fn running() !bool {
|
||||
mut installer := get()!
|
||||
fn (self &${args.classname}) running_check() !bool {
|
||||
//THIS IS EXAMPLE CODEAND NEEDS TO BE CHANGED
|
||||
// this checks health of ${args.name}
|
||||
// curl http://localhost:3333/api/v1/s --oauth2-bearer 1234 works
|
||||
@@ -58,19 +56,19 @@ fn running() !bool {
|
||||
return false
|
||||
}
|
||||
|
||||
fn start_pre()!{
|
||||
fn (self &${args.classname}) start_pre() ! {
|
||||
|
||||
}
|
||||
|
||||
fn start_post()!{
|
||||
fn (self &${args.classname}) start_post() ! {
|
||||
|
||||
}
|
||||
|
||||
fn stop_pre()!{
|
||||
fn (self &${args.classname}) stop_pre() ! {
|
||||
|
||||
}
|
||||
|
||||
fn stop_post()!{
|
||||
fn (self &${args.classname}) stop_post() ! {
|
||||
|
||||
}
|
||||
|
||||
@@ -80,7 +78,7 @@ fn stop_post()!{
|
||||
|
||||
@if args.cat == .installer
|
||||
// checks if a certain version or above is installed
|
||||
fn installed() !bool {
|
||||
fn (self &${args.classname}) installed() !bool {
|
||||
//THIS IS EXAMPLE CODEAND NEEDS TO BE CHANGED
|
||||
// res := os.execute('??{osal.profile_path_source_and()!} ${args.name} version')
|
||||
// if res.exit_code != 0 {
|
||||
@@ -111,7 +109,14 @@ fn upload() ! {
|
||||
|
||||
}
|
||||
|
||||
fn install() ! {
|
||||
|
||||
^^[params]
|
||||
pub struct InstallArgs {
|
||||
pub mut:
|
||||
reset bool
|
||||
}
|
||||
|
||||
fn (mut self ${args.classname}) install(args InstallArgs) ! {
|
||||
console.print_header('install ${args.name}')
|
||||
//THIS IS EXAMPLE CODEAND NEEDS TO BE CHANGED
|
||||
// mut url := ''
|
||||
@@ -143,7 +148,7 @@ fn install() ! {
|
||||
}
|
||||
|
||||
@if args.build
|
||||
fn build() ! {
|
||||
fn (mut self ${args.classname}) build() ! {
|
||||
//url := 'https://github.com/threefoldtech/${args.name}'
|
||||
|
||||
// make sure we install base on the node
|
||||
@@ -174,7 +179,8 @@ fn build() ! {
|
||||
}
|
||||
@end
|
||||
|
||||
fn destroy() ! {
|
||||
fn (mut self ${args.classname}) destroy() ! {
|
||||
self.stop()!
|
||||
|
||||
// mut systemdfactory := systemd.new()!
|
||||
// systemdfactory.destroy("zinit")!
|
||||
|
||||
@@ -169,29 +169,34 @@ pub fn play(mut plbook PlayBook) ! {
|
||||
@if args.cat == .installer
|
||||
mut other_actions := plbook.find(filter: '${args.name}.')!
|
||||
for mut other_action in other_actions {
|
||||
@if args.startupmanager
|
||||
if other_action.name in ["destroy","install","build","start","stop","restart","start_pre","start_post","stop_pre","stop_post"]{
|
||||
@else
|
||||
if other_action.name in ["destroy","install","build"]{
|
||||
@end
|
||||
mut p := other_action.params
|
||||
name := p.get_default('name', 'default')!
|
||||
reset:=p.get_default_false("reset")
|
||||
mut ${args.name}_obj:=get(name:name)!
|
||||
console.print_debug("action object:\n??{${args.name}_obj}")
|
||||
|
||||
if other_action.name == "destroy" || reset{
|
||||
console.print_debug("install action ${args.name}.destroy")
|
||||
destroy()!
|
||||
${args.name}_obj.destroy()!
|
||||
}
|
||||
if other_action.name == "install"{
|
||||
console.print_debug("install action ${args.name}.install")
|
||||
install()!
|
||||
}
|
||||
}
|
||||
@if args.startupmanager
|
||||
if other_action.name in ["start","stop","restart"]{
|
||||
mut p := other_action.params
|
||||
name := p.get('name')!
|
||||
mut ${args.name}_obj:=get(name:name)!
|
||||
console.print_debug("action object:\n??{${args.name}_obj}")
|
||||
${args.name}_obj.install(reset: reset)!
|
||||
}
|
||||
if other_action.name == "build"{
|
||||
console.print_debug("install action ${args.name}.build")
|
||||
${args.name}_obj.build()!
|
||||
}
|
||||
@if args.startupmanager
|
||||
if other_action.name == "start"{
|
||||
console.print_debug("install action ${args.name}.??{other_action.name}")
|
||||
${args.name}_obj.start()!
|
||||
}
|
||||
|
||||
if other_action.name == "stop"{
|
||||
console.print_debug("install action ${args.name}.??{other_action.name}")
|
||||
${args.name}_obj.stop()!
|
||||
@@ -200,8 +205,24 @@ pub fn play(mut plbook PlayBook) ! {
|
||||
console.print_debug("install action ${args.name}.??{other_action.name}")
|
||||
${args.name}_obj.restart()!
|
||||
}
|
||||
if other_action.name == "start_pre"{
|
||||
console.print_debug("install action ${args.name}.??{other_action.name}")
|
||||
${args.name}_obj.start_pre()!
|
||||
}
|
||||
if other_action.name == "start_post"{
|
||||
console.print_debug("install action ${args.name}.??{other_action.name}")
|
||||
${args.name}_obj.start_post()!
|
||||
}
|
||||
if other_action.name == "stop_pre"{
|
||||
console.print_debug("install action ${args.name}.??{other_action.name}")
|
||||
${args.name}_obj.stop_pre()!
|
||||
}
|
||||
if other_action.name == "stop_post"{
|
||||
console.print_debug("install action ${args.name}.??{other_action.name}")
|
||||
${args.name}_obj.stop_post()!
|
||||
}
|
||||
@end
|
||||
}
|
||||
@end
|
||||
other_action.done = true
|
||||
}
|
||||
@end
|
||||
@@ -262,15 +283,13 @@ pub fn (mut self ${args.classname}) start() ! {
|
||||
|
||||
console.print_header('installer: ${args.name} start')
|
||||
|
||||
if ! installed()!{
|
||||
install()!
|
||||
if ! self.installed()!{
|
||||
self.install()!
|
||||
}
|
||||
|
||||
configure()!
|
||||
self.start_pre()!
|
||||
|
||||
start_pre()!
|
||||
|
||||
for zprocess in startupcmd()!{
|
||||
for zprocess in self.startupcmd()!{
|
||||
mut sm:=startupmanager_get(zprocess.startuptype)!
|
||||
|
||||
console.print_debug('installer: ${args.name} starting with ??{zprocess.startuptype}...')
|
||||
@@ -280,7 +299,7 @@ pub fn (mut self ${args.classname}) start() ! {
|
||||
sm.start(zprocess.name)!
|
||||
}
|
||||
|
||||
start_post()!
|
||||
self.start_post()!
|
||||
|
||||
for _ in 0 .. 50 {
|
||||
if self.running()! {
|
||||
@@ -300,12 +319,12 @@ pub fn (mut self ${args.classname}) install_start(args InstallArgs) ! {
|
||||
|
||||
pub fn (mut self ${args.classname}) stop() ! {
|
||||
switch(self.name)
|
||||
stop_pre()!
|
||||
for zprocess in startupcmd()!{
|
||||
self.stop_pre()!
|
||||
for zprocess in self.startupcmd()!{
|
||||
mut sm:=startupmanager_get(zprocess.startuptype)!
|
||||
sm.stop(zprocess.name)!
|
||||
}
|
||||
stop_post()!
|
||||
self.stop_post()!
|
||||
}
|
||||
|
||||
pub fn (mut self ${args.classname}) restart() ! {
|
||||
@@ -318,7 +337,7 @@ pub fn (mut self ${args.classname}) running() !bool {
|
||||
switch(self.name)
|
||||
|
||||
//walk over the generic processes, if not running return
|
||||
for zprocess in startupcmd()!{
|
||||
for zprocess in self.startupcmd()!{
|
||||
if zprocess.startuptype != .screen{
|
||||
mut sm:=startupmanager_get(zprocess.startuptype)!
|
||||
r:=sm.running(zprocess.name)!
|
||||
@@ -327,37 +346,10 @@ pub fn (mut self ${args.classname}) running() !bool {
|
||||
}
|
||||
}
|
||||
}
|
||||
return running()!
|
||||
return self.running_check()!
|
||||
}
|
||||
@end
|
||||
|
||||
@@[params]
|
||||
pub struct InstallArgs{
|
||||
pub mut:
|
||||
reset bool
|
||||
}
|
||||
|
||||
pub fn (mut self ${args.classname}) install(args InstallArgs) ! {
|
||||
switch(self.name)
|
||||
if args.reset || (!installed()!) {
|
||||
install()!
|
||||
}
|
||||
}
|
||||
|
||||
@if args.build
|
||||
pub fn (mut self ${args.classname}) build() ! {
|
||||
switch(self.name)
|
||||
build()!
|
||||
}
|
||||
@end
|
||||
|
||||
pub fn (mut self ${args.classname}) destroy() ! {
|
||||
switch(self.name)
|
||||
@if args.startupmanager
|
||||
self.stop() or {}
|
||||
@end
|
||||
destroy()!
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -14,6 +14,11 @@ import incubaid.herolib.osal.tmux
|
||||
import incubaid.herolib.installers.base
|
||||
import incubaid.herolib.installers.lang.vlang
|
||||
import incubaid.herolib.installers.lang.herolib
|
||||
import incubaid.herolib.installers.horus.coordinator
|
||||
import incubaid.herolib.installers.horus.supervisor
|
||||
import incubaid.herolib.installers.horus.herorunner
|
||||
import incubaid.herolib.installers.horus.osirisrunner
|
||||
import incubaid.herolib.installers.horus.salrunner
|
||||
import incubaid.herolib.installers.virt.podman
|
||||
import incubaid.herolib.installers.infra.gitea
|
||||
import incubaid.herolib.builder
|
||||
@@ -79,6 +84,13 @@ pub fn run(args_ PlayArgs) ! {
|
||||
|
||||
giteaclient.play(mut plbook)!
|
||||
|
||||
// Horus
|
||||
coordinator.play(mut plbook)!
|
||||
supervisor.play(mut plbook)!
|
||||
herorunner.play(mut plbook)!
|
||||
osirisrunner.play(mut plbook)!
|
||||
salrunner.play(mut plbook)!
|
||||
|
||||
if args.emptycheck {
|
||||
// Ensure we did not leave any actions un‑processed
|
||||
plbook.empty_check()!
|
||||
|
||||
@@ -21,6 +21,11 @@ import incubaid.herolib.clients.zerodb_client
|
||||
import incubaid.herolib.clients.zinit
|
||||
import incubaid.herolib.develop.heroprompt
|
||||
import incubaid.herolib.installers.db.meilisearch_installer
|
||||
import incubaid.herolib.installers.horus.coordinator
|
||||
import incubaid.herolib.installers.horus.supervisor
|
||||
import incubaid.herolib.installers.horus.herorunner
|
||||
import incubaid.herolib.installers.horus.osirisrunner
|
||||
import incubaid.herolib.installers.horus.salrunner
|
||||
import incubaid.herolib.installers.infra.coredns
|
||||
import incubaid.herolib.installers.infra.gitea
|
||||
import incubaid.herolib.installers.infra.livekit
|
||||
@@ -38,7 +43,6 @@ import incubaid.herolib.installers.sysadmintools.garage_s3
|
||||
import incubaid.herolib.installers.threefold.griddriver
|
||||
import incubaid.herolib.installers.virt.cloudhypervisor
|
||||
import incubaid.herolib.installers.virt.docker
|
||||
import incubaid.herolib.installers.virt.herorunner
|
||||
import incubaid.herolib.installers.virt.kubernetes_installer
|
||||
import incubaid.herolib.installers.virt.lima
|
||||
import incubaid.herolib.installers.virt.pacman
|
||||
@@ -109,4 +113,9 @@ pub fn run_all(args_ PlayArgs) ! {
|
||||
zola.play(mut plbook)!
|
||||
hetznermanager.play(mut plbook)!
|
||||
kubernetes.play(mut plbook)!
|
||||
coordinator.play(mut plbook)!
|
||||
supervisor.play(mut plbook)!
|
||||
herorunner.play(mut plbook)!
|
||||
osirisrunner.play(mut plbook)!
|
||||
salrunner.play(mut plbook)!
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user