project

package
v0.3.2-rc1 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2015 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CONTAINER_ID = "container_id"

	CONTAINER_STARTING = Event("Starting container")
	CONTAINER_CREATED  = Event("Created container")
	CONTAINER_STARTED  = Event("Started container")

	SERVICE_ADD           = Event("Adding")
	SERVICE_UP_START      = Event("Starting")
	SERVICE_UP_IGNORED    = Event("Ignoring")
	SERVICE_UP            = Event("Started")
	SERVICE_CREATE_START  = Event("Creating")
	SERVICE_CREATE        = Event("Created")
	SERVICE_DELETE_START  = Event("Deleting")
	SERVICE_DELETE        = Event("Deleted")
	SERVICE_DOWN_START    = Event("Stopping")
	SERVICE_DOWN          = Event("Stopped")
	SERVICE_RESTART_START = Event("Restarting")
	SERVICE_RESTART       = Event("Restarted")

	PROJECT_DOWN_START     = Event("Stopping project")
	PROJECT_DOWN_DONE      = Event("Project stopped")
	PROJECT_CREATE_START   = Event("Creating project")
	PROJECT_CREATE_DONE    = Event("Project created")
	PROJECT_UP_START       = Event("Starting project")
	PROJECT_UP_DONE        = Event("Project started")
	PROJECT_DELETE_START   = Event("Deleting project")
	PROJECT_DELETE_DONE    = Event("Project deleted")
	PROJECT_RESTART_START  = Event("Restarting project")
	PROJECT_RESTART_DONE   = Event("Project restarted")
	PROJECT_RELOAD         = Event("Reloading project")
	PROJECT_RELOAD_TRIGGER = Event("Triggering project reload")
)

Variables

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

Functions

func Merge added in v0.3.2

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

Types

type Command added in v0.3.2

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

func NewCommand added in v0.3.2

func NewCommand(parts ...string) Command

func (Command) MarshalYAML added in v0.3.2

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

func (*Command) Slice added in v0.3.2

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

func (*Command) ToString added in v0.3.2

func (s *Command) ToString() string

func (*Command) UnmarshalYAML added in v0.3.2

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

type ConfigLookup added in v0.3.2

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

type Container added in v0.3.2

type Container struct {
	Name  string
	State string
}

type EmptyService added in v0.3.2

type EmptyService struct {
}

func (*EmptyService) Create added in v0.3.2

func (e *EmptyService) Create() error

func (*EmptyService) Delete added in v0.3.2

func (e *EmptyService) Delete() error

func (*EmptyService) Down added in v0.3.2

func (e *EmptyService) Down() error

func (*EmptyService) Log added in v0.3.2

func (e *EmptyService) Log() error

func (*EmptyService) Restart added in v0.3.2

func (e *EmptyService) Restart() error

func (*EmptyService) Scale added in v0.3.2

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

func (*EmptyService) Up added in v0.3.2

func (e *EmptyService) Up() error

type EnvironmentLookup

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

type Event

type Event string

type FileConfigLookup added in v0.3.2

type FileConfigLookup struct {
}

func (FileConfigLookup) Lookup added in v0.3.2

func (f FileConfigLookup) Lookup(file, relativeTo string) ([]byte, string, error)

type MaporColonSlice added in v0.3.2

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

func NewMaporColonSlice added in v0.3.2

func NewMaporColonSlice(parts []string) MaporColonSlice

func (MaporColonSlice) MarshalYAML added in v0.3.2

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

func (*MaporColonSlice) Slice added in v0.3.2

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

func (*MaporColonSlice) UnmarshalYAML added in v0.3.2

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

type MaporEqualSlice added in v0.3.2

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

func NewMaporEqualSlice added in v0.3.2

func NewMaporEqualSlice(parts []string) MaporEqualSlice

func (MaporEqualSlice) MarshalYAML added in v0.3.2

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

func (*MaporEqualSlice) Slice added in v0.3.2

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

func (*MaporEqualSlice) UnmarshalYAML added in v0.3.2

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

type MaporSpaceSlice added in v0.3.2

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

func NewMaporSpaceSlice added in v0.3.2

func NewMaporSpaceSlice(parts []string) MaporSpaceSlice

func (MaporSpaceSlice) MarshalYAML added in v0.3.2

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

func (*MaporSpaceSlice) Slice added in v0.3.2

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

func (*MaporSpaceSlice) UnmarshalYAML added in v0.3.2

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

type Project

type Project struct {
	EnvironmentLookup EnvironmentLookup
	ConfigLookup      ConfigLookup
	Name              string
	Configs           map[string]*ServiceConfig

	File string

	ReloadCallback func() error
	// contains filtered or unexported fields
}

func NewProject

func NewProject(name string, factory ServiceFactory) *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) Create added in v0.3.2

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

func (*Project) CreateService

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

func (*Project) Delete added in v0.3.2

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

func (*Project) Down added in v0.3.2

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

func (*Project) Load

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

func (*Project) Log added in v0.3.2

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

func (*Project) Notify

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

func (*Project) Restart added in v0.3.2

func (p *Project) Restart(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 {
	Name() string
	Create() error
	Up() error
	Down() error
	Delete() error
	Restart() error
	Log() error
	Config() *ServiceConfig
	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 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