deploy

package
v0.12.14-0...-e6bae5f Latest Latest
Warning

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

Go to latest
Published: May 15, 2026 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Default configuration values
	DefaultBranch      = "main"
	DefaultEnvironment = "preview"
)

Variables

View Source
var Cmd = &cli.Command{
	Version:     "",
	Commands:    []*cli.Command{},
	Aliases:     []string{},
	Name:        "deploy",
	Usage:       "Deploy a pre-built Docker image",
	AcceptsArgs: true,
	Description: `Deploy a pre-built Docker image to Unkey infrastructure.

The deploy command handles the deployment lifecycle: from creating a deployment
to monitoring its status until it's ready. It automatically detects your Git
context for metadata.

USAGE:
  unkey deploy <docker-image> [flags]

DEPLOYMENT PROCESS:
1. Create deployment with pre-built Docker image
2. Monitor deployment status until active

EXAMPLES:
unkey deploy ghcr.io/user/app:v1.0.0 --project=my-project
unkey deploy myregistry.io/app:latest --project=my-project --app=api --env=production`,
	Flags:  DeployFlags,
	Action: DeployAction,
}

Cmd is the deploy command that deploys pre-built Docker images to Unkey infrastructure. It handles deployment lifecycle management with real-time status updates.

View Source
var DeployFlags = []cli.Flag{

	cli.String("project", "Project slug", cli.Required(), cli.EnvVar("UNKEY_PROJECT")),
	cli.String("app", "App slug within the project", cli.EnvVar("UNKEY_APP"), cli.Default("default")),

	cli.String("keyspace-id", "Keyspace ID for API key authentication", cli.EnvVar("UNKEY_KEYSPACE_ID")),
	cli.String("branch", "Git branch", cli.Default(DefaultBranch)),
	cli.String("commit", "Git commit SHA"),
	cli.String("env", "Environment slug to deploy to", cli.Default(DefaultEnvironment)),

	cli.String("root-key", "Root key for authentication", cli.Required(), cli.EnvVar("UNKEY_ROOT_KEY")),

	cli.String("api-base-url", "API base URL for local testing", cli.EnvVar("UNKEY_API_BASE_URL")),
}

Functions

func DeployAction

func DeployAction(ctx context.Context, cmd *cli.Command) error

Types

type ControlPlaneClient

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

ControlPlaneClient handles API operations with the control plane

func NewControlPlaneClient

func NewControlPlaneClient(opts DeployOptions) *ControlPlaneClient

NewControlPlaneClient creates a new control plane client

func (*ControlPlaneClient) CreateDeployment

func (c *ControlPlaneClient) CreateDeployment(ctx context.Context, dockerImage string) (string, error)

CreateDeployment creates a new deployment in the control plane using a pre-built docker image

func (*ControlPlaneClient) GetDeployment

GetDeployment retrieves deployment information from the control plane

func (*ControlPlaneClient) PollDeploymentStatus

func (c *ControlPlaneClient) PollDeploymentStatus(
	ctx context.Context,
	deploymentID string,
	onStatusChange func(DeploymentStatusEvent) error,
) error

PollDeploymentStatus polls for deployment changes and calls event handlers

type DeployOptions

type DeployOptions struct {
	Project     string
	App         string
	KeyspaceID  string
	DockerImage string
	Branch      string
	Commit      string
	Environment string
	RootKey     string
	APIBaseURL  string
}

DeployOptions contains all configuration for deployment

type DeploymentStatusEvent

type DeploymentStatusEvent struct {
	DeploymentID   string
	PreviousStatus components.Status
	CurrentStatus  components.Status
	Deployment     *components.V2DeployGetDeploymentResponseData
}

DeploymentStatusEvent represents a status change event

type DeploymentStepEvent

type DeploymentStepEvent struct {
	DeploymentID string
	Step         *components.V2DeployDeploymentStep
	Status       components.Status
}

DeploymentStepEvent represents a step update event

Directories

Path Synopsis
internal
ui

Jump to

Keyboard shortcuts

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