project

package
v0.0.0-...-b6317fa Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2015 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CONTAINER_ID = "container_id"

	NO_EVENT = Event(iota)

	CONTAINER_CREATED = Event(iota)
	CONTAINER_STARTED = Event(iota)

	SERVICE_ADD           = Event(iota)
	SERVICE_UP_START      = Event(iota)
	SERVICE_UP_IGNORED    = Event(iota)
	SERVICE_UP            = Event(iota)
	SERVICE_CREATE_START  = Event(iota)
	SERVICE_CREATE        = Event(iota)
	SERVICE_DELETE_START  = Event(iota)
	SERVICE_DELETE        = Event(iota)
	SERVICE_DOWN_START    = Event(iota)
	SERVICE_DOWN          = Event(iota)
	SERVICE_RESTART_START = Event(iota)
	SERVICE_RESTART       = Event(iota)
	SERVICE_PULL_START    = Event(iota)
	SERVICE_PULL          = Event(iota)
	SERVICE_KILL_START    = Event(iota)
	SERVICE_KILL          = Event(iota)
	SERVICE_START_START   = Event(iota)
	SERVICE_START         = Event(iota)
	SERVICE_BUILD_START   = Event(iota)
	SERVICE_BUILD         = Event(iota)

	PROJECT_DOWN_START     = Event(iota)
	PROJECT_DOWN_DONE      = Event(iota)
	PROJECT_CREATE_START   = Event(iota)
	PROJECT_CREATE_DONE    = Event(iota)
	PROJECT_UP_START       = Event(iota)
	PROJECT_UP_DONE        = Event(iota)
	PROJECT_DELETE_START   = Event(iota)
	PROJECT_DELETE_DONE    = Event(iota)
	PROJECT_RESTART_START  = Event(iota)
	PROJECT_RESTART_DONE   = Event(iota)
	PROJECT_RELOAD         = Event(iota)
	PROJECT_RELOAD_TRIGGER = Event(iota)
	PROJECT_KILL_START     = Event(iota)
	PROJECT_KILL_DONE      = Event(iota)
	PROJECT_START_START    = Event(iota)
	PROJECT_START_DONE     = Event(iota)
	PROJECT_BUILD_START    = Event(iota)
	PROJECT_BUILD_DONE     = Event(iota)
)
View Source
const REL_TYPE_IPC_NAMESPACE = ServiceRelationshipType("ipc")
View Source
const REL_TYPE_LINK = ServiceRelationshipType("")
View Source
const REL_TYPE_NET_NAMESPACE = ServiceRelationshipType("netns")
View Source
const REL_TYPE_VOLUMES_FROM = ServiceRelationshipType("volumesFrom")

Variables

View Source
var (
	EXECUTED       ServiceState = ServiceState("executed")
	UNKNOWN        ServiceState = ServiceState("unknown")
	ErrRestart     error        = errors.New("Restart execution")
	ErrUnsupported error        = errors.New("UnsupportedOperation")
)
View Source
var (
	ValidRemotes = []string{
		"git://",
		"git@github.com:",
		"github.com",
		"http:",
		"https:",
	}
)

Functions

func GetContainerFromIpcLikeConfig

func GetContainerFromIpcLikeConfig(p *Project, conf string) string

func GetServiceHash

func GetServiceHash(service Service) string

func Merge

func Merge(p *Project, bytes []byte) (map[string]*ServiceConfig, error)

func NameAlias

func NameAlias(name string) (string, string)

func NewDefaultListener

func NewDefaultListener(p *Project) chan<- ProjectEvent

Types

type Command

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

func NewCommand

func NewCommand(parts ...string) Command

func (Command) MarshalYAML

func (s Command) MarshalYAML() (interface{}, error)

func (*Command) Slice

func (s *Command) Slice() []string

func (*Command) ToString

func (s *Command) ToString() string

func (*Command) UnmarshalYAML

func (s *Command) UnmarshalYAML(unmarshal func(interface{}) error) error

type ConfigLookup

type ConfigLookup interface {
	Lookup(file, relativeTo string) ([]byte, string, error)
}

type Container

type Container interface {
	Id() (string, error)
	Name() string
	Port(port string) (string, error)
}

type Context

type Context struct {
	Timeout      int
	Log          bool
	Signal       string
	ComposeFile  string
	ComposeBytes []byte
	ProjectName  string

	ServiceFactory      ServiceFactory
	EnvironmentLookup   EnvironmentLookup
	ConfigLookup        ConfigLookup
	LoggerFactory       logger.Factory
	IgnoreMissingConfig bool
	Project             *Project
	// contains filtered or unexported fields
}

type EmptyService

type EmptyService struct {
}

func (*EmptyService) Build

func (e *EmptyService) Build() error

func (*EmptyService) Containers

func (e *EmptyService) Containers() ([]Container, error)

func (*EmptyService) Create

func (e *EmptyService) Create() error

func (*EmptyService) Delete

func (e *EmptyService) Delete() error

func (*EmptyService) Down

func (e *EmptyService) Down() error

func (*EmptyService) Info

func (e *EmptyService) Info() (InfoSet, error)

func (*EmptyService) Kill

func (e *EmptyService) Kill() error

func (*EmptyService) Log

func (e *EmptyService) Log() error

func (*EmptyService) Pull

func (e *EmptyService) Pull() error

func (*EmptyService) Restart

func (e *EmptyService) Restart() error

func (*EmptyService) Scale

func (e *EmptyService) Scale(count int) error

func (*EmptyService) Start

func (e *EmptyService) Start() error

func (*EmptyService) Up

func (e *EmptyService) Up() error

type EnvironmentLookup

type EnvironmentLookup interface {
	Lookup(key, serviceName string, config *ServiceConfig) []string
}

type Event

type Event int

func (Event) String

func (e Event) String() string

type Info

type Info []InfoPart

type InfoPart

type InfoPart struct {
	Key, Value string
}

type InfoSet

type InfoSet []Info

func (InfoSet) String

func (infos InfoSet) String() string

type MaporColonSlice

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

func NewMaporColonSlice

func NewMaporColonSlice(parts []string) MaporColonSlice

func (MaporColonSlice) MarshalYAML

func (s MaporColonSlice) MarshalYAML() (interface{}, error)

func (*MaporColonSlice) Slice

func (s *MaporColonSlice) Slice() []string

func (*MaporColonSlice) UnmarshalYAML

func (s *MaporColonSlice) UnmarshalYAML(unmarshal func(interface{}) error) error

type MaporEqualSlice

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

func NewMaporEqualSlice

func NewMaporEqualSlice(parts []string) MaporEqualSlice

func (MaporEqualSlice) MarshalYAML

func (s MaporEqualSlice) MarshalYAML() (interface{}, error)

func (*MaporEqualSlice) Slice

func (s *MaporEqualSlice) Slice() []string

func (*MaporEqualSlice) UnmarshalYAML

func (s *MaporEqualSlice) UnmarshalYAML(unmarshal func(interface{}) error) error

type MaporSpaceSlice

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

func NewMaporSpaceSlice

func NewMaporSpaceSlice(parts []string) MaporSpaceSlice

func (MaporSpaceSlice) MarshalYAML

func (s MaporSpaceSlice) MarshalYAML() (interface{}, error)

func (*MaporSpaceSlice) Slice

func (s *MaporSpaceSlice) Slice() []string

func (*MaporSpaceSlice) UnmarshalYAML

func (s *MaporSpaceSlice) UnmarshalYAML(unmarshal func(interface{}) error) error

type Project

type Project struct {
	Name           string
	Configs        map[string]*ServiceConfig
	File           string
	ReloadCallback func() error
	// contains filtered or unexported fields
}

func NewProject

func NewProject(context *Context) *Project

func (*Project) AddConfig

func (p *Project) AddConfig(name string, config *ServiceConfig) error

func (*Project) AddListener

func (p *Project) AddListener(c chan<- ProjectEvent)

func (*Project) Build

func (p *Project) Build(services ...string) error

func (*Project) Create

func (p *Project) Create(services ...string) error

func (*Project) CreateService

func (p *Project) CreateService(name string) (Service, error)

func (*Project) Delete

func (p *Project) Delete(services ...string) error

func (*Project) Down

func (p *Project) Down(services ...string) error

func (*Project) Kill

func (p *Project) Kill(services ...string) error

func (*Project) Load

func (p *Project) Load(bytes []byte) error

func (*Project) Log

func (p *Project) Log(services ...string) error

func (*Project) Notify

func (p *Project) Notify(event Event, serviceName string, data map[string]string)

func (*Project) Parse

func (p *Project) Parse() error

func (*Project) Pull

func (p *Project) Pull(services ...string) error

func (*Project) Restart

func (p *Project) Restart(services ...string) error

func (*Project) Start

func (p *Project) Start(services ...string) error

func (*Project) Up

func (p *Project) Up(services ...string) error

type ProjectEvent

type ProjectEvent struct {
	Event       Event
	ServiceName string
	Data        map[string]string
}

type Service

type Service interface {
	Info() (InfoSet, error)
	Name() string
	Build() error
	Create() error
	Up() error
	Start() error
	Down() error
	Delete() error
	Restart() error
	Log() error
	Pull() error
	Kill() error
	Config() *ServiceConfig
	DependentServices() []ServiceRelationship
	Containers() ([]Container, error)
	Scale(count int) error
}

type ServiceConfig

type ServiceConfig struct {
	Build         string            `yaml:"build,omitempty"`
	CapAdd        []string          `yaml:"cap_add,omitempty"`
	CapDrop       []string          `yaml:"cap_drop,omitempty"`
	CpuSet        string            `yaml:"cpu_set,omitempty"`
	CpuShares     int64             `yaml:"cpu_shares,omitempty"`
	Command       Command           `yaml:"command"` // omitempty breaks serialization!
	Detach        string            `yaml:"detach,omitempty"`
	Devices       []string          `yaml:"devices,omitempty"`
	Dns           Stringorslice     `yaml:"dns"`        // omitempty breaks serialization!
	DnsSearch     Stringorslice     `yaml:"dns_search"` // omitempty breaks serialization!
	Dockerfile    string            `yaml:"dockerfile,omitempty"`
	DomainName    string            `yaml:"domainname,omitempty"`
	Entrypoint    Command           `yaml:"entrypoint"`  // omitempty breaks serialization!
	EnvFile       Stringorslice     `yaml:"env_file"`    // omitempty breaks serialization!
	Environment   MaporEqualSlice   `yaml:"environment"` // omitempty breaks serialization!
	Hostname      string            `yaml:"hostname,omitempty"`
	Image         string            `yaml:"image,omitempty"`
	Labels        SliceorMap        `yaml:"labels"` // omitempty breaks serialization!
	Links         MaporColonSlice   `yaml:"links"`  // omitempty breaks serialization!
	LogDriver     string            `yaml:"log_driver,omitempty"`
	MemLimit      int64             `yaml:"mem_limit,omitempty"`
	MemSwapLimit  int64             `yaml:"mem_swap_limit,omitempty"`
	Name          string            `yaml:"name,omitempty"`
	Net           string            `yaml:"net,omitempty"`
	Pid           string            `yaml:"pid,omitempty"`
	Uts           string            `yaml:"uts,omitempty"`
	Ipc           string            `yaml:"ipc,omitempty"`
	Ports         []string          `yaml:"ports,omitempty"`
	Privileged    bool              `yaml:"privileged,omitempty"`
	Restart       string            `yaml:"restart,omitempty"`
	ReadOnly      bool              `yaml:"read_only,omitempty"`
	StdinOpen     bool              `yaml:"stdin_open,omitempty"`
	SecurityOpt   []string          `yaml:"security_opt,omitempty"`
	Tty           bool              `yaml:"tty,omitempty"`
	User          string            `yaml:"user,omitempty"`
	VolumeDriver  string            `yaml:"volume_driver,omitempty"`
	Volumes       []string          `yaml:"volumes,omitempty"`
	VolumesFrom   []string          `yaml:"volumes_from,omitempty"`
	WorkingDir    string            `yaml:"working_dir,omitempty"`
	Expose        []string          `yaml:"expose,omitempty"`
	ExternalLinks []string          `yaml:"external_links,omitempty"`
	LogOpt        map[string]string `yaml:"log_opt,omitempty"`
	ExtraHosts    []string          `yaml:"extra_hosts,omitempty"`
}

type ServiceFactory

type ServiceFactory interface {
	Create(project *Project, name string, serviceConfig *ServiceConfig) (Service, error)
}

type ServiceRelationship

type ServiceRelationship struct {
	Target, Alias string
	Type          ServiceRelationshipType
	Optional      bool
}

func DefaultDependentServices

func DefaultDependentServices(p *Project, s Service) []ServiceRelationship

func NewServiceRelationship

func NewServiceRelationship(nameAlias string, relType ServiceRelationshipType) ServiceRelationship

type ServiceRelationshipType

type ServiceRelationshipType string

type ServiceState

type ServiceState string

type SliceorMap

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

func NewSliceorMap

func NewSliceorMap(parts map[string]string) SliceorMap

func (*SliceorMap) MapParts

func (s *SliceorMap) MapParts() map[string]string

func (SliceorMap) MarshalYAML

func (s SliceorMap) MarshalYAML() (interface{}, error)

func (*SliceorMap) UnmarshalYAML

func (s *SliceorMap) UnmarshalYAML(unmarshal func(interface{}) error) error

type Stringorslice

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

func NewStringorslice

func NewStringorslice(parts ...string) Stringorslice

func (*Stringorslice) Len

func (s *Stringorslice) Len() int

func (Stringorslice) MarshalYAML

func (s Stringorslice) MarshalYAML() (interface{}, error)

func (*Stringorslice) Slice

func (s *Stringorslice) Slice() []string

func (*Stringorslice) UnmarshalYAML

func (s *Stringorslice) UnmarshalYAML(unmarshal func(interface{}) error) error

Jump to

Keyboard shortcuts

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