api

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: 37 Imported by: 0

Documentation

Overview

Package api is Jokku's HTTP API. Every client, including the CLI and the git hook, goes through it; nothing else mutates state.

Index

Constants

View Source
const SourceDatabase = "database"

SourceDatabase is the deploy source of a database's compose file.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Store    *store.Store
	Git      *gitrepo.Manager
	Deployer Deployer
	Log      *slog.Logger

	// DataDir holds builds and other control-node files.
	DataDir string
	// Exe is the jokku binary path written into authorized_keys and hooks.
	Exe string
	// AuthorizedKeys is the jokku user's authorized_keys file. Empty disables
	// syncing (local development).
	AuthorizedKeys string
	// Owner owns AuthorizedKeys; nil leaves ownership alone.
	Owner *sshkeys.Owner
	// Cluster is the control plane: nodes, placement, agents.
	Cluster *cluster.Controller
}

type Deployer

type Deployer interface {
	// Deploy builds the source tarball at sourcePath and rolls it out,
	// reporting progress through log as Dokku-style lines.
	Deploy(ctx context.Context, d *types.Deploy, sourcePath string, log func(string)) error
	// PS runs restart, start, stop or rebuild. Restart applies config,
	// scale and resource changes.
	PS(ctx context.Context, app, action, actor string, log func(string)) error
	// Logs streams an app's log lines.
	Logs(ctx context.Context, app string, o types.LogOptions, line func(string)) error
	// RoutesChanged tells the runtime domains or proxy settings changed.
	RoutesChanged()
}

Deployer turns sources into running releases and manages what runs.

type Server

type Server struct {
	Config
	// contains filtered or unexported fields
}

Server serves two listeners: the unix socket gets the whole API (whoever can open it is an admin), and the TLS port (Public) only joining and the agent endpoints, each authenticated with a token.

func New

func New(cfg Config) *Server

func (*Server) Public

func (s *Server) Public() http.Handler

Public is the handler for the TLS port.

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Server) SyncAuthorizedKeys

func (s *Server) SyncAuthorizedKeys(ctx context.Context) error

SyncAuthorizedKeys rewrites the jokku user's authorized_keys from the database. The daemon also calls it at startup to repair drift.

Jump to

Keyboard shortcuts

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