utils

package
v0.0.0-...-ac7f640 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2017 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// B byte
	B = 1
	// KB kilobytes
	KB = 1024 * B
	// MB megabytes
	MB = 1024 * KB
	// GB gigabytes
	GB = 1024 * MB
)
View Source
const DefaultDockerfileName = "Dockerfile"

DefaultDockerfileName is used when no dockerfile was specified

Variables

This section is empty.

Functions

func CreateTar

func CreateTar(contextDirectory, dockerfile string) (io.ReadCloser, error)

CreateTar create a build context tar for the specified project and service name. copied from libcompose https://github.com/docker/libcompose/blob/master/docker/builder/builder.go

func EncodeAuthToBase64

func EncodeAuthToBase64(authConfig types.AuthConfig) (string, error)

EncodeAuthToBase64 serializes the auth configuration as JSON base64 payload

func FailOnError

func FailOnError(err error, msg string)

FailOnError helper function to panic on error.

func GetAMQPURL

func GetAMQPURL() string

GetAMQPURL performs an environment variable look up on $AMQP_URL - returns default url if empty

func GetBaghdad

func GetBaghdad(c *github.Client, opts GetBaghdadOpts) (b baghdad.Baghdad, err error)

GetBaghdad takes a github client, a sha, and returns the corresponding baghdad.toml file.

func GetGithub

func GetGithub(t string) *github.Client

GetGithub given a token, it will return a client to perform Github API operations on.

func Monitor

func Monitor(ch chan bool)

Monitor takes a channel and monitors the root directory's disk usage. if the disk is less than 3Gigs free, it will send a message to the channel.

func ReleaseDeploy

func ReleaseDeploy(projectQ string, w *worker.Worker, logger *worker.Logger)

ReleaseDeploy sends an empty message to the projectQ, and makes redis project idle.

func SendSlackMessage

func SendSlackMessage(url, msg string)

SendSlackMessage attempts to send a given msg to the given url.

func TagStackServices

func TagStackServices(
	stackFile []byte,
	b baghdad.Baghdad,
	tag,
	branch,
	env,
	domain string,
) ([]byte, error)

TagStackServices creates docker-compose file that is valid for `docker stack deploy` within the baghdad ecosystem. this can be used to bootstrap the Baghdad microservices.

func ValidateEnvVars

func ValidateEnvVars(vars ...string)

ValidateEnvVars panics if any given environment variable is an empty string.

Types

type ComposeFile

type ComposeFile struct {
	Version  string                    `yaml:"version,omitempty"`
	Services map[string]ComposeService `yaml:"services,omitempty"`
	Networks map[string]ComposeNetwork `yaml:"networks,omitempty"`
	Volumes  interface{}               `yaml:"volumes,omitempty"`
	Secrets  interface{}               `yaml:"secrets,omitempty"`
}

ComposeFile top level compose file.

type ComposeNetwork

type ComposeNetwork struct {
	Driver     interface{} `yaml:"driver,omitempty"`
	DriverOpts interface{} `yaml:"driver_opts,omitempty"`
	Ipam       interface{} `yaml:"ipam,omitempty"`
	External   interface{} `yaml:"external,omitempty"`
	Labels     interface{} `yaml:"labels,omitempty"`
}

ComposeNetwork top level compose network

type ComposeService

type ComposeService struct {
	CapAdd          interface{}          `yaml:"cap_add,omitempty"`
	CapDrop         interface{}          `yaml:"cap_drop,omitempty"`
	CgroupParent    interface{}          `yaml:"cgroup_parent,omitempty"`
	Command         interface{}          `yaml:"command,omitempty"`
	ContainerName   interface{}          `yaml:"container_name,omitempty"`
	DependsOn       interface{}          `yaml:"depends_on,omitempty"`
	Deploy          ComposeServiceDeploy `yaml:"deploy,omitempty"`
	Devices         interface{}          `yaml:"devices,omitempty"`
	DNS             interface{}          `yaml:"dns,omitempty"`
	DNSSearch       interface{}          `yaml:"dns_search,omitempty"`
	DomainName      interface{}          `yaml:"domainname,omitempty"`
	Entrypoint      interface{}          `yaml:"entrypoint,omitempty"`
	Environment     interface{}          `yaml:"environment,omitempty"`
	Expose          interface{}          `yaml:"expose,omitempty"`
	ExternalLinks   interface{}          `yaml:"external_links,omitempty"`
	ExtraHosts      interface{}          `yaml:"extra_hosts,omitempty"`
	Hostname        interface{}          `yaml:"hostname,omitempty"`
	HealthCheck     interface{}          `yaml:"healthcheck,omitempty"`
	Image           string               `yaml:"image,omitempty"`
	Ipc             interface{}          `yaml:"ipc,omitempty"`
	Labels          interface{}          `yaml:"labels,omitempty"`
	Links           interface{}          `yaml:"links,omitempty"`
	Logging         interface{}          `yaml:"logging,omitempty"`
	MacAddress      interface{}          `yaml:"mac_address,omitempty"`
	NetworkMode     interface{}          `yaml:"network_mode,omitempty"`
	Networks        interface{}          `yaml:"networks,omitempty"`
	Pid             interface{}          `yaml:"pid,omitempty"`
	Ports           interface{}          `yaml:"ports,omitempty"`
	Privileged      interface{}          `yaml:"privileged,omitempty"`
	ReadOnly        interface{}          `yaml:"read_only,omitempty"`
	Restart         interface{}          `yaml:"Restart,omitempty"`
	Secrets         interface{}          `yaml:"secrets,omitempty"`
	SecurityOpt     interface{}          `yaml:"security_opt,omitempty"`
	StdinOpen       interface{}          `yaml:"stdin_open,omitempty"`
	StopGracePeriod interface{}          `yaml:"stop_grace_period,omitempty"`
	StopSignal      interface{}          `yaml:"stop_signal,omitempty"`
	Tmpfs           interface{}          `yaml:"tmpfs,omitempty"`
	Tty             interface{}          `yaml:"tty,omitempty"`
	Ulimits         interface{}          `yaml:"ulimits,omitempty"`
	User            interface{}          `yaml:"user,omitempty"`
	Volumes         interface{}          `yaml:"volumes,omitempty"`
	WorkingDir      interface{}          `yaml:"working_dir,omitempty"`
}

ComposeService top level compose service.

type ComposeServiceDeploy

type ComposeServiceDeploy struct {
	Mode          interface{} `yaml:"mode,omitempty"`
	Replicas      interface{} `yaml:"replicas,omitempty"`
	Labels        []string    `yaml:"labels,omitempty"`
	UpdateConfig  interface{} `yaml:"update_config,omitempty"`
	Resources     interface{} `yaml:"resources,omitempty"`
	RestartPolicy interface{} `yaml:"restart_policy,omitempty"`
	Placement     interface{} `yaml:"placement,omitempty"`
}

ComposeServiceDeploy Deploy config for a compose service

type GetBaghdadOpts

type GetBaghdadOpts struct {
	SHA      string
	Owner    string
	RepoName string
	Ctx      context.Context
}

GetBaghdadOpts verbose options for get baghdad

Jump to

Keyboard shortcuts

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