dockercore

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2025 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Overview

Package dockercore contains the internal functions used by the docker cmd to manage the environments

Index

Constants

This section is empty.

Variables

View Source
var ComposeFile string
View Source
var EnvFile string

Functions

func Clean added in v0.3.5

func Clean(opts CleanOpts) (*sqlc.Docker, error)

func Delete

func Delete(opts DeleteOpts) error

func Deploy

func Deploy(opts DeployOpts) (*sqlc.Docker, error)

func Export

func Export(opts ExportOpts) error

func NewEnvDir

func NewEnvDir(customEnvFilePath, customComposeFilePath, customPath, name string) (string, error)

NewEnvDir creates a new environment directory with .env and docker-compose.yaml files. If customEnvFilePath or customComposeFilePath are provided, it reads the content from those files. If they are empty strings, it uses default content for the respective files. Returns the path to the created environment directory. If any error occurs after directory creation, the directory and its contents are automatically cleaned up.

func Populate

func Populate(opts PopulateOpts) (*sqlc.Docker, error)

func Update

func Update(opts UpdateOpts) (*sqlc.Docker, error)

Update logic: find the old env, if it does not exist give an error if it exists, create a copy of it in a tmp dir if no custom env/compose files provided and not resetting, use the existing files from the tmp dir as defaults if force is set do a docker compose down on the original env then remove the contents of the env dir and create the updated env file and docker-compose using existing or embedded files as appropriate if pullImages is set before deploying pull the images for the updated env deploy the updated compose if everything goes right, delete the tmp dir and finish else restore the tmp dir, deploy the old restored env and give an error in output

Types

type CleanOpts added in v0.3.5

type CleanOpts struct {
	// Required. name of the environment
	Name string
}

func (*CleanOpts) Validate added in v0.3.5

func (c *CleanOpts) Validate() error

type DeleteOpts added in v0.2.2

type DeleteOpts struct {
	Name []string // names of environments
}

func (*DeleteOpts) Validate added in v0.2.4

func (d *DeleteOpts) Validate() error

type DeployOpts added in v0.2.0

type DeployOpts struct {
	// Optional. path to an env file to use. If not set the default embedded one will be used
	EnvFile string
	// Optional. path to a docker-compose.yaml file. If not set the default embedded one will be used
	ComposeFile string
	// Optional. path to a custom directory to store the .env and docker-compose.yaml in
	Path string
	// Required. name of the environment
	Name string
	// Optional. whether to pull the images before deploying or not
	PullImages bool
	// Optional. custom ip to use instead of localhost if set
	CustomHost string
}

func (*DeployOpts) Validate added in v0.2.0

func (d *DeployOpts) Validate() error

type DeploymentPorts added in v0.2.0

type DeploymentPorts struct {
	GUI        int
	API        int
	Backoffice int
}

type ExportOpts added in v0.2.2

type ExportOpts struct {
	// Required. Path to export the embedded docker-compose.yaml and .env files
	Path string
}

type PopulateOpts added in v0.2.2

type PopulateOpts struct {
	// Required. paths to ttl files or directories containing ttl files to populate the environment
	TTLDirs []string
	// Required. name of the environment to populate
	Name string
	// Optional. number of parallel uploads to use. If not set the default will be 1. Max is 20
	Parallel int
	// Optional. weather to populate the examples or not
	PopulateExamples bool
}

func (*PopulateOpts) Validate added in v0.2.4

func (p *PopulateOpts) Validate() error

type UpdateOpts added in v0.2.2

type UpdateOpts struct {
	// Optional. path to an env file to use. If not set the default embedded one will be used
	EnvFile string
	// Optional. path to a docker-compose.yaml file. If not set the default embedded one will be used
	ComposeFile string
	// Required. name of the environment
	Name string
	// Optional. whether to pull the images before deploying or not
	PullImages bool
	// Optional. whether to do a docker compose down before updating the environment. Useful to reset the environment's database
	Force bool
	// Optional. custom ip to use instead of localhost if set
	CustomHost string
	// Optional. reset the environment config to the embedded defaults
	Reset bool
}

func (*UpdateOpts) Validate added in v0.2.4

func (u *UpdateOpts) Validate() error

type Urls added in v0.2.0

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

Jump to

Keyboard shortcuts

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