mwdd

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2022 License: GPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CommandAndEnvFromArgs

func CommandAndEnvFromArgs(args []string) ([]string, []string)

CommandAndEnvFromArgs taks arguments passed to a cobra command and extracts any prefixing env var definitions from them

func NewServiceCmd

func NewServiceCmd(name string, long string, aliases []string) *cobra.Command

NewServiceCmd a new command for a single service, such as mailhog

func NewServiceCommandCmd

func NewServiceCommandCmd(service string, command string) *cobra.Command

func NewServiceCreateCmd

func NewServiceCreateCmd(name string) *cobra.Command

func NewServiceDestroyCmd

func NewServiceDestroyCmd(name string) *cobra.Command

func NewServiceExecCmd

func NewServiceExecCmd(name string, service string) *cobra.Command

func NewServiceResumeCmd

func NewServiceResumeCmd(name string) *cobra.Command

func NewServiceSuspendCmd

func NewServiceSuspendCmd(name string) *cobra.Command

func NewServicesCmd

func NewServicesCmd(groupName string, long string, aliases []string) *cobra.Command

NewServicesCmd a new command for a set of grouped services, such as various flavours of shellbox

func NewWhereCmd

func NewWhereCmd(description string, pathProvider WherePathProvider) *cobra.Command

func UserAndGroupForDockerExecution

func UserAndGroupForDockerExecution() string

UserAndGroupForDockerExecution gets a user and group id combination for the current user that can be used for execution.

Types

type DockerComposeCommand

type DockerComposeCommand struct {
	Command          string
	CommandArguments []string
	NoOutput         bool
	MWDD             MWDD
}

DockerComposeCommand results in something like: `docker-compose <automatic project stuff> <command> <commandArguments>`.

func (DockerComposeCommand) Run

func (dcc DockerComposeCommand) Run() (stdout bytes.Buffer, stderr bytes.Buffer, err error)

func (DockerComposeCommand) RunTTY

func (dcc DockerComposeCommand) RunTTY()

type DockerComposeFile

type DockerComposeFile struct {
	Version  string                 `yaml:"version"`
	Services map[string]Service     `json:"services"`
	Volumes  map[string]interface{} `json:"volumes"`
}

func (DockerComposeFile) ServiceNames

func (dcf DockerComposeFile) ServiceNames() []string

func (DockerComposeFile) VolumeNames

func (dcf DockerComposeFile) VolumeNames() []string

type DockerExecCommand

type DockerExecCommand struct {
	DockerComposeService string
	Command              []string
	Env                  []string
	WorkingDir           string
	User                 string
}

DockerExecCommand to be run with Docker, which directly uses the docker SDK.

type MWDD

type MWDD string

MWDD representation of a mwdd v2 setup.

func DefaultForUser

func DefaultForUser() MWDD

DefaultForUser returns the default mwdd working directory for the user.

func (MWDD) Directory

func (m MWDD) Directory() string

Directory the directory containing the development environment.

func (MWDD) DockerComposeFileExistsOrExit

func (m MWDD) DockerComposeFileExistsOrExit(fileName string)

func (MWDD) DockerComposeFileName

func (m MWDD) DockerComposeFileName(name string) string

func (MWDD) DockerComposeFileServices

func (m MWDD) DockerComposeFileServices(fileName string) []string

func (MWDD) DockerComposeFileVolumes

func (m MWDD) DockerComposeFileVolumes(fileName string) []string

func (MWDD) DockerComposeProjectName

func (m MWDD) DockerComposeProjectName() string

DockerComposeProjectName the name of the docker-compose project.

func (MWDD) DockerExec

func (m MWDD) DockerExec(command DockerExecCommand)

DockerExec runs a docker exec command using the docker SDK.

func (MWDD) DockerRun

func (m MWDD) DockerRun(command DockerExecCommand)

DockerRun runs a docker container using the docker SDK attached to the mwdd network etc...

func (MWDD) DownWithVolumesAndOrphans

func (m MWDD) DownWithVolumesAndOrphans()

DownWithVolumesAndOrphans runs `docker-compose down --volumes --remove-orphans`.

func (MWDD) EnsureReady

func (m MWDD) EnsureReady()

EnsureReady ...

func (MWDD) Env

func (m MWDD) Env() dotenv.File

Env ...

func (MWDD) Exec

func (m MWDD) Exec(service string, commandAndArgs []string, user string)

Exec runs `docker-compose exec -T <service> <commandAndArgs>`.

func (MWDD) ExecNoOutput

func (m MWDD) ExecNoOutput(service string, commandAndArgs []string, user string) error

ExecNoOutput runs `docker-compose exec -T <service> <commandAndArgs>` with no output.

func (MWDD) RecordHostUsageBySite

func (m MWDD) RecordHostUsageBySite(host string)

RecordHostUsageBySite records a host in a local file as used at some point.

func (MWDD) Rm

func (m MWDD) Rm(services []string)

Rm runs `docker-compose rm --stop --force -v <services>`.

func (MWDD) RmVolumes

func (m MWDD) RmVolumes(dcVolumes []string)

RmVolumes runs `docker volume rm <volume names with docker-compose project prefixed>`.

func (MWDD) ServicesWithStatus

func (m MWDD) ServicesWithStatus(statusFilter string) []string

ServicesWithStatus lists services in the docker-compose setup that have the given status

func (MWDD) Start

func (m MWDD) Start(services []string)

Start runs `docker-compose start <services>`.

func (MWDD) Stop

func (m MWDD) Stop(services []string)

Stop runs `docker-compose stop <services>`.

func (MWDD) UpDetached

func (m MWDD) UpDetached(services []string)

UpDetached runs `docker-compose up -d <services>`.

func (MWDD) UsedHosts

func (m MWDD) UsedHosts() []string

UsedHosts lists all hosts that have been used at some point.

type Service

type Service struct {
	Image       string   `yaml:"image"`
	Entrypoint  string   `yaml:"entrypoint"`
	Volumes     []string `yaml:"volumes"`
	Environment []string `yaml:"environment"`
	DependsOn   []string `yaml:"depends_on"`
	DNS         []string `yaml:"dns"`
	Networks    []string `yaml:"networks"`
}

type WherePathProvider

type WherePathProvider func() string

Directories

Path Synopsis
Records the state of the various services that have been created or stopped.
Records the state of the various services that have been created or stopped.

Jump to

Keyboard shortcuts

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