Documentation
¶
Index ¶
- Variables
- func NewTOFUHostKeyCallback(addr string) (ssh.HostKeyCallback, error)
- func RegisterWorkerProvisioner(name string, factory func(string) WorkerProvisioner)
- type DOConfig
- type DatabaseInfo
- type DeployConfig
- type DockerImageBuilder
- type HetznerConfig
- type PlanetScaleConfig
- type Provisioner
- type Region
- type RegistryConfig
- type SSHKey
- type Size
- type VPSConfig
- type WorkerCreateRequest
- type WorkerCreateResult
- type WorkerProvisioner
- type WorkerStatus
Constants ¶
This section is empty.
Variables ¶
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 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 ¶
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 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 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. |