Merge branch 'development_grid_deploy' into development_generator_docusaurus

* development_grid_deploy:
  Restore all needed for basic deployments, add vm example
  Update griddriver to use prebuilt binary
  Return Deployer and update references
  Update module paths
  Update grid proxy module path
  commetbft
  cleanup client for grid
This commit is contained in:
2025-03-08 10:56:16 +01:00
168 changed files with 925 additions and 2299 deletions

View File

@@ -0,0 +1,7 @@
#!/usr/bin/env -S v -n -w -gc none -cc tcc -d use_openssl -enable-globals run
import freeflowuniverse.herolib.installers.db.cometbft as cometbft_installer
// coredns_installer.delete()!
mut installer := cometbft_installer.get()!
installer.install()!

View File

@@ -8,33 +8,5 @@ import freeflowuniverse.herolib.core
core.interactive_set()! // make sure the sudo works so we can do things even if it requires those rights
// import freeflowuniverse.herolib.data.dbfs
// import freeflowuniverse.herolib.installers.lang.vlang
// import freeflowuniverse.herolib.installers.db.redis as redis_installer
// import freeflowuniverse.herolib.installers.infra.coredns as coredns_installer
// import freeflowuniverse.herolib.installers.sysadmintools.daguserver as dagu_installer
// import freeflowuniverse.herolib.installers.sysadmintools.b2 as b2_installer
// import freeflowuniverse.herolib.installers.net.mycelium as mycelium_installer
// import freeflowuniverse.herolib.osal.screen
// import freeflowuniverse.herolib.osal
// redis_installer.new()!
// dagu_installer.install(passwd:"1234",secret:"1234",restart:true)!
// coredns_installer.install()!
// mycelium_installer.install()!
// mycelium_installer.restart()!
// mut screens:=screen.new()!
// println(screens)
// dagu_installer.check(secret:"1234")!
// vlang.v_analyzer_install()!
// b2_installer.install()!
// rust.install(reset:false)!
// python.install(reset:false)!
// nodejs.install(reset:false)!
golang.install(reset: false)!
mut i1:=golang.get()!
i1.install()!

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env -S v -n -w -gc none -cc tcc -d use_openssl -enable-globals run
import freeflowuniverse.herolib.threefold.grid.models
import freeflowuniverse.herolib.threefold.grid3.models
import freeflowuniverse.herolib.threefold.grid as tfgrid
import json
import log

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env -S v -n -w -gc none -cc tcc -d use_openssl -enable-globals run
import freeflowuniverse.herolib.threefold.grid as tfgrid
import freeflowuniverse.herolib.threefold.grid.models
import freeflowuniverse.herolib.threefold.grid3.models
import log
fn main() {

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env -S v -n -w -gc none -cc tcc -d use_openssl -enable-globals run
import freeflowuniverse.herolib.threefold.grid as tfgrid
import freeflowuniverse.herolib.threefold.grid.models
import freeflowuniverse.herolib.threefold.grid3.models
import log
fn main() {

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env -S v -n -w -gc none -cc tcc -d use_openssl -enable-globals run
import freeflowuniverse.herolib.threefold.grid.models
import freeflowuniverse.herolib.threefold.grid3.models
import freeflowuniverse.herolib.threefold.grid as tfgrid
import json
import log

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env -S v -n -w -gc none -cc tcc -d use_openssl -enable-globals run
import freeflowuniverse.herolib.threefold.grid.models
import freeflowuniverse.herolib.threefold.grid3.models
import freeflowuniverse.herolib.threefold.grid as tfgrid
import log
import os

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env -S v -n -w -gc none -cc tcc -d use_openssl -enable-globals run
import freeflowuniverse.herolib.threefold.grid.models
import freeflowuniverse.herolib.threefold.grid3.models
import freeflowuniverse.herolib.threefold.grid as tfgrid
import log

View File

@@ -1,8 +1,8 @@
#!/usr/bin/env -S v -n -w -gc none -cc tcc -d use_openssl -enable-globals run
import freeflowuniverse.herolib.threefold.grid.models
import freeflowuniverse.herolib.threefold.grid3.models
import freeflowuniverse.herolib.threefold.grid as tfgrid
import freeflowuniverse.herolib.threefold.gridproxy
import freeflowuniverse.herolib.threefold.grid3.gridproxy
import flag
import rand
import json

View File

@@ -1,9 +1,9 @@
#!/usr/bin/env -S v -n -w -gc none -cc tcc -d use_openssl -enable-globals run
import freeflowuniverse.herolib.threefold.grid.models
import freeflowuniverse.herolib.threefold.grid3.models
import freeflowuniverse.herolib.threefold.grid as tfgrid
import freeflowuniverse.herolib.threefold.gridproxy
import freeflowuniverse.herolib.threefold.gridproxy.model { NodeFilter }
import freeflowuniverse.herolib.threefold.grid3.gridproxy
import freeflowuniverse.herolib.threefold.grid3.gridproxy.model { NodeFilter }
import rand
import log
import os

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env -S v -n -w -gc none -cc tcc -d use_openssl -enable-globals run
import freeflowuniverse.herolib.threefold.gridproxy
import freeflowuniverse.herolib.threefold.grid3.gridproxy
import freeflowuniverse.herolib.ui.console
contract_id := u64(119450)

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env -S v -n -w -gc none -cc tcc -d use_openssl -enable-globals run
import freeflowuniverse.herolib.threefold.grid as tfgrid
import freeflowuniverse.herolib.threefold.gridproxy
import freeflowuniverse.herolib.threefold.grid3.gridproxy
import freeflowuniverse.herolib.ui.console
fn get_contracts_example() ! {

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env -S v -n -w -gc none -cc tcc -d use_openssl -enable-globals run
import freeflowuniverse.herolib.threefold.gridproxy
import freeflowuniverse.herolib.threefold.grid3.gridproxy
import freeflowuniverse.herolib.ui.console
fn get_farms_example() ! {

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env -S v -n -w -gc none -cc tcc -d use_openssl -enable-globals run
import freeflowuniverse.herolib.threefold.gridproxy
import freeflowuniverse.herolib.threefold.grid3.gridproxy
import freeflowuniverse.herolib.ui.console
fn get_gateway_nodes_example() ! {

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env -S v -n -w -gc none -cc tcc -d use_openssl -enable-globals run
import freeflowuniverse.herolib.threefold.gridproxy
import freeflowuniverse.herolib.threefold.grid3.gridproxy
import freeflowuniverse.herolib.ui.console
mut gp_client := gridproxy.new(net: .test, cache: true)!

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env -S v -n -w -gc none -cc tcc -d use_openssl -enable-globals run
import freeflowuniverse.herolib.threefold.gridproxy
import freeflowuniverse.herolib.threefold.grid3.gridproxy
import freeflowuniverse.herolib.ui.console
fn get_nodes_example() ! {

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env -S v -n -w -gc none -cc tcc -d use_openssl -enable-globals run
import freeflowuniverse.herolib.threefold.gridproxy
import freeflowuniverse.herolib.threefold.gridproxy.model { NodeStatus }
import freeflowuniverse.herolib.threefold.grid3.gridproxy
import freeflowuniverse.herolib.threefold.grid3.gridproxy.model { NodeStatus }
import freeflowuniverse.herolib.ui.console
fn get_online_grid_stats_example() ! {

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env -S v -n -w -gc none -cc tcc -d use_openssl -enable-globals run
import freeflowuniverse.herolib.threefold.gridproxy
import freeflowuniverse.herolib.threefold.grid3.gridproxy
import freeflowuniverse.herolib.ui.console
fn get_all_twins_example() ! {

View File

@@ -1,8 +1,8 @@
#!/usr/bin/env -S v -n -w -gc none -cc tcc -d use_openssl -enable-globals run
import freeflowuniverse.herolib.threefold.grid.models
import freeflowuniverse.herolib.threefold.grid3.models
import freeflowuniverse.herolib.threefold.grid as tfgrid
import freeflowuniverse.herolib.threefold.gridproxy
import freeflowuniverse.herolib.threefold.grid3.gridproxy
import time
import flag
import rand

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env -S v -gc none -no-retry-compilation -d use_openssl -enable-globals -cg run
import freeflowuniverse.herolib.threefold.gridproxy
import freeflowuniverse.herolib.threefold.tfgrid3deployer
import freeflowuniverse.herolib.threefold.grid3.gridproxy
import freeflowuniverse.herolib.threefold.grid3.deployer
import freeflowuniverse.herolib.installers.threefold.griddriver
import os
import time
@@ -22,7 +22,6 @@ deployment.add_machine(
wireguard: true
public_ip4: false
size: 10 // 10 gig
mycelium: tfgrid3deployer.Mycelium{}
)
deployment.deploy()!

View File

@@ -1,8 +1,8 @@
#!/usr/bin/env -S v -gc none -d use_openssl -enable-globals -cg run
//#!/usr/bin/env -S v -gc none -cc tcc -d use_openssl -enable-globals -cg run
import freeflowuniverse.herolib.threefold.gridproxy
import freeflowuniverse.herolib.threefold.tfgrid3deployer
import freeflowuniverse.herolib.threefold.grid3.gridproxy
import freeflowuniverse.herolib.threefold.grid3.deployer
import freeflowuniverse.herolib.installers.threefold.griddriver
import os
import time

View File

@@ -1,8 +1,8 @@
#!/usr/bin/env -S v -gc none -no-retry-compilation -d use_openssl -enable-globals -cg run
//#!/usr/bin/env -S v -gc none -no-retry-compilation -cc tcc -d use_openssl -enable-globals -cg run
import freeflowuniverse.herolib.threefold.gridproxy
import freeflowuniverse.herolib.threefold.tfgrid3deployer
import freeflowuniverse.herolib.threefold.grid3.gridproxy
import freeflowuniverse.herolib.threefold.grid3.deployer
import freeflowuniverse.herolib.installers.threefold.griddriver
import os
import time

View File

@@ -7,8 +7,8 @@ This script automates the deployment of an OpenWebUI instance on the ThreeFold G
- V compiler installed
- OpenSSL support enabled
- herolib dependencies:
- `freeflowuniverse.herolib.threefold.gridproxy`
- `freeflowuniverse.herolib.threefold.tfgrid3deployer`
- `freeflowuniverse.herolib.threefold.grid3.gridproxy`
- `freeflowuniverse.herolib.threefold.grid3.deployer`
- `freeflowuniverse.herolib.installers.threefold.griddriver`
## Installation

View File

@@ -1,11 +1,10 @@
#!/usr/bin/env -S v -n -w -gc none -cc tcc -d use_openssl -enable-globals run
import freeflowuniverse.herolib.threefold.gridproxy
import freeflowuniverse.herolib.threefold.tfgrid3deployer
import freeflowuniverse.herolib.threefold.grid3.gridproxy
import freeflowuniverse.herolib.threefold.grid3.deployer
import freeflowuniverse.herolib.ui.console
fn main() {
v := tfgrid3deployer.get()!
println('cred: ${v}')
deployment_name := 'my_deployment27'
@@ -18,8 +17,7 @@ fn main() {
memory: 2
planetary: false
public_ip4: false
mycelium: tfgrid3deployer.Mycelium{}
nodes: [u32(167)]
nodes: [167]
)
// deployment.add_machine(
// name: 'my_vm2'
@@ -27,7 +25,6 @@ fn main() {
// memory: 2
// planetary: false
// public_ip4: true
// mycelium: tfgrid3deployer.Mycelium{}
// // nodes: [u32(164)]
// )

View File

@@ -0,0 +1,39 @@
#!/usr/bin/env -S v -n -w -gc none -cc tcc -d use_openssl -enable-globals run
import os
import freeflowuniverse.herolib.threefold.grid3.gridproxy
import freeflowuniverse.herolib.threefold.grid3.deployer
import freeflowuniverse.herolib.ui.console
const node_id = u32(2009)
const deployment_name = 'vmtestdeployment'
fn deploy_vm() ! {
mut deployment := deployer.new_deployment(deployment_name)!
deployment.add_machine(
name: 'vm1'
cpu: 1
memory: 2
planetary: false
public_ip4: true
nodes: [node_id]
)
deployment.deploy()!
println(deployment)
}
fn delete_vm() ! {
deployer.delete_deployment(deployment_name)!
}
fn main() {
if os.args.len < 2 {
println('Please provide a command: "deploy" or "delete"')
return
}
match os.args[1] {
'deploy' { deploy_vm()! }
'delete' { delete_vm()! }
else { println('Invalid command. Use "deploy" or "delete"') }
}
}

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env -S v -gc none -cc tcc -d use_openssl -enable-globals -cg run
import freeflowuniverse.herolib.threefold.gridproxy
import freeflowuniverse.herolib.threefold.tfgrid3deployer
import freeflowuniverse.herolib.threefold.grid3.gridproxy
import freeflowuniverse.herolib.threefold.grid3.deployer
import freeflowuniverse.herolib.installers.threefold.griddriver
import os
import time

View File

@@ -1,14 +1,13 @@
#!/usr/bin/env -S v -gc none -d use_openssl -enable-globals -cg run
//#!/usr/bin/env -S v -gc none -cc tcc -d use_openssl -enable-globals -cg run
import freeflowuniverse.herolib.threefold.gridproxy
import freeflowuniverse.herolib.threefold.tfgrid3deployer
import freeflowuniverse.herolib.threefold.grid3.gridproxy
import freeflowuniverse.herolib.threefold.grid3.deployer
import freeflowuniverse.herolib.installers.threefold.griddriver
import os
import time
res2:=tfgrid3deployer.filter_nodes()!
res2 := tfgrid3deployer.filter_nodes()!
println(res2)
exit(0)

View File

@@ -0,0 +1,13 @@
!!hero_code.generate_installer
name:'cometbft'
classname:'CometBFT'
singleton:0
templates:1
default:1
title:''
supported_platforms:''
reset:0
startupmanager:1
hasconfig:1
build:1

View File

@@ -0,0 +1,184 @@
module cometbft
import freeflowuniverse.herolib.osal
import freeflowuniverse.herolib.ui.console
import freeflowuniverse.herolib.core.texttools
import freeflowuniverse.herolib.core.pathlib
import freeflowuniverse.herolib.osal.systemd
import freeflowuniverse.herolib.osal.zinit
import freeflowuniverse.herolib.installers.ulist
import freeflowuniverse.herolib.installers.lang.golang
import freeflowuniverse.herolib.installers.lang.rust
import freeflowuniverse.herolib.installers.lang.python
import os
fn startupcmd() ![]zinit.ZProcessNewArgs {
mut installer := get()!
mut res := []zinit.ZProcessNewArgs{}
// THIS IS EXAMPLE CODEAND NEEDS TO BE CHANGED
// res << zinit.ZProcessNewArgs{
// name: 'cometbft'
// cmd: 'cometbft server'
// env: {
// 'HOME': '/root'
// }
// }
return res
}
fn running() !bool {
mut installer := get()!
// THIS IS EXAMPLE CODEAND NEEDS TO BE CHANGED
// this checks health of cometbft
// curl http://localhost:3333/api/v1/s --oauth2-bearer 1234 works
// url:='http://127.0.0.1:${cfg.port}/api/v1'
// mut conn := httpconnection.new(name: 'cometbft', url: url)!
// if cfg.secret.len > 0 {
// conn.default_header.add(.authorization, 'Bearer ${cfg.secret}')
// }
// conn.default_header.add(.content_type, 'application/json')
// console.print_debug("curl -X 'GET' '${url}'/tags --oauth2-bearer ${cfg.secret}")
// r := conn.get_json_dict(prefix: 'tags', debug: false) or {return false}
// println(r)
// if true{panic("ssss")}
// tags := r['Tags'] or { return false }
// console.print_debug(tags)
// console.print_debug('cometbft is answering.')
return false
}
fn start_pre() ! {
}
fn start_post() ! {
}
fn stop_pre() ! {
}
fn stop_post() ! {
}
//////////////////// following actions are not specific to instance of the object
// checks if a certain version or above is installed
fn installed() !bool {
// THIS IS EXAMPLE CODEAND NEEDS TO BE CHANGED
// res := os.execute('${osal.profile_path_source_and()!} cometbft version')
// if res.exit_code != 0 {
// return false
// }
// r := res.output.split_into_lines().filter(it.trim_space().len > 0)
// if r.len != 1 {
// return error("couldn't parse cometbft version.\n${res.output}")
// }
// if texttools.version(version) == texttools.version(r[0]) {
// return true
// }
return false
}
fn ulist_get() !ulist.UList {
return ulist.UList{}
}
// uploads to S3 server if configured
fn upload() ! {
// installers.upload(
// cmdname: 'cometbft'
// source: '${gitpath}/target/x86_64-unknown-linux-musl/release/cometbft'
// )!
}
fn install() ! {
console.print_header('install cometbft')
mut url := ''
if core.is_linux_arm() {
url = 'https://github.com/cometbft/cometbft/releases/download/v${version}/cometbft_${version}_linux_arm64.tar.gz'
} else if core.is_linux_intel() {
url = 'https://github.com/cometbft/cometbft/releases/download/v${version}/cometbft_${version}_linux_amd64.tar.gz'
} else if core.is_osx_arm() {
url = 'https://github.com/cometbft/cometbft/releases/download/v${version}/cometbft_${version}_darwin_arm64.tar.gz'
} else if osal.is_osx_intel() {
url = 'https://github.com/cometbft/cometbft/releases/download/v${version}/cometbft_${version}_darwin_amd64.tar.gz'
} else {
return error('unsported platform')
}
mut dest := osal.download(
url: url
minsize_kb: 9000
expand_dir: '/tmp/cometbft'
)!
//dest.moveup_single_subdir()!
mut binpath := dest.file_get('cometbft')!
osal.cmd_add(
cmdname: 'cometbft'
source: binpath.path
)!
}
fn build() ! {
// url := 'https://github.com/threefoldtech/cometbft'
// make sure we install base on the node
// if osal.platform() != .ubuntu {
// return error('only support ubuntu for now')
// }
// golang.install()!
// console.print_header('build cometbft')
// gitpath := gittools.get_repo(coderoot: '/tmp/builder', url: url, reset: true, pull: true)!
// cmd := '
// cd ${gitpath}
// source ~/.cargo/env
// exit 1 #todo
// '
// osal.execute_stdout(cmd)!
//
// //now copy to the default bin path
// mut binpath := dest.file_get('...')!
// adds it to path
// osal.cmd_add(
// cmdname: 'griddriver2'
// source: binpath.path
// )!
}
fn destroy() ! {
// mut systemdfactory := systemd.new()!
// systemdfactory.destroy("zinit")!
// osal.process_kill_recursive(name:'zinit')!
// osal.cmd_delete('zinit')!
// osal.package_remove('
// podman
// conmon
// buildah
// skopeo
// runc
// ')!
// //will remove all paths where go/bin is found
// osal.profile_path_add_remove(paths2delete:"go/bin")!
// osal.rm("
// podman
// conmon
// buildah
// skopeo
// runc
// /var/lib/containers
// /var/lib/podman
// /var/lib/buildah
// /tmp/podman
// /tmp/conmon
// ")!
}

View File

@@ -0,0 +1,279 @@
module cometbft
import freeflowuniverse.herolib.core.base
import freeflowuniverse.herolib.core.playbook
import freeflowuniverse.herolib.ui.console
import freeflowuniverse.herolib.sysadmin.startupmanager
import freeflowuniverse.herolib.osal.zinit
import time
__global (
cometbft_global map[string]&CometBFT
cometbft_default string
)
/////////FACTORY
@[params]
pub struct ArgsGet {
pub mut:
name string
}
fn args_get(args_ ArgsGet) ArgsGet {
mut args := args_
if args.name == '' {
args.name = 'default'
}
return args
}
pub fn get(args_ ArgsGet) !&CometBFT {
mut context := base.context()!
mut args := args_get(args_)
mut obj := CometBFT{}
if args.name !in cometbft_global {
if !exists(args)! {
set(obj)!
} else {
heroscript := context.hero_config_get('cometbft', args.name)!
mut obj_ := heroscript_loads(heroscript)!
set_in_mem(obj_)!
}
}
return cometbft_global[args.name] or {
println(cometbft_global)
// bug if we get here because should be in globals
panic('could not get config for cometbft with name, is bug:${args.name}')
}
}
// register the config for the future
pub fn set(o CometBFT) ! {
set_in_mem(o)!
mut context := base.context()!
heroscript := heroscript_dumps(o)!
context.hero_config_set('cometbft', o.name, heroscript)!
}
// does the config exists?
pub fn exists(args_ ArgsGet) !bool {
mut context := base.context()!
mut args := args_get(args_)
return context.hero_config_exists('cometbft', args.name)
}
pub fn delete(args_ ArgsGet) ! {
mut args := args_get(args_)
mut context := base.context()!
context.hero_config_delete('cometbft', args.name)!
if args.name in cometbft_global {
// del cometbft_global[args.name]
}
}
// only sets in mem, does not set as config
fn set_in_mem(o CometBFT) ! {
mut o2 := obj_init(o)!
cometbft_global[o.name] = &o2
cometbft_default = o.name
}
@[params]
pub struct PlayArgs {
pub mut:
heroscript string // if filled in then plbook will be made out of it
plbook ?playbook.PlayBook
reset bool
}
pub fn play(args_ PlayArgs) ! {
mut args := args_
mut plbook := args.plbook or { playbook.new(text: args.heroscript)! }
mut install_actions := plbook.find(filter: 'cometbft.configure')!
if install_actions.len > 0 {
for install_action in install_actions {
heroscript := install_action.heroscript()
mut obj2 := heroscript_loads(heroscript)!
set(obj2)!
}
}
mut other_actions := plbook.find(filter: 'cometbft.')!
for other_action in other_actions {
if other_action.name in ['destroy', 'install', 'build'] {
mut p := other_action.params
reset := p.get_default_false('reset')
if other_action.name == 'destroy' || reset {
console.print_debug('install action cometbft.destroy')
destroy()!
}
if other_action.name == 'install' {
console.print_debug('install action cometbft.install')
install()!
}
}
if other_action.name in ['start', 'stop', 'restart'] {
mut p := other_action.params
name := p.get('name')!
mut cometbft_obj := get(name: name)!
console.print_debug('action object:\n${cometbft_obj}')
if other_action.name == 'start' {
console.print_debug('install action cometbft.${other_action.name}')
cometbft_obj.start()!
}
if other_action.name == 'stop' {
console.print_debug('install action cometbft.${other_action.name}')
cometbft_obj.stop()!
}
if other_action.name == 'restart' {
console.print_debug('install action cometbft.${other_action.name}')
cometbft_obj.restart()!
}
}
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////# LIVE CYCLE MANAGEMENT FOR INSTALLERS ///////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
fn startupmanager_get(cat zinit.StartupManagerType) !startupmanager.StartupManager {
// unknown
// screen
// zinit
// tmux
// systemd
match cat {
.zinit {
console.print_debug('startupmanager: zinit')
return startupmanager.get(cat: .zinit)!
}
.systemd {
console.print_debug('startupmanager: systemd')
return startupmanager.get(cat: .systemd)!
}
else {
console.print_debug('startupmanager: auto')
return startupmanager.get()!
}
}
}
// load from disk and make sure is properly intialized
pub fn (mut self CometBFT) reload() ! {
switch(self.name)
self = obj_init(self)!
}
pub fn (mut self CometBFT) start() ! {
switch(self.name)
if self.running()! {
return
}
console.print_header('cometbft start')
if !installed()! {
install()!
}
configure()!
start_pre()!
for zprocess in startupcmd()! {
mut sm := startupmanager_get(zprocess.startuptype)!
console.print_debug('starting cometbft with ${zprocess.startuptype}...')
sm.new(zprocess)!
sm.start(zprocess.name)!
}
start_post()!
for _ in 0 .. 50 {
if self.running()! {
return
}
time.sleep(100 * time.millisecond)
}
return error('cometbft did not install properly.')
}
pub fn (mut self CometBFT) install_start(args InstallArgs) ! {
switch(self.name)
self.install(args)!
self.start()!
}
pub fn (mut self CometBFT) stop() ! {
switch(self.name)
stop_pre()!
for zprocess in startupcmd()! {
mut sm := startupmanager_get(zprocess.startuptype)!
sm.stop(zprocess.name)!
}
stop_post()!
}
pub fn (mut self CometBFT) restart() ! {
switch(self.name)
self.stop()!
self.start()!
}
pub fn (mut self CometBFT) running() !bool {
switch(self.name)
// walk over the generic processes, if not running return
for zprocess in startupcmd()! {
mut sm := startupmanager_get(zprocess.startuptype)!
r := sm.running(zprocess.name)!
if r == false {
return false
}
}
return running()!
}
@[params]
pub struct InstallArgs {
pub mut:
reset bool
}
pub fn (mut self CometBFT) install(args InstallArgs) ! {
switch(self.name)
if args.reset || (!installed()!) {
install()!
}
}
pub fn (mut self CometBFT) build() ! {
switch(self.name)
build()!
}
pub fn (mut self CometBFT) destroy() ! {
switch(self.name)
self.stop() or {}
destroy()!
}
// switch instance to be used for cometbft
pub fn switch(name string) {
cometbft_default = name
}
// helpers
@[params]
pub struct DefaultConfigArgs {
instance string = 'default'
}

View File

@@ -0,0 +1,52 @@
module cometbft
import freeflowuniverse.herolib.data.paramsparser
import freeflowuniverse.herolib.data.encoderhero
import os
pub const version = '0.0.0'
const singleton = false
const default = true
// THIS THE THE SOURCE OF THE INFORMATION OF THIS FILE, HERE WE HAVE THE CONFIG OBJECT CONFIGURED AND MODELLED
@[heap]
pub struct CometBFT {
pub mut:
name string = 'default'
// homedir string
// configpath string
// username string
// password string @[secret]
// title string
// host string
// port int
}
// your checking & initialization code if needed
fn obj_init(mycfg_ CometBFT) !CometBFT {
mut mycfg := mycfg_
if mycfg.password == '' && mycfg.secret == '' {
return error('password or secret needs to be filled in for ${mycfg.name}')
}
return mycfg
}
// called before start if done
fn configure() ! {
// mut installer := get()!
// mut mycode := $tmpl('templates/atemplate.yaml')
// mut path := pathlib.get_file(path: cfg.configpath, create: true)!
// path.write(mycode)!
// console.print_debug(mycode)
}
/////////////NORMALLY NO NEED TO TOUCH
pub fn heroscript_dumps(obj CometBFT) !string {
return encoderhero.encode[CometBFT](obj)!
}
pub fn heroscript_loads(heroscript string) !CometBFT {
mut obj := encoderhero.decode[CometBFT](heroscript)!
return obj
}

View File

@@ -0,0 +1,44 @@
# cometbft
To get started
```vlang
import freeflowuniverse.herolib.installers.db.cometbft as cometbft_installer
heroscript:="
!!cometbft.configure name:'test'
password: '1234'
port: 7701
!!cometbft.start name:'test' reset:1
"
cometbft_installer.play(heroscript=heroscript)!
//or we can call the default and do a start with reset
//mut installer:= cometbft_installer.get()!
//installer.start(reset:true)!
```
## example heroscript
```hero
!!cometbft.configure
homedir: '/home/user/cometbft'
username: 'admin'
password: 'secretpassword'
title: 'Some Title'
host: 'localhost'
port: 8888
```

View File

@@ -0,0 +1,5 @@
name: ${cfg.configpath}

View File

@@ -7,7 +7,6 @@
default:1
title:''
supported_platforms:''
reset:0
startupmanager:0
build:1
hasconfig:0

View File

@@ -1,15 +1,15 @@
module griddriver
import freeflowuniverse.herolib.osal
import freeflowuniverse.herolib.ui.console
import freeflowuniverse.herolib.core
import freeflowuniverse.herolib.core.texttools
import freeflowuniverse.herolib.installers.ulist
import freeflowuniverse.herolib.installers.lang.golang
import freeflowuniverse.herolib.develop.gittools
import os
// checks if a certain version or above is installed
fn installed() !bool {
res := os.execute('/bin/bash -c "griddriver --version"')
res := os.execute("griddriver --version")
if res.exit_code != 0 {
return false
}
@@ -26,7 +26,6 @@ fn installed() !bool {
return true
}
// get the Upload List of the files
fn ulist_get() !ulist.UList {
// optionally build a UList which is all paths which are result of building, is then used e.g. in upload
return ulist.UList{}
@@ -36,45 +35,36 @@ fn ulist_get() !ulist.UList {
fn upload() ! {}
fn install() ! {
console.print_header('install griddriver')
build()!
console.print_header('install griddriver OK')
}
fn build() ! {
console.print_header('build griddriver')
mut installer := golang.get()!
installer.install()!
mut gs := gittools.get()!
url := 'https://github.com/threefoldtech/web3gw/tree/development_integration/griddriver'
mut repo := gs.get_repo(
url: url
reset: true
pull: true
)!
mut path := repo.path()
path = '${path}/griddriver'
cmd := '/bin/bash -c "cd ${path} && . ${path}/build.sh"'
res := os.execute(cmd)
if res.exit_code != 0 {
return error('failed to build: ${res.output}')
console.print_header('installing griddriver')
mut url := ''
if core.is_linux_arm()! {
url = 'https://github.com/threefoldtech/griddriver/releases/download/v${version}/griddriver_${version}_linux_arm64'
} else if core.is_linux_intel()! {
url = 'https://github.com/threefoldtech/griddriver/releases/download/v${version}/griddriver_${version}_linux_amd64'
} else if core.is_osx_arm()! {
url = 'https://github.com/threefoldtech/griddriver/releases/download/v${version}/griddriver_${version}_darwin_arm64'
} else if core.is_osx_intel()! {
url = 'https://github.com/threefoldtech/griddriver/releases/download/v${version}/griddriver_${version}_darwin_amd64'
} else {
return error('unsported platform')
}
console.print_header('build griddriver OK')
mut dest := osal.download(
url: url
minsize_kb: 1000
)!
osal.cmd_add(
cmdname: 'griddriver'
source: dest.path
)!
console.print_header('install griddriver OK')
}
fn destroy() ! {
console.print_header('uninstall griddriver')
mut res := os.execute('sudo rm -rf /usr/local/bin/griddriver')
if res.exit_code != 0 {
return error('failed to uninstall griddriver: ${res.output}')
}
res = os.execute('sudo rm -rf ~/code/github/threefoldtech/web3gw')
binpath := osal.bin_path()!
mut res := os.execute('sudo rm -rf ${binpath}/griddriver')
if res.exit_code != 0 {
return error('failed to uninstall griddriver: ${res.output}')
}

View File

@@ -91,11 +91,6 @@ pub fn (mut self GridDriverInstaller) install(args InstallArgs) ! {
}
}
pub fn (mut self GridDriverInstaller) build() ! {
switch(self.name)
build()!
}
pub fn (mut self GridDriverInstaller) destroy() ! {
switch(self.name)
destroy()!

View File

@@ -2,7 +2,7 @@ module griddriver
import freeflowuniverse.herolib.data.encoderhero
pub const version = '0.1.1'
pub const version = '0.1.2'
const singleton = true
const default = true

View File

@@ -1,18 +1,25 @@
# griddriver
To get started
To use the installer:
```vlang
import freeflowuniverse.herolib.installers.threefold.griddriver
mut installer:= griddriver.get()!
fn main() {
mut installer := griddriver.get()!
installer.install()!
}
```
installer.start()!
## example heroscript
```hero
!!griddriver.install
homedir: '/home/user/griddriver'
username: 'admin'
password: 'secretpassword'
title: 'Some Title'
host: 'localhost'
port: 8888
```

View File

@@ -1,45 +0,0 @@
module caddy
import freeflowuniverse.herolib.data.paramsparser
pub const xcaddy_version = '0.4.2'
pub const caddy_version = '2.8.4'
const singleton = true
const default = true
const heroscript_default = "
!!caddy.configure
path: ''
domain: ''
plugins: ''
"
// CaddyServer represents a Caddy server configuration.
pub struct CaddyServer {
pub mut:
// name is the name of the Caddy server.
name string = 'default'
// path is the path to the server's root directory.
path string = '/var/www'
// domain is the default domain for the server.
domain string // sort of default domain
// plugins is a list of plugins to be used by the server.
plugins []string
}
fn cfg_play(p paramsparser.Params) ! {
mut mycfg := CaddyServer{
path: p.get_default('homedir', '{HOME}/hero/var/caddy')!
domain: p.get_default('configpath', '{HOME}/hero/var/caddy/admin.yaml')!
plugins: p.get_list_default('plugins', []string{})!
}
if mycfg.path == '' && mycfg.domain == '' {
return error('path or domain needs to be filled in for caddy')
}
set(mycfg)!
}

View File

@@ -1,129 +0,0 @@
module caddy
import freeflowuniverse.herolib.core.playbook
// import freeflowuniverse.herolib.osal.zinit
import freeflowuniverse.herolib.sysadmin.startupmanager
import freeflowuniverse.herolib.ui.console
import time
@[params]
pub struct InstallPlayArgs {
pub mut:
name string = 'default'
heroscript string // if filled in then plbook will be made out of it
plbook ?playbook.PlayBook
reset bool
start bool
stop bool
restart bool
delete bool
configure bool // make sure there is at least one installed
}
pub fn play(args_ InstallPlayArgs) ! {
mut args := args_
if args.heroscript == '' {
args.heroscript = heroscript_default
}
mut plbook := args.plbook or { playbook.new(text: args.heroscript)! }
mut install_actions := plbook.find(filter: 'caddy.configure')!
if install_actions.len > 0 {
for install_action in install_actions {
mut p := install_action.params
cfg_play(p)!
}
}
}
// load from disk and make sure is properly intialized
// pub fn (mut self CaddyServer) reload() ! {
// switch(self.name)
// obj_init()!
// }
// pub fn (mut self CaddyServer) start() ! {
// switch(self.name)
// if self.running()! {
// return
// }
// console.print_header('caddy start')
// configure()!
// start_pre()!
// mut sm := startupmanager.get()!
// for zprocess in startupcmd()! {
// sm.start(zprocess.name)!
// }
// start_post()!
// for _ in 0 .. 50 {
// if self.running()! {
// return
// }
// time.sleep(100 * time.millisecond)
// }
// return error('caddy did not install properly.')
// }
// pub fn (mut self CaddyServer) install_start(args RestartArgs) ! {
// switch(self.name)
// self.install(args)!
// self.start()!
// }
// pub fn (mut self CaddyServer) stop() ! {
// switch(self.name)
// stop_pre()!
// mut sm := startupmanager.get()!
// for zprocess in startupcmd()! {
// sm.stop(zprocess.name)!
// }
// stop_post()!
// }
// pub fn (mut self CaddyServer) restart() ! {
// switch(self.name)
// self.stop()!
// self.start()!
// }
// pub fn (mut self CaddyServer) running() !bool {
// switch(self.name)
// mut sm := startupmanager.get()!
// // walk over the generic processes, if not running return
// for zprocess in startupcmd()! {
// r := sm.running(zprocess.name)!
// if r == false {
// return false
// }
// }
// return running()!
// }
// @[params]
// pub struct RestartArgs {
// pub mut:
// reset bool
// }
// pub fn (mut self CaddyServer) install(args RestartArgs) ! {
// switch(self.name)
// if args.reset || (!installed()!) {
// install()!
// }
// }
// pub fn (mut self CaddyServer) destroy() ! {
// switch(self.name)
// self.stop()!
// destroy()!
// }

View File

@@ -1,6 +1,6 @@
module deploy
import freeflowuniverse.herolib.threefold.grid.models as grid_models
import freeflowuniverse.herolib.threefold.grid3.models as grid_models
import freeflowuniverse.herolib.data.paramsparser
import freeflowuniverse.herolib.threefold.grid
import freeflowuniverse.herolib.data.encoder

View File

@@ -1,6 +1,6 @@
!!hero_code.generate_client
name:'tfgrid3deployer'
name:'deployer'
classname:'TFGridDeployer'
singleton:0
default:1

View File

@@ -1,7 +1,7 @@
module tfgrid3deployer
module deployer
import freeflowuniverse.herolib.threefold.gridproxy
import freeflowuniverse.herolib.threefold.gridproxy.model as proxy_models
import freeflowuniverse.herolib.threefold.grid3.gridproxy
import freeflowuniverse.herolib.threefold.grid3.gridproxy.model as proxy_models
@[params]
pub struct ContractGetArgs {

View File

@@ -1,11 +1,11 @@
module grid
module deployer
import os
import json
import time
import log
import freeflowuniverse.herolib.threefold.grid.models
import freeflowuniverse.herolib.threefold.griddriver
import freeflowuniverse.herolib.threefold.grid3.models
import freeflowuniverse.herolib.threefold.grid3.griddriver
import freeflowuniverse.herolib.ui.console
@[heap]

View File

@@ -1,7 +1,6 @@
module tfgrid3deployer
module deployer
import freeflowuniverse.herolib.threefold.grid.models as grid_models
import freeflowuniverse.herolib.threefold.grid
import freeflowuniverse.herolib.threefold.grid3.models as grid_models
import freeflowuniverse.herolib.ui.console
import compress.zlib
import encoding.hex
@@ -28,21 +27,21 @@ pub mut:
mut:
// Set the deployed contracts on the deployment and save the full deployment to be able to delete the whole deployment when need.
contracts GridContracts
deployer &grid.Deployer @[skip; str: skip]
deployer &Deployer @[skip; str: skip]
kvstore KVStoreFS @[skip; str: skip]
}
fn get_deployer() !grid.Deployer {
fn get_deployer() !Deployer {
mut grid_client := get()!
network := match grid_client.network {
.dev { grid.ChainNetwork.dev }
.qa { grid.ChainNetwork.qa }
.test { grid.ChainNetwork.test }
.main { grid.ChainNetwork.main }
.dev { ChainNetwork.dev }
.qa { ChainNetwork.qa }
.test { ChainNetwork.test }
.main { ChainNetwork.main }
}
return grid.new_deployer(grid_client.mnemonic, network)!
return new_deployer(grid_client.mnemonic, network)!
}
pub fn new_deployment(name string) !TFDeployment {

View File

@@ -1,8 +1,7 @@
// This file should only contains any functions, helpers that related to the deployment setup.
module tfgrid3deployer
module deployer
import freeflowuniverse.herolib.threefold.grid.models as grid_models
import freeflowuniverse.herolib.threefold.grid
import freeflowuniverse.herolib.threefold.grid3.models as grid_models
import freeflowuniverse.herolib.ui.console
import rand
@@ -12,7 +11,7 @@ mut:
workloads map[u32][]grid_models.Workload
network_handler NetworkHandler
deployer &grid.Deployer @[skip; str: skip]
deployer &Deployer @[skip; str: skip]
contracts_map map[u32]u64
name_contract_map map[string]u64
}
@@ -23,12 +22,12 @@ mut:
// - vms: Array of VMachine instances representing the virtual machines to set up workloads for
// - zdbs: Array of ZDB objects containing ZDB requirements
// - webnames: Array of WebName instances representing web names
// - deployer: Reference to the grid.Deployer for deployment operations
// - deployer: Reference to the Deployer for deployment operations
// Modifies:
// - dls: Modified DeploymentSetup struct with network, VM, and ZDB workloads set up
// Returns:
// - None
fn new_deployment_setup(network_specs NetworkSpecs, vms []VMachine, zdbs []ZDB, webnames []WebName, old_deployments map[u32]grid_models.Deployment, mut deployer grid.Deployer) !DeploymentSetup {
fn new_deployment_setup(network_specs NetworkSpecs, vms []VMachine, zdbs []ZDB, webnames []WebName, old_deployments map[u32]grid_models.Deployment, mut deployer Deployer) !DeploymentSetup {
mut dls := DeploymentSetup{
deployer: deployer
network_handler: NetworkHandler{

View File

@@ -1,10 +1,9 @@
module tfgrid3deployer
module deployer
import freeflowuniverse.herolib.threefold.gridproxy
import freeflowuniverse.herolib.threefold.gridproxy.model as gridproxy_models
import freeflowuniverse.herolib.threefold.grid3.gridproxy
import freeflowuniverse.herolib.threefold.grid3.gridproxy.model as gridproxy_models
//TODO: put all code in relation to filtering in file filter.v
// TODO: put all code in relation to filtering in file filter.v
@[params]
pub struct FilterNodesArgs {
gridproxy_models.NodeFilter
@@ -33,4 +32,4 @@ pub fn filter_nodes(args FilterNodesArgs) ![]gridproxy_models.Node {
// // if we need to iterate over all nodes, maybe we should use multi-threading
// panic('Not Implemented')
// return []
// }
// }

View File

@@ -1,4 +1,4 @@
module tfgrid3deployer
module deployer
import freeflowuniverse.herolib.core.base as context

View File

@@ -1,7 +1,6 @@
module tfgrid3deployer
module deployer
import freeflowuniverse.herolib.threefold.grid.models as grid_models
import freeflowuniverse.herolib.threefold.grid
import freeflowuniverse.herolib.threefold.grid3.models as grid_models
import freeflowuniverse.herolib.ui.console
import json
import rand
@@ -63,7 +62,7 @@ mut:
// user_access_endopoints int
user_access_configs []UserAccessConfig
deployer &grid.Deployer @[skip; str: skip]
deployer &Deployer @[skip; str: skip]
}
// TODO: maybe rename to fill_network or something similar

View File

@@ -1,4 +1,4 @@
# tfgrid3deployer
# deployer
To get started
@@ -6,9 +6,9 @@ To get started
import freeflowuniverse.herolib.clients. tfgrid3deployer
import freeflowuniverse.herolib.clients. deployer
mut client:= tfgrid3deployer.get()!
mut client:= deployer.get()!
client...
@@ -20,7 +20,7 @@ client...
## example heroscript
```hero
!!tfgrid3deployer.configure
!!deployer.configure
secret: '...'
host: 'localhost'
port: 8888

View File

@@ -1,7 +1,7 @@
module grid
module deployer
import json
import freeflowuniverse.herolib.threefold.grid.models
import freeflowuniverse.herolib.threefold.grid3.models
// TODO: decode/encode the params/result here
pub fn (mut d Deployer) rmb_deployment_changes(dst u32, contract_id u64) !string {

View File

@@ -1,4 +1,4 @@
module tfgrid3deployer
module deployer
import freeflowuniverse.herolib.core.base
import freeflowuniverse.herolib.core.playbook
@@ -39,7 +39,7 @@ pub fn get(args_ ArgsGet) !&TFGridDeployer {
if !exists(args)! {
set(obj)!
} else {
heroscript := context.hero_config_get('tfgrid3deployer', args.name)!
heroscript := context.hero_config_get('deployer', args.name)!
mut obj_ := heroscript_loads(heroscript)!
set_in_mem(obj_)!
}
@@ -47,7 +47,7 @@ pub fn get(args_ ArgsGet) !&TFGridDeployer {
return tfgrid3deployer_global[args.name] or {
println(tfgrid3deployer_global)
// bug if we get here because should be in globals
panic('could not get config for tfgrid3deployer with name, is bug:${args.name}')
panic('could not get config for deployer with name, is bug:${args.name}')
}
}
@@ -56,20 +56,20 @@ pub fn set(o TFGridDeployer) ! {
set_in_mem(o)!
mut context := base.context()!
heroscript := heroscript_dumps(o)!
context.hero_config_set('tfgrid3deployer', o.name, heroscript)!
context.hero_config_set('deployer', o.name, heroscript)!
}
// does the config exists?
pub fn exists(args_ ArgsGet) !bool {
mut context := base.context()!
mut args := args_get(args_)
return context.hero_config_exists('tfgrid3deployer', args.name)
return context.hero_config_exists('deployer', args.name)
}
pub fn delete(args_ ArgsGet) ! {
mut args := args_get(args_)
mut context := base.context()!
context.hero_config_delete('tfgrid3deployer', args.name)!
context.hero_config_delete('deployer', args.name)!
if args.name in tfgrid3deployer_global {
// del tfgrid3deployer_global[args.name]
}
@@ -95,7 +95,7 @@ pub fn play(args_ PlayArgs) ! {
mut plbook := args.plbook or { playbook.new(text: args.heroscript)! }
mut install_actions := plbook.find(filter: 'tfgrid3deployer.configure')!
mut install_actions := plbook.find(filter: 'deployer.configure')!
if install_actions.len > 0 {
for install_action in install_actions {
heroscript := install_action.heroscript()
@@ -105,7 +105,7 @@ pub fn play(args_ PlayArgs) ! {
}
}
// switch instance to be used for tfgrid3deployer
// switch instance to be used for deployer
pub fn switch(name string) {
tfgrid3deployer_default = name
}

View File

@@ -1,4 +1,4 @@
module tfgrid3deployer
module deployer
import freeflowuniverse.herolib.data.paramsparser
import freeflowuniverse.herolib.data.encoderhero

View File

@@ -1,9 +1,8 @@
module tfgrid3deployer
module deployer
import freeflowuniverse.herolib.threefold.gridproxy
import freeflowuniverse.herolib.threefold.grid
import freeflowuniverse.herolib.threefold.grid.models as grid_models
import freeflowuniverse.herolib.threefold.gridproxy.model as gridproxy_models
import freeflowuniverse.herolib.threefold.grid3.gridproxy
import freeflowuniverse.herolib.threefold.grid3.models as grid_models
import freeflowuniverse.herolib.threefold.grid3.gridproxy.model as gridproxy_models
import rand
import freeflowuniverse.herolib.ui.console
@@ -36,7 +35,7 @@ fn wireguard_routing_ip(ip string) string {
pub fn (mut deployer TFGridDeployer) mycelium_address_create() grid_models.Mycelium {
return grid_models.Mycelium{
hex_key: rand.string(32).bytes().hex()
peers: []
peers: []
}
}
@@ -44,7 +43,7 @@ fn convert_to_gigabytes(bytes u64) u64 {
return bytes * 1024 * 1024 * 1024
}
fn pick_node(mut deployer grid.Deployer, nodes []gridproxy_models.Node) !gridproxy_models.Node {
fn pick_node(mut deployer Deployer, nodes []gridproxy_models.Node) !gridproxy_models.Node {
mut node := ?gridproxy_models.Node(none)
mut checked := []bool{len: nodes.len}
mut checked_cnt := 0
@@ -69,7 +68,7 @@ fn pick_node(mut deployer grid.Deployer, nodes []gridproxy_models.Node) !gridpro
}
}
fn ping_node(mut deployer grid.Deployer, twin_id u32) bool {
fn ping_node(mut deployer Deployer, twin_id u32) bool {
if _ := deployer.client.get_zos_version(twin_id) {
return true
} else {

View File

@@ -1,4 +1,4 @@
module tfgrid3deployer
module deployer
import freeflowuniverse.herolib.ui.console
import json

View File

@@ -1,4 +1,4 @@
module tfgrid3deployer
module deployer
import json

View File

@@ -1,6 +1,6 @@
module tfgrid3deployer
module deployer
import freeflowuniverse.herolib.threefold.grid.models as grid_models
import freeflowuniverse.herolib.threefold.grid3.models as grid_models
// import freeflowuniverse.herolib.ui.console
import json

View File

@@ -3,3 +3,5 @@
Create workloads in native low level format, and then use a gridriver go binary to post it to TFChain as well as send it to ZOS.
//TODO: not sure how to use this one

View File

@@ -1,4 +1,4 @@
module grid
module deployer2
import freeflowuniverse.herolib.core.redisclient

View File

@@ -1,4 +1,4 @@
module grid
module deployer2
import freeflowuniverse.herolib.core.base
import freeflowuniverse.herolib.core.playbook

View File

@@ -1,10 +1,10 @@
module grid
module deployer2
import net.http
import json
import x.json2
import log
import freeflowuniverse.herolib.threefold.grid.models
import freeflowuniverse.herolib.threefold.grid3.models
pub struct GraphQl {
url string

View File

@@ -1,9 +1,9 @@
module grid
module deployer2
import json
import log
import freeflowuniverse.herolib.builder
import freeflowuniverse.herolib.threefold.grid.models
import freeflowuniverse.herolib.threefold.grid3.models
struct VMSpecs {
deployment_name string

View File

@@ -1,4 +1,4 @@
module grid
module deployer2
import freeflowuniverse.herolib.installers.threefold.griddriver
import os

View File

@@ -1,4 +1,4 @@
module grid
module deployer2
import freeflowuniverse.herolib.core.redisclient

View File

@@ -1,7 +1,7 @@
module griddriver
import os
import freeflowuniverse.herolib.threefold.grid.models
import freeflowuniverse.herolib.threefold.grid3.models
pub fn (mut c Client) sign_deployment(hash string) !string {
res := os.execute("griddriver sign --substrate \"${c.substrate}\" --mnemonics \"${c.mnemonic}\" --hash \"${hash}\"")

View File

@@ -5,7 +5,7 @@ Easily access Threefold grid APIs from vlang. gridproxy is v module include the
### import the client:
```v
import freeflowuniverse.herolib.threefold.gridproxy
import freeflowuniverse.herolib.threefold.grid3.gridproxy
// create a client for the testnet, with API cache disabled
// you can pass true as second arg to enable cache

View File

@@ -3,7 +3,7 @@ module gridproxy
// client library for threefold gridproxy API.
import json
import math
import freeflowuniverse.herolib.threefold.gridproxy.model { Bill, Contract, ContractFilter, ContractIterator, Farm, FarmFilter, FarmIterator, GridStat, Node, NodeFilter, NodeIterator, NodeStats, Node_, StatFilter, Twin, TwinFilter, TwinIterator }
import freeflowuniverse.herolib.threefold.grid3.gridproxy.model { Bill, Contract, ContractFilter, ContractIterator, Farm, FarmFilter, FarmIterator, GridStat, Node, NodeFilter, NodeIterator, NodeStats, Node_, StatFilter, Twin, TwinFilter, TwinIterator }
import freeflowuniverse.herolib.ui.console
/*

View File

@@ -1,7 +1,7 @@
module gridproxy
import freeflowuniverse.herolib.core.httpconnection
import freeflowuniverse.herolib.threefold.gridproxy.model
import freeflowuniverse.herolib.threefold.grid3.gridproxy.model
// import freeflowuniverse.herolib.installers.threefold.griddriver
@[heap]

View File

@@ -1,6 +1,6 @@
module gridproxy
import freeflowuniverse.herolib.threefold.gridproxy.model { Contract, ContractFilter, Farm, FarmFilter, Node, NodeFilter, ResourceFilter, Twin }
import freeflowuniverse.herolib.threefold.grid3.gridproxy.model { Contract, ContractFilter, Farm, FarmFilter, Node, NodeFilter, ResourceFilter, Twin }
// fetch specific twin information by twin id.
//

View File

@@ -1,6 +1,6 @@
module gridproxy
import freeflowuniverse.herolib.threefold.gridproxy.model
import freeflowuniverse.herolib.threefold.grid3.gridproxy.model
import time
const cache = false

Some files were not shown because too many files have changed in this diff Show More