Skip to content

threefold.tfgrid3deployer #

tfgrid3deployer

To get started




import freeflowuniverse.crystallib.clients. tfgrid3deployer

mut client:= tfgrid3deployer.get()!

client...

example heroscript

!!tfgrid3deployer.configure
    secret: '...'
    host: 'localhost'
    port: 8888

Constants #

const version = '1.0.0'

fn get #

fn get(args_ ArgsGet) !&TFGridDeployer

fn heroscript_default #

fn heroscript_default() !string

fn new_deployment #

fn new_deployment(name string) !TFDeployment

fn nodefilter #

fn nodefilter(specs VMRequirements) ![]gridproxy_models.Node

fn play #

fn play(args_ PlayArgs) !

fn switch #

fn switch(name string)

switch instance to be used for tfgrid3deployer

enum Network #

enum Network {
	dev
	main
	test
	qa
}

struct ArgsGet #

@[params]
struct ArgsGet {
pub mut:
	name string = 'default'
}

///////FACTORY

struct ContractGetArgs #

@[params]
struct ContractGetArgs {
pub mut:
	active  bool = true
	twin_id u64
}

struct DeployArgs #

struct DeployArgs {
pub mut:
	reset bool // careful will delete existing machine if tjere
}

NetworkInfo struct to represent network details

struct KVStoreFS #

struct KVStoreFS {}

Will be changed when we support the logic of the TFChain one

struct NetworkSpecs #

struct NetworkSpecs {
pub mut:
	name     string
	ip_range string
	subnet   string
	mycelium bool = true
}

NetworkInfo struct to represent network details

struct PlayArgs #

@[params]
struct PlayArgs {
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
}

struct RecoverArgs #

struct RecoverArgs {
pub mut:
	reinstall bool // reinstall if needed and run heroscript
}

NetworkInfo struct to represent network details

struct TFDeployment #

@[heap]
struct TFDeployment {
pub mut:
	name        string
	description string
	vms         []VMachine
	zdbs        []ZDB
	webnames    []WebName
	network     ?NetworkSpecs
mut:
	deployer grid.Deployer @[skip; str: skip]
	kvstore  KVStoreFS     @[skip; str: skip]
}

fn (TFDeployment) add_machine #

fn (mut self TFDeployment) add_machine(requirements VMRequirements)

Set a new machine on the deployment.

fn (TFDeployment) deploy #

fn (mut self TFDeployment) deploy() !

fn (TFDeployment) load #

fn (mut self TFDeployment) load() !TFDeployment

fn (TFDeployment) tfchain_contracts #

fn (mut self TFDeployment) tfchain_contracts(args ContractGetArgs) ![]proxy_models.Contract

Retrieves all contracts (active and inactive) on the selected grid network.

This function interacts with the Grid Proxy to retrieve all contracts associated with the twin ID of the current deployer (from GridClient).

Returns:- An array of gridproxy.Contract containing contract information.

fn (TFDeployment) vm_get #

fn (mut self TFDeployment) vm_get(vm_name string) !VMachine

struct TFGridDeployer #

struct TFGridDeployer {
pub mut:
	name     string = 'default'
	ssh_key  string
	mnemonic string
	network  Network
}

struct VMRequirements #

@[params]
struct VMRequirements {
pub mut:
	name        string
	description string
	cpu         int // vcores
	memory      int // gbyte
	public_ip4  bool
	public_ip6  bool
	planetary   bool
	mycelium    bool
	nodes       []u32 // if set will chose a node from the list to deploy on
}

MachineNetworkReq struct to represent network access configuration

struct VMachine #

struct VMachine {
pub mut:
	tfchain_id          string
	tfchain_contract_id u64 // TODO: make multiple entries
	requirements        VMRequirements
}

MachineModel struct to represent a machine and its associated details

struct WebName #

struct WebName {
pub mut:
	name string
}

struct ZDB #

struct ZDB {
pub mut:
	name string
}