Skip to content

installers.k8s.element_chat #

Element Chat Kubernetes Installer

A Kubernetes installer for Element Chat (Matrix Conduit + Element Web) with TFGrid Gateway integration.

Overview

This installer deploys a complete Matrix chat solution consisting of:

  • Conduit: A lightweight Matrix homeserver implementation
  • Element Web: A modern web client for Matrix
  • TFGW (ThreeFold Gateway): Provides public FQDNs with TLS termination

Quick Start

import incubaid.herolib.installers.k8s.element_chat

// Create and install Element Chat with defaults
mut installer := element_chat.get(
    name:   'myelementchat'
    create: true
)!

installer.install()!

Configuration Options

All configuration options are optional and have sensible defaults:

Hostnames and Namespace

installer.matrix_hostname = 'matrixchat'    // Default: '${installer.name}matrix'
installer.element_hostname = 'elementchat'  // Default: '${installer.name}element'
installer.namespace = 'chat-namespace'                // Default: '${installer.name}-element-chat-namespace'

Note: Use only alphanumeric characters in hostnames (no underscores or dashes).

Conduit (Matrix Homeserver) Configuration

// Server port
installer.conduit_port = 6167               // Default: 6167

// Database configuration
installer.database_backend = 'rocksdb'      // Default: 'rocksdb' (options: 'rocksdb', 'sqlite')
installer.database_path = '/var/lib/matrix-conduit'  // Default: '/var/lib/matrix-conduit'

// Federation and registration
installer.allow_registration = true         // Default: true (allow new user registration)
installer.allow_federation = true           // Default: true (federate with other Matrix servers)

// Logging
installer.log_level = 'info'                // Default: 'info' (options: 'info', 'debug', 'warn', 'error')

Element Web Client Configuration

installer.element_brand = 'Element'         // Default: 'Element' (customize the branding name)

Full Example

import incubaid.herolib.installers.k8s.element_chat

mut installer := element_chat.get(
    name:   'myelementchat'
    create: true
)!

// Configure hostnames
installer.matrix_hostname = 'mymatrix'
installer.element_hostname = 'mychat'
installer.namespace = 'chat'

// Configure Conduit
installer.conduit_port = 6167
installer.database_backend = 'rocksdb'
installer.allow_registration = false        // Disable public registration
installer.allow_federation = true
installer.log_level = 'debug'

// Configure Element
installer.element_brand = 'My Chat'

// Install
installer.install()!

println('Matrix homeserver: https://${installer.matrix_hostname}.gent01.grid.tf')
println('Element web client: https://${installer.element_hostname}.gent01.grid.tf')

Management

Check Installation Status

if installer.installed()! {
    println('Element Chat is installed')
} else {
    println('Element Chat is not installed')
}

Destroy Deployment

installer.destroy()!

This will delete the entire namespace and all resources within it.

See Also

Constants #

const version = '0.0.0'

fn delete #

fn delete(args ArgsGet) !

fn exists #

fn exists(args ArgsGet) !bool

does the config exists?

fn get #

fn get(args ArgsGet) !&ElementChat

fn heroscript_loads #

fn heroscript_loads(heroscript string) !ElementChat

///////////NORMALLY NO NEED TO TOUCH

fn installed #

fn installed() !bool

checks if a certain version or above is installed

fn list #

fn list(args ArgsList) ![]&ElementChat

if fromdb set: load from filesystem, and not from mem, will also reset what is in mem

fn new #

fn new(args ArgsGet) !&ElementChat

fn play #

fn play(mut plbook PlayBook) !

fn set #

fn set(o ElementChat) !

register the config for the future

fn switch #

fn switch(name string)

switch instance to be used for element_chat

struct ArgsGet #

@[params]
struct ArgsGet {
pub mut:
	name   string = 'element_chat'
	fromdb bool // will load from filesystem
	create bool // default will not create if not exist
}

///////FACTORY

struct ArgsList #

@[params]
struct ArgsList {
pub mut:
	fromdb bool // will load from filesystem
}

struct ElementChat #

@[heap]
struct ElementChat {
pub mut:
	name             string = 'elementchat'
	matrix_hostname  string
	element_hostname string
	namespace        string
	// Conduit configuration
	conduit_port       int    = 6167
	database_backend   string = 'rocksdb'
	database_path      string = '/var/lib/matrix-conduit'
	allow_registration bool   = true
	allow_federation   bool   = true
	log_level          string = 'info'
	// Element configuration
	element_brand string = 'Element'
	// Internal paths
	chat_app_path    string = '/tmp/element_chat/chat-app.yaml'
	tfgw_path        string = '/tmp/element_chat/tfgw-element.yaml'
	conduit_cfg_path string = '/tmp/element_chat/conduit.toml'
	element_cfg_path string = '/tmp/element_chat/element-config.json'
	kube_client      kubernetes.KubeClient @[skip]
}

fn (ElementChat) destroy #

fn (mut self ElementChat) destroy() !

fn (ElementChat) install #

fn (mut self ElementChat) install(args InstallArgs) !

fn (ElementChat) reload #

fn (mut self ElementChat) reload() !

load from disk and make sure is properly intialized

struct InstallArgs #

@[params]
struct InstallArgs {
pub mut:
	reset bool
}