Documentation
¶
Overview ¶
Package server assembles the roles a mainplane-server process runs. Today that is one role, harness.
Index ¶
- Variables
- func Auth(dir string) auth.Store
- func Harness(ctx context.Context, path string) error
- func Install(c *Config, keep bool) error
- func Key(dir string) (ed25519.PrivateKey, error)
- func Move(url string, t *Tunnel) (string, error)
- func Reached(key, url string, noPointer bool) (string, error)
- func Uninstall() error
- func Up(path string) error
- func Update(v string) error
- type Config
- type DataSharing
- type Network
- type Provider
- type Tunnel
Constants ¶
This section is empty.
Variables ¶
Dir is the installed harness's, and Conf the config it runs from. Admin serves the sessions drive from Dir on Linux.
Functions ¶
func Harness ¶
Harness runs the harness role on one loopback port, behind the user's own proxy, the user's own tunnel or a quick one, until ctx ends or the listener, the mesh node or the tunnel fails: /id proves the harness key to anyone before they send a secret, /ts2021 coordinates the mesh, /derp relays between its nodes, connectors call every other route with an api key, every session that was open on start resumes. The harness joins its own mesh, and workers dial it there. The pointer and the relay map follow the harness URL. The config at path is read again when it changes: providers, links and drives apply at once.
func Install ¶
Install makes this machine run the harness at every boot, from a copy of an expanded c at Conf, or with keep from the config already there, as it is but for c's URL, which c becomes, and makes it the worker admin. It returns while the tunnel starts: the tokens it prints name no URL, and Reached waits for one. Dir is root's and the operator's alone: the config holds the keys, and admin runs code as the operator so that it may read and edit them.
func Key ¶ added in v0.5.0
func Key(dir string) (ed25519.PrivateKey, error)
Key is the harness key every token carries, made on first use.
func Move ¶ added in v0.5.9
Move makes the installed harness reached at url, behind the user's own proxy, or through t, or through a quick tunnel when both are none, restarts it, and returns its URL once workers can reach it there. Workers follow through the pointer.
func Reached ¶ added in v0.5.2
Reached waits until workers can reach the harness with key where they find it, at url when the user's own proxy carries it, and returns that URL. With noPointer they find it where it says it is on loopback. A tunnel that stops the harness fails it at once.
func Uninstall ¶ added in v0.1.1
func Uninstall() error
Uninstall stops the harness and removes its service and binary, and the worker admin. Dir stays: it holds the sessions.
Types ¶
type Config ¶
type Config struct {
HTTP string `json:"http"` // loopback address the tunnel or the user's proxy carries connectors and workers to
URL string `json:"url,omitempty"` // the harness URL, which the user's own proxy carries to HTTP: no tunnel
Tunnel *Tunnel `json:"tunnel,omitempty"` // the user's own; none, and no URL, is a quick tunnel
Providers map[string]Provider `json:"providers"`
Links [][2]string `json:"links,omitempty"` // pairs of workers, by name, that reach each other on the mesh
Drives map[string]coordinator.Drive `json:"drives,omitempty"` // by name: each one's server and workers
DataSharing *DataSharing `json:"data_sharing,omitempty"` // whether the user has opted in to data sharing; none: not asked yet
NoPointer bool `json:"no_pointer,omitempty"` // tokens carry the harness URL and nothing goes to pointer.mainplane.ai: workers join again when the URL changes
NoAdmin bool `json:"no_admin,omitempty"` // install makes this machine no worker: no agent can reach the config and keys
}
Config is the self-hosted config file. Provider values are expanded from the environment, so a key can be "$ANTHROPIC_API_KEY". The directory it is in is the harness's: the harness key, the auth table, the mesh and the tunnel are there, and sessions in sessions/ under it, the one directory a drive may ever share.
func Default ¶ added in v0.1.1
func Default() Config
Default is the config install writes when given none and none is installed: the tunnel carries workers and connectors to port 8080 on loopback, and every provider whose key is set in this environment serves. With none set, keys go in the config after install.
type DataSharing ¶ added in v0.5.6
type DataSharing struct {
At time.Time `json:"at,omitzero"`
Via string `json:"via,omitempty"`
Text string `json:"text,omitempty"`
}
DataSharing is the answer to data sharing permission: which, when, through which connector, and to which words.
type Network ¶ added in v0.5.2
Network is what a person types to make a machine a worker of the harness: its name on the pointer, then its device code.
func Cycle ¶ added in v0.5.2
Cycle gives the installed harness a new device code. Its workers stay; a machine joins with the new code only.
func LoadNetwork ¶ added in v0.5.2
LoadNetwork is the network of the harness in dir.
func Rename ¶ added in v0.5.2
Rename makes name the installed harness's network name. Its workers stay: they know the harness by its key.
type Provider ¶
type Provider struct {
Shape string `json:"shape"`
Key string `json:"key,omitempty"` // none for a shape that logs in
URL string `json:"url,omitempty"` // the base url its SDK takes; none is the vendor's own
Region string `json:"region,omitempty"` // bedrock
Session string `json:"session,omitempty"` // the header the session's routing key goes in, for a server that routes its cache on one
}
Provider is one the config names. Its name is free, and the catalog's ids are the names connectors know; its shape picks the code.