Skip to content

installers.k8s.cryptpad #

CryptPad Kubernetes Installer

A Kubernetes installer for CryptPad with TFGrid Gateway integration.

Quick Start

import incubaid.herolib.installers.k8s.cryptpad

// Create and install CryptPad
mut installer := cryptpad.get(
    name:   'mycryptpad'
    create: true
)!

installer.install()!

to change the hostname and the namespace, you can override the default values:

mut installer := cryptpad.get(
    name:   'mycryptpad'
    create: true
)!

installer.hostname = 'customhostname'
installer.namespace = 'customnamespace'
installer.install()!

Usage

Running the Installer

You can run the installer directly from the command line using the example script:

./examples/installers/k8s/cryptpad.vsh

This will install CryptPad with the default settings. To customize the installation, you can edit the cryptpad.vsh file.

Create an Instance

mut installer := cryptpad.get(
    name:   'mycryptpad'  // Unique name for this instance
    create: true          // Create if doesn't exist
)!

The instance name will be used as:

  • Kubernetes namespace name
  • Hostname prefix (e.g., mycryptpad.gent01.grid.tf)

Install

installer.install()!

This will:

  1. Generate Kubernetes YAML files for CryptPad and TFGrid Gateway
  2. Apply them to your k3s cluster
  3. Wait for deployment to be ready

Destroy

installer.destroy()!

Removes all CryptPad resources from the cluster.

Requirements

  • kubectl installed and configured
  • k3s cluster running
  • Redis server running (for configuration storage)

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) !&CryptpadServer

fn heroscript_loads #

fn heroscript_loads(heroscript string) !CryptpadServer

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

fn list #

fn list(args ArgsList) ![]&CryptpadServer

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

fn new #

fn new(args ArgsGet) !&CryptpadServer

fn play #

fn play(mut plbook PlayBook) !

fn set #

fn set(o CryptpadServer) !

register the config for the future

fn switch #

fn switch(name string)

switch instance to be used for cryptpad

struct ArgsGet #

@[params]
struct ArgsGet {
pub mut:
	name   string = 'cryptpad'
	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 CryptpadServer #

@[heap]
struct CryptpadServer {
pub mut:
	name               string = 'cryptpad'
	hostname           string
	namespace          string
	cryptpad_path      string = '/tmp/cryptpad/cryptpad.yaml'
	tfgw_cryptpad_path string = '/tmp/cryptpad/tfgw-cryptpad.yaml'
	config_js_path     string = '/tmp/cryptpad/config.js'
	kube_client        kubernetes.KubeClient @[skip]
}

fn (CryptpadServer) destroy #

fn (mut self CryptpadServer) destroy() !

fn (CryptpadServer) install #

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

fn (CryptpadServer) reload #

fn (mut self CryptpadServer) reload() !

load from disk and make sure is properly intialized

struct InstallArgs #

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