daemon

package
v0.8.22 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 17, 2026 License: MIT Imports: 36 Imported by: 0

Documentation

Overview

Package daemon runs a Jokku node. The control node runs the store, the API, the scheduler and an agent; a worker (one with a node.json from joining a cluster) runs only an agent that follows the control node.

Index

Constants

View Source
const (
	DefaultDataDir     = "/var/lib/jokku"
	DefaultUser        = "jokku"
	DefaultClusterCIDR = "10.210.0.0/16"
)

Defaults for a server installed by install.sh / "jokku setup".

Variables

This section is empty.

Functions

func OutboundIP

func OutboundIP() string

OutboundIP is exported for setup, which advertises it when joining.

func Run

func Run(ctx context.Context, cfg Config, log *slog.Logger) error

func SaveNodeFile

func SaveNodeFile(dataDir string, nf *NodeFile) error

func TotalMemoryMB

func TotalMemoryMB() int

TotalMemoryMB is this machine's memory, reported when joining a cluster.

Types

type Config

type Config struct {
	DataDir string // state and builds, e.g. /var/lib/jokku
	Socket  string // API socket, e.g. /run/jokku/jokku.sock
	GitDir  string // bare repos; defaults to <DataDir>/git
	// GitUser is the account sshd runs git and CLI commands as. It owns the
	// repos and authorized_keys and may use the socket. Empty means the
	// current user (local development).
	GitUser string
	// AuthorizedKeys defaults to ~GitUser/.ssh/authorized_keys. "-" disables
	// writing it.
	AuthorizedKeys string
	ClusterCIDR    string
	NodeName       string
	// Advertise is the address other nodes reach this one at; default the
	// address used to reach the internet.
	Advertise string
	// APIListen is the TLS listener for joins and agents; "-" disables it.
	APIListen string
}

type NodeFile

type NodeFile struct {
	Role       string             `json:"role"`        // "worker" or "edge"
	Control    string             `json:"control"`     // the control node's API, host:7443 (an edge's is over the mesh)
	Pin        string             `json:"pin"`         // its TLS key
	NodeToken  string             `json:"node_token"`  // this node's credential with the control node
	AgentToken string             `json:"agent_token"` // the control node's credential with this node
	Node       types.NodeIdentity `json:"node"`
	// Peers, on an edge, are the mesh peers to start with (the control
	// node), until the control node sends the rest.
	Peers []types.Peer `json:"peers,omitempty"`
}

NodeFile is a worker's or an edge's identity and credentials, written when it joins a cluster. Its presence is what makes the daemon run as one.

func LoadNodeFile

func LoadNodeFile(dataDir string) (*NodeFile, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL