bootstrap

package
v1.0.126 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package bootstrap generates the one-click DP-node deployment artifacts: the shell install script and the docker-compose.yml that the Control Plane serves against a single-use enrollment token. Extracted from package main per ADR-0002 as a pure stdlib leaf: the HTTP handlers (token validation against the cluster store, CP address derivation from cluster state) stay in main; this package owns the templates, the image-reference resolution, and the pure request-derivation helpers — with main's trustForwardedHeaders global passed IN as a parameter.

Index

Constants

View Source
const DefaultImage = "ghcr.io/kidcarmi/culvert"

DefaultImage is the default container image; overridden by registry settings.

Variables

This section is empty.

Functions

func BaseURL

func BaseURL(r *http.Request, trustForwarded bool) string

BaseURL derives the CP's external base URL from the incoming request. trustForwarded is main's trustForwardedHeaders setting, passed in so the package stays free of main's globals.

func EnrollmentAddr

func EnrollmentAddr(r *http.Request, grpcListenAddr string, trustForwarded bool) string

EnrollmentAddr derives the gRPC Control Plane address for the enrollment URL. Uses the HTTP request's host (the IP/hostname the admin used to access the UI) combined with the gRPC port from the configured listen address. IPv6-safe: strips brackets before net.JoinHostPort to prevent double-bracketing.

func ExtractToken

func ExtractToken(path, prefix string) string

ExtractToken extracts the token segment from a bootstrap URL path. For /api/cluster/bootstrap/abc123 → "abc123" For /api/cluster/bootstrap/abc123/compose → "abc123"

func Image

func Image(settingsPath, version string) string

Image returns the image reference for DP nodes, checking registry settings first, falling back to the default ghcr.io image with the current version.

func RenderCompose

func RenderCompose(w io.Writer, image, enrollURL string) error

RenderCompose writes the docker-compose.yml for the given image ref and enrollment URL.

func RenderScript

func RenderScript(w io.Writer, cpHost, cpBase, token string) error

RenderScript writes the install script for the given CP host/base and enrollment token.

Types

This section is empty.

Jump to

Keyboard shortcuts

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