providers

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckDockerInstalled

func CheckDockerInstalled() error

CheckDockerInstalled verifies that docker is installed and accessible

func CheckFlyctlInstalled

func CheckFlyctlInstalled() error

CheckFlyctlInstalled verifies that flyctl is installed and accessible

func GetDockerVersion

func GetDockerVersion() (string, error)

GetDockerVersion returns the installed docker version

func GetFlyctlVersion

func GetFlyctlVersion() (string, error)

GetFlyctlVersion returns the installed flyctl version

Types

type DockerClient

type DockerClient struct {
	ImageTag      string
	ContainerName string
	Port          int
}

DockerClient wraps docker CLI commands for local Docker deployments

func NewDockerClient

func NewDockerClient(containerName string, port int) *DockerClient

NewDockerClient creates a new Docker client

func (*DockerClient) Build

func (d *DockerClient) Build(appDir string) error

Build builds a Docker image from the app directory with caching enabled

func (*DockerClient) Destroy

func (d *DockerClient) Destroy() error

Destroy removes the container and optionally the image Set DOCKER_CLEANUP_IMAGES=1 to remove images (default: keep for caching)

func (*DockerClient) Exec

func (d *DockerClient) Exec(command ...string) (string, error)

Exec runs a command inside the running container

func (*DockerClient) GetContainerURL

func (d *DockerClient) GetContainerURL() string

GetContainerURL returns the URL to access the container

func (*DockerClient) InspectFilesystem

func (d *DockerClient) InspectFilesystem() (map[string]string, error)

InspectFilesystem logs the container's filesystem for debugging

func (*DockerClient) Logs

func (d *DockerClient) Logs(lines int) (string, error)

Logs retrieves the last N lines of logs from the container

func (*DockerClient) Remove

func (d *DockerClient) Remove() error

Remove removes the Docker container

func (*DockerClient) RemoveImage

func (d *DockerClient) RemoveImage() error

RemoveImage removes the Docker image

func (*DockerClient) Run

func (d *DockerClient) Run() error

Run starts a Docker container from the built image

func (*DockerClient) Status

func (d *DockerClient) Status() (*DockerContainerStatus, error)

Status returns the status of the Docker container

func (*DockerClient) Stop

func (d *DockerClient) Stop() error

Stop stops the Docker container

func (*DockerClient) WaitForReady

func (d *DockerClient) WaitForReady(timeout time.Duration) error

WaitForReady waits for the container to be ready and responding to HTTP requests

type DockerContainerStatus

type DockerContainerStatus struct {
	ID      string
	Name    string
	Status  string
	Running bool
	Port    int
}

DockerContainerStatus represents the status of a Docker container

type FlyAppStatus

type FlyAppStatus struct {
	Name       string
	Status     string
	Hostname   string
	Version    int
	Deployed   bool
	Allocation string
}

FlyAppStatus represents the status of a Fly.io app

type FlyClient

type FlyClient struct {
	APIToken string
	OrgSlug  string
}

FlyClient wraps flyctl CLI commands for Fly.io deployments

func NewFlyClient

func NewFlyClient(apiToken, orgSlug string) *FlyClient

NewFlyClient creates a new Fly.io client

func (*FlyClient) CreateVolume

func (f *FlyClient) CreateVolume(appName, region string, sizeGB int) (string, error)

CreateVolume creates a volume for a Fly.io app

func (*FlyClient) Deploy

func (f *FlyClient) Deploy(appName, appDir string, region string) error

Deploy deploys an app to Fly.io

func (*FlyClient) Destroy

func (f *FlyClient) Destroy(appName string) error

Destroy removes a Fly.io app and all its resources

func (*FlyClient) GetAppURL

func (f *FlyClient) GetAppURL(appName string) (string, error)

GetAppURL returns the URL for a Fly.io app

func (*FlyClient) Launch

func (f *FlyClient) Launch(appName, region string) error

Launch creates a new Fly.io app

func (*FlyClient) ListApps

func (f *FlyClient) ListApps() ([]string, error)

ListApps returns all apps in the organization

func (*FlyClient) Status

func (f *FlyClient) Status(appName string) (*FlyAppStatus, error)

Status returns the status of a Fly.io app

func (*FlyClient) WaitForAppReady

func (f *FlyClient) WaitForAppReady(appName string, timeout time.Duration) error

WaitForAppReady waits for a Fly.io app to be ready

type MockAppStatus

type MockAppStatus struct {
	Name      string
	Status    string // "running", "stopped", "deploying"
	URL       string
	Region    string
	CreatedAt time.Time
	Deployed  bool
}

MockAppStatus represents the status of a mock app

type MockFlyClient

type MockFlyClient struct {
	// Simulated state
	Apps    map[string]*MockAppStatus
	Volumes map[string]*MockVolume

	// Configuration
	SimulateDelay    bool          // If true, adds realistic delays
	SimulateFailures bool          // If true, randomly fails operations
	FailureRate      float64       // Probability of failure (0.0 - 1.0)
	DeployDuration   time.Duration // How long to simulate deployment
}

MockFlyClient simulates Fly.io API calls for fast testing without actual deployments

func NewMockFlyClient

func NewMockFlyClient() *MockFlyClient

NewMockFlyClient creates a new mock Fly.io client

func (*MockFlyClient) CreateVolume

func (m *MockFlyClient) CreateVolume(appName, region string, sizeGB int) (string, error)

CreateVolume creates a mock volume

func (*MockFlyClient) Deploy

func (m *MockFlyClient) Deploy(appName, appDir string) error

Deploy simulates deploying an app

func (*MockFlyClient) Destroy

func (m *MockFlyClient) Destroy(appName string) error

Destroy removes a mock app and its volumes

func (*MockFlyClient) GetAppURL

func (m *MockFlyClient) GetAppURL(appName string) (string, error)

GetAppURL returns the mock URL for an app

func (*MockFlyClient) Launch

func (m *MockFlyClient) Launch(appName, region string) error

Launch creates a new mock app

func (*MockFlyClient) ListApps

func (m *MockFlyClient) ListApps() []*MockAppStatus

ListApps returns all mock apps

func (*MockFlyClient) ListVolumes

func (m *MockFlyClient) ListVolumes() []*MockVolume

ListVolumes returns all mock volumes

func (*MockFlyClient) Reset

func (m *MockFlyClient) Reset()

Reset clears all mock state

func (*MockFlyClient) Status

func (m *MockFlyClient) Status(appName string) (*MockAppStatus, error)

Status returns the status of a mock app

func (*MockFlyClient) WaitForAppReady

func (m *MockFlyClient) WaitForAppReady(appName string, timeout time.Duration) error

WaitForAppReady simulates waiting for app to be ready

type MockVolume

type MockVolume struct {
	ID     string
	Name   string
	Region string
	SizeGB int
	AppID  string
}

MockVolume represents a mock volume

Jump to

Keyboard shortcuts

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