infra

package
v1.30.0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2026 License: MIT Imports: 10 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrConnectionFailed = errors.New("connection failed")

Functions

func NewTOFUHostKeyCallback

func NewTOFUHostKeyCallback(addr string) (ssh.HostKeyCallback, error)

NewTOFUHostKeyCallback returns a host key callback that uses trust-on-first-use with ~/.gmapssaas/known_hosts and enforces pinned keys on later connections.

func RegisterWorkerProvisioner

func RegisterWorkerProvisioner(name string, factory func(string) WorkerProvisioner)

RegisterWorkerProvisioner registers a factory function for a provider name. Called by provider packages in their init() functions.

Types

type DOConfig

type DOConfig struct {
	Token    string `json:"token"`
	Region   string `json:"region"`              // App Platform region (e.g., "nyc")
	DBSize   string `json:"db_size,omitempty"`   // e.g., "db-s-1vcpu-1gb"
	DBRegion string `json:"db_region,omitempty"` // e.g., "nyc3"
	AppID    string `json:"app_id,omitempty"`    // set after deploy
	DBID     string `json:"db_id,omitempty"`     // set after DB creation
}

DOConfig holds DigitalOcean App Platform provisioning configuration.

type DatabaseInfo

type DatabaseInfo struct {
	ConnectionURL string
}

type DeployConfig

type DeployConfig struct {
	Registry      *RegistryConfig
	DatabaseURL   string
	EncryptionKey string
	HashSalt      string
}

DeployConfig is a struct that holds all the required inforation a provider neds to deploy an image

type DockerImageBuilder

type DockerImageBuilder interface {
	BuildImage(ctx context.Context, dockerfilePath, imageName string) error
}

type HetznerConfig

type HetznerConfig struct {
	Token    string `json:"token"`
	ServerID int64  `json:"server_id,omitempty"` // set after server creation
}

HetznerConfig holds Hetzner Cloud provisioning configuration.

type PlanetScaleConfig

type PlanetScaleConfig struct {
	Token string `json:"token"`
	Org   string `json:"org"`
}

PlanetScaleConfig holds PlanetScale database configuration.

type Provisioner

type Provisioner interface {
	// CheckConnectivity checks if the provision can access the provider
	CheckConnectivity(ctx context.Context) error
	// ExecuteCommand executes a command on the provider
	ExecuteCommand(ctx context.Context, command string) (string, error)
	// CreateDatabase provisions a database in the provier
	CreateDatabase(ctx context.Context) (*DatabaseInfo, error)
	// Deploy deploys the provided config on the provider
	Deploy(ctx context.Context, cfg *DeployConfig) error
}

type Region

type Region struct {
	Slug string
	Name string
}

Region represents a cloud provider region.

type RegistryConfig

type RegistryConfig struct {
	URL      string `json:"url"`
	Username string `json:"username"`
	Token    string `json:"token"`
	Image    string `json:"image"`
}

RegistryConfig is a struct that holds the required data to connect to a docker registry

type SSHKey

type SSHKey struct {
	Key string `json:"key"`
	Pub string `json:"pub"`
}

SSHKey just represents an ssh key pair

type Size

type Size struct {
	Slug         string
	Description  string
	PriceMonthly float64
	VCPUs        int
	Memory       int      // MB
	Disk         int      // GB
	Regions      []string // region slugs where this size is available (empty = all)
}

Size represents a cloud provider instance size.

type VPSConfig

type VPSConfig struct {
	Host    string `json:"host"`
	Port    string `json:"port"`
	User    string `json:"user"`
	KeyPath string `json:"key_path"`
	Domain  string `json:"domain"`
}

VPSConfig is a struct that holds the required data to connect to a VPS server

type WorkerCreateRequest

type WorkerCreateRequest struct {
	Name      string
	Region    string
	Size      string
	SSHPubKey string // authorized_keys format
	UserData  string // cloud-init script (from cloudinit.Generate())
	Tags      []string
}

WorkerCreateRequest contains the parameters for creating a worker droplet.

type WorkerCreateResult

type WorkerCreateResult struct {
	ResourceID string // provider-specific resource ID as string
	Name       string
	Region     string
	Size       string
	Status     string
	IPAddress  string // may be empty initially
}

WorkerCreateResult contains the result of creating a worker droplet.

type WorkerProvisioner

type WorkerProvisioner interface {
	// EnsureSSHKey ensures the given public key exists on the provider and returns its ID.
	EnsureSSHKey(ctx context.Context, pubKey string) (keyID string, err error)

	// ListRegions returns the available regions from the provider.
	ListRegions(ctx context.Context) ([]Region, error)

	// ListSizes returns the available instance sizes from the provider.
	ListSizes(ctx context.Context) ([]Size, error)

	// CreateWorker creates a new worker instance.
	CreateWorker(ctx context.Context, req *WorkerCreateRequest) (*WorkerCreateResult, error)

	// GetWorkerStatus returns the current status and IP of a worker instance.
	GetWorkerStatus(ctx context.Context, resourceID string) (*WorkerStatus, error)

	// DeleteWorker destroys a worker instance.
	DeleteWorker(ctx context.Context, resourceID string) error
}

WorkerProvisioner defines the interface for provisioning worker instances on a cloud provider. Separate from the Provisioner interface which handles main VPS management.

func NewWorkerProvisioner

func NewWorkerProvisioner(provider, token string) (WorkerProvisioner, error)

NewWorkerProvisioner creates a WorkerProvisioner for the given provider.

type WorkerStatus

type WorkerStatus struct {
	ResourceID string
	Status     string // e.g. "new", "active", "off", "archive"
	IPAddress  string
}

WorkerStatus contains the current status of a worker droplet.

Directories

Path Synopsis
Package cloudinit provides cloud-init script generation for worker provisioning.
Package cloudinit provides cloud-init script generation for worker provisioning.
Package planetscale provides database provisioning via the PlanetScale API.
Package planetscale provides database provisioning via the PlanetScale API.

Jump to

Keyboard shortcuts

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