bootstrap

package
v0.2.0-alpha.9 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2026 License: Apache-2.0 Imports: 49 Imported by: 0

Documentation

Overview

Package bootstrap wires process startup dependencies.

Index

Constants

View Source
const AdminCommandUsage = `Usage: buildmax-server admin <command> [flags]

Commands:
  grant <email>    Grant system_admin to an existing account
  revoke <email>   Revoke system_admin from an account

These are the break-glass grant operations: create the first administrator
before any exists, and revoke the last one to recover a deployment. Listing who
holds the grant, and routine grants and revocations, are done with
` + "`buildmax admin`" + ` against a running server, or in the Portal.

A System Administrator can manage accounts, read deployment status, and search
the audit trail across spaces. The grant carries no access to any space's issues,
conversations, artifacts, files, or run traces: those stay behind space
membership.

The account must exist first — granting does not create one:

  buildmax-server user create alice@example.com
  buildmax-server admin grant alice@example.com
  buildmax-server user login-code alice@example.com

Revoking the last grant is allowed here and refused through the API, because
this command is what recovers a deployment that has none.
See docs/design/system-administration.md.
`

AdminCommandUsage is the help text for `buildmax-server admin`.

View Source
const ModelCommandUsage = `` /* 2004-byte string literal not displayed */

ModelCommandUsage is the help text for `buildmax-server model`.

View Source
const PluginPackagesDirName = ".marketplace"

PluginPackagesDirName is where a deployment with no object store keeps published packages. It is dot-prefixed so it cannot be mistaken for a space's workspace directory, which is what every other entry under workspaces_dir is.

View Source
const RunTokenCommandUsage = `` /* 477-byte string literal not displayed */

RunTokenCommandUsage is the help text for `buildmax-server run-token`.

View Source
const UserCommandUsage = `Usage: buildmax-server user <command> [flags]

Commands:
  create <email>         Create an account and its personal space
  login-code <email>     Issue a single-use login code for an existing account

Flags for login-code:
  --ttl duration         How long the code stays valid (default 1h)

These two are the break-glass account operations: bootstrap the first account
before any administrator exists, and recover one that is locked out. Routine
account work — including disabling and re-enabling — is done with
` + "`buildmax admin user`" + ` against a running server, or in the Portal.

A login code is printed once and cannot be recovered. Deliver it to the person
yourself; BuildMax has no mail channel. It is also how someone who forgot their
password gets back in: sign in with the code, then choose a new password.
See docs/deploy/authentication.md.
`

UserCommandUsage is the help text for `buildmax-server user`.

Variables

View Source
var ErrAlreadyClaimed = errors.New("task run already claimed by another worker")

ErrAlreadyClaimed is returned by RunWorker when the run was already claimed by another worker.

Functions

func BuildArtifactStorage

func BuildArtifactStorage(cfg config.WorkspaceStorageConfig, artifactDir func(spaceID, artifactID string) string, s3Client blob.S3Client) (artifactsvc.ContentStore, error)

BuildArtifactStorage returns the configured storage for artifact content. artifactDir is (spaceID, artifactID) -> directory for the local-filesystem backend; the S3 backend derives its own key and ignores it.

func BuildCheckpointStore

func BuildCheckpointStore(cfg config.WorkspaceStorageConfig, checkpointRoot string, s3Client blob.S3Client) (blob.CheckpointStore, error)

BuildCheckpointStore returns the checkpoint payload store the server owns. It uses the same backend as artifacts: object storage when one is configured, otherwise the local filesystem under checkpointRoot. The worker's own store (which writes the bytes) must address the same backend and prefix. The full store surface is returned so the server can hand the finalizer its read view and the orphan sweep its maintenance view from one instance.

func BuildPersistStorage

func BuildPersistStorage(cfg config.WorkspaceStorageConfig, persistRoot func(spaceID string) string, s3Client blob.S3Client) (blob.PersistStorage, error)

BuildPersistStorage returns the configured persist storage implementation.

func BuildPluginPackageStorage

func BuildPluginPackageStorage(cfg config.WorkspaceStorageConfig, workspacesDir string, s3Client blob.S3Client) (plugin.PackageStore, string)

BuildPluginPackageStorage returns storage for published plugin packages and the key prefix to build keys with.

There is no provider setting of its own. A deployment that has an object store keeps packages in it, and one that does not keeps them on the server's disk — the same decision it already made for everything else it stores, and one fewer knob to set inconsistently.

Packages are kept apart from space artifacts on purpose: a catalog record that vanished with a space's retention window could no longer explain an installation still sitting on somebody's machine.

func BuildS3Client

func BuildS3Client(ctx context.Context, cfg config.WorkspaceStorageConfig) (blob.S3Client, error)

BuildS3Client creates an S3-compatible client. Use when either provider is minio.

Two shapes are supported, and the endpoint is what distinguishes them: a deployment naming an endpoint is talking to a store it runs or a vendor's S3-compatible service, while one that names none is talking to AWS S3 and wants the SDK's own regional endpoint resolution.

Credentials follow the same principle. Static keys are used when configured; leaving them empty falls through to the SDK's default chain, which is how a cluster reaches a bucket through IRSA, workload identity, or an instance profile instead of a long-lived key the deployment has to store and rotate.

func BuildWorkerCheckpointStore

func BuildWorkerCheckpointStore(cfg config.WorkspaceStorageConfig, checkpointRoot string, s3Client blob.S3Client) (taskrun.CheckpointPayloadStore, error)

BuildWorkerCheckpointStore returns the store a worker writes captured checkpoint payloads to. It addresses the same backend and prefix as BuildCheckpointPayloadStore, which the server reads to verify those bytes and derive their key — the two must agree or a finalize would not find what a worker uploaded.

func RunAdminCommand

func RunAdminCommand(ctx context.Context, args []string, out io.Writer) error

RunAdminCommand executes `buildmax-server admin ...`. args excludes the "admin" word itself.

func RunModelCommand

func RunModelCommand(ctx context.Context, args []string, out io.Writer) error

RunModelCommand executes `buildmax-server model ...`. args excludes the "model" word itself.

func RunRunTokenCommand

func RunRunTokenCommand(ctx context.Context, args []string, out io.Writer) error

RunRunTokenCommand executes `buildmax-server run-token ...`. args excludes the "run-token" word itself.

func RunServer

func RunServer(ctx context.Context, portOverride int) error

RunServer loads server.yaml, resolves the listen port (flag overrides config), opens the DB, builds blob storage, starts the scheduler, and runs the HTTP server. portOverride > 0 takes priority over the port in server.yaml.

func RunUserCommand

func RunUserCommand(ctx context.Context, args []string, out io.Writer) error

RunUserCommand executes `buildmax-server user ...`. args excludes the "user" word itself.

func RunWorker

func RunWorker(ctx context.Context, taskRunID string) error

RunWorker reads server.yaml for connection and storage config, fetches the task run from the server, marks it RUNNING, executes the agent, and uploads artifacts.

Types

This section is empty.

Jump to

Keyboard shortcuts

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