pkg

package
v0.0.0-...-1dd44bc Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2025 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRegistryCredentials

func NewRegistryCredentials(ghcrUsername string, ghcrToken string) *registryCredentials

Types

type AdvancedOptions

type AdvancedOptions struct {
	BindMountDockerSocket      bool
	NetworkModeContainer       string
	NetworkModeHost            bool
	DockerEngineSocketOverride string
}

type Config

type Config struct {
	Debug             bool     `env:"DEBUG" envDefault:"false"`
	DatabaseURL       string   `env:"DATABASE_URL" envDefault:"postgres://postgres:postgres@localhost:5332/postgres?sslmode=disable"`
	Host              string   `env:"HOST" envDefault:"0.0.0.0"`
	Port              string   `env:"PORT" envDefault:"5900"`
	AuthorizedOrigins []string `env:"AUTHORIZED_ORIGINS" envDefault:"http://localhost:3000,https://buf.build,https://graphene.fluffy-broadnose.ts.net"`
	SentryDSN         string   `env:"SENTRY_DSN" envDefault:""`
	Environment       string   `env:"ENVIRONMENT" envDefault:"development"`

	// When set, all HTTP requests will be authenticated as this user, regardless of the actual token (or lack thereof)
	DevelopmentAuthUserEmail string `env:"DEVELOPMENT_AUTH_USER_EMAIL" envDefault:""`
}

func ReadConfig

func ReadConfig() (Config, error)

type LogChannels

type LogChannels struct {
	BaseContext   context.Context
	Mixed         chan string
	ChannelClosed chan struct{}
}

func NewLogChannels

func NewLogChannels(ctx context.Context) *LogChannels

func (*LogChannels) AttachScanner

func (l *LogChannels) AttachScanner(scanner *bufio.Scanner)

func (*LogChannels) Close

func (l *LogChannels) Close()

func (*LogChannels) Consumer

func (l *LogChannels) Consumer() <-chan string

type Runner

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

func NewRunner

func NewRunner(hostSocketLocation string) *Runner

func (*Runner) ContainerIsRunning

func (r *Runner) ContainerIsRunning(ctx context.Context, containerReference string) (bool, error)

func (*Runner) ExecCommand

func (r *Runner) ExecCommand(ctx context.Context, containerReference string, command []string, logs *LogChannels) error

func (*Runner) ExecCommandString

func (r *Runner) ExecCommandString(ctx context.Context, containerReference string, command []string) (string, error)

ExecCommandString runs a single command, waiting for it to complete, then returns all stdout/stderr as a string

func (*Runner) FindFirstAvailableImage

func (r *Runner) FindFirstAvailableImage(ctx context.Context, credentials *registryCredentials, imageReferences []string) (string, error)

func (*Runner) KillContainer

func (r *Runner) KillContainer(ctx context.Context, containerReference string) error

func (*Runner) ListContainersMatchingLabel

func (r *Runner) ListContainersMatchingLabel(ctx context.Context, label string, value string) ([]types.Container, error)

func (*Runner) PullImage

func (r *Runner) PullImage(ctx context.Context, imageReference string) error

func (*Runner) PullImageWithCredentials

func (r *Runner) PullImageWithCredentials(ctx context.Context, imageReference string, credentials *registryCredentials) error

func (*Runner) RunContainer

func (r *Runner) RunContainer(ctx context.Context, imageReference string, containerReference string, commands []string, environmentVariables []string, additionalLabels map[string]string, advancedOptions *AdvancedOptions, logs *LogChannels, waitOnContainer bool) (string, error)

func (*Runner) WaitForContainerToExit

func (r *Runner) WaitForContainerToExit(ctx context.Context, containerReference string) error

type Server

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

func NewServer

func NewServer(cfg Config, db *database.DB) (*Server, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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