Documentation
¶
Overview ¶
Package dockercore contains the internal functions used by the docker cmd to manage the environments
Index ¶
- Variables
- func Clean(opts CleanOpts) (*sqlc.Docker, error)
- func Delete(opts DeleteOpts) error
- func Deploy(opts DeployOpts) (*sqlc.Docker, error)
- func Export(opts ExportOpts) error
- func NewEnvDir(customEnvFilePath, customComposeFilePath, customPath, name string) (string, error)
- func Populate(opts PopulateOpts) (*sqlc.Docker, error)
- func Update(opts UpdateOpts) (*sqlc.Docker, error)
- type CleanOpts
- type DeleteOpts
- type DeployOpts
- type DeploymentPorts
- type ExportOpts
- type PopulateOpts
- type UpdateOpts
- type Urls
Constants ¶
This section is empty.
Variables ¶
var ComposeFile string
var EnvFile string
Functions ¶
func Delete ¶
func Delete(opts DeleteOpts) error
func Export ¶
func Export(opts ExportOpts) error
func NewEnvDir ¶
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 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
}
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 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