deploy

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2026 License: MIT Imports: 6 Imported by: 0

README

togo

togo-framework/deploy

marketplace pkg.go.dev MIT

Part of the togo framework.

Install

togo install togo-framework/deploy

togo's deployment subsystem — a provider-agnostic Deployer contract (Provision/Deploy/Destroy/Status). Real targets ship as driver plugins that call deploy.RegisterDriver; pick one with DEPLOY_PROVIDER or deploy.provider in togo.yaml. The CLI's togo deploy resolves the provider and runs it.

togo install togo-framework/deploy            # the base
togo install togo-framework/deploy-docker     # a target driver

Drivers: deploy-terraform, deploy-docker, deploy-kubernetes, deploy-aws, deploy-gcp, deploy-azure, deploy-digitalocean, deploy-vultr, deploy-hetzner, deploy-ovh, deploy-ubuntu, deploy-centos, deploy-debian.

Configure (togo.yaml)

deploy:
  provider: docker
  host: 1.2.3.4
  user: root
  domain: app.example.com

DEPLOY_PROVIDER overrides provider. The default is log (no-op, safe for dev).


Premium sponsors

ID8 Media  ·  One Studio

Become a sponsor.

Documentation

Overview

Package deploy is the togo deployment subsystem — a provider-agnostic Deployer contract. Real targets (terraform, docker, kubernetes, the clouds, and VPS distros) ship as driver plugins that call deploy.RegisterDriver in their init(); pick one with DEPLOY_PROVIDER (or `deploy.provider` in togo.yaml). The CLI's `togo deploy` resolves the provider and calls Build/Deploy without booting the app.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Drivers

func Drivers() []string

Drivers lists the registered driver names (sorted) — handy for `togo deploy --list`.

func RegisterDriver

func RegisterDriver(name string, f DriverFactory)

RegisterDriver registers a deploy driver by name (call from a plugin's init()).

Types

type Deployer

type Deployer interface {
	Provision(ctx context.Context, spec Spec) (*Result, error) // create/ensure infrastructure
	Deploy(ctx context.Context, spec Spec) (*Result, error)    // ship the app
	Destroy(ctx context.Context, spec Spec) error              // tear it down
	Status(ctx context.Context, spec Spec) (*Status, error)
}

Deployer is implemented by driver plugins. Not every target supports every operation — return a clear error for the unsupported ones.

func Build

func Build(name string, k *togo.Kernel) (Deployer, error)

Build constructs the Deployer for name. The CLI uses this to deploy without booting the full kernel (pass a minimal/nil kernel where the driver allows).

type DriverFactory

type DriverFactory func(k *togo.Kernel) (Deployer, error)

DriverFactory builds a Deployer from the kernel (env-configured).

type Result

type Result struct {
	URL     string         // public URL if known
	Message string         // human summary
	Raw     map[string]any // provider raw response
}

Result of a deploy/provision.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service is the deploy runtime stored on the kernel (k.Get("deploy")).

func FromKernel

func FromKernel(k *togo.Kernel) (*Service, bool)

FromKernel fetches the deploy service from the kernel container.

func (*Service) Deploy

func (s *Service) Deploy(ctx context.Context, spec Spec) (*Result, error)

func (*Service) Deployer

func (s *Service) Deployer() Deployer

func (*Service) Destroy

func (s *Service) Destroy(ctx context.Context, spec Spec) error

func (*Service) Driver

func (s *Service) Driver() string

func (*Service) Provision

func (s *Service) Provision(ctx context.Context, spec Spec) (*Result, error)

func (*Service) Status

func (s *Service) Status(ctx context.Context, spec Spec) (*Status, error)

type Spec

type Spec struct {
	App      string            // app name
	Dir      string            // project directory
	BuildCmd string            // local build command (optional)
	Binary   string            // built artifact path (for VPS drivers)
	Image    string            // container image ref (for docker/k8s)
	Env      map[string]string // runtime env
	Host     string            // target host / cluster endpoint
	User     string            // ssh user (VPS drivers)
	Domain   string            // public domain
	Region   string            // cloud region
	Options  map[string]any    // provider-specific knobs
}

Spec describes what to deploy. Drivers use the fields they need.

type Status

type Status struct {
	Healthy bool
	Detail  string
	Raw     map[string]any
}

Status of the current deployment.

Jump to

Keyboard shortcuts

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