isvcs

package
v0.0.0-...-88aa921 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	IMAGE_REPO = "zenoss/serviced-isvcs"
	IMAGE_TAG  = "v26"
)

Variables

View Source
var (
	ErrNotRunning       = errors.New("isvc: not running")
	ErrRunning          = errors.New("isvc: running")
	ErrBadContainerSpec = errors.New("isvc: bad service specification")
)
View Source
var (
	ErrManagerUnknownOp  = errors.New("manager: unknown operation")
	ErrManagerUnknownArg = errors.New("manager: unknown arg type")
	ErrImageNotExists    = errors.New("manager: image does not exist")
	ErrNotifyFailed      = errors.New("manager: notification failure")
)
View Source
var CeleryIRS RunningService
View Source
var CeleryISVC Service
View Source
var DockerRegistryIRS RunningService
View Source
var DockerRegistryISVC Service
View Source
var ElasticsearchLogStashIRS RunningService
View Source
var ElasticsearchLogStashISVC Service
View Source
var ElasticsearchServicedIRS RunningService
View Source
var ElasticsearchServicedISVC Service
View Source
var IRSMap map[string]*RunningService
View Source
var ISVCSMap map[string]*Service
View Source
var InternalServicesIRS RunningService
View Source
var InternalServicesISVC Service
View Source
var LogstashIRS RunningService
View Source
var LogstashISVC Service
View Source
var OpentsdbIRS RunningService
View Source
var OpentsdbISVC Service
View Source
var Zookeeper = IServiceDefinition{
	Name:        "zookeeper",
	Repo:        IMAGE_REPO,
	Tag:         IMAGE_TAG,
	Command:     func() string { return "exec /opt/zookeeper-3.4.5/bin/zkServer.sh start-foreground" },
	Ports:       []uint16{2181, 12181},
	Volumes:     map[string]string{"data": "/tmp"},
	HealthCheck: zkHealthCheck,
}
View Source
var ZookeeperIRS RunningService
View Source
var ZookeeperISVC Service

Functions

func AddEnv

func AddEnv(env_str string) error

Add a string of the form SERVICE:KEY=VAL to the isvcs environment map

func Init

func Init()

func PurgeLogstashIndices

func PurgeLogstashIndices(days int, gb int) error

Types

type ExitError

type ExitError int

func (ExitError) Error

func (err ExitError) Error() string

type IService

type IService struct {
	IServiceDefinition
	// contains filtered or unexported fields
}

func NewIService

func NewIService(sd IServiceDefinition) (*IService, error)

func (*IService) Exec

func (svc *IService) Exec(command []string) error

func (*IService) IsRunning

func (svc *IService) IsRunning() bool

func (*IService) Restart

func (svc *IService) Restart() error

func (*IService) SetRoot

func (svc *IService) SetRoot(root string)

func (*IService) Start

func (svc *IService) Start() error

func (*IService) Stop

func (svc *IService) Stop() error

type IServiceDefinition

type IServiceDefinition struct {
	Name          string                             // name of the service (used in naming containers)
	Repo          string                             // the service's docker repository
	Tag           string                             // the service's docker repository tag
	Command       func() string                      // the command to run in the container
	Volumes       map[string]string                  // volumes to bind mount to the container
	Ports         []uint16                           // ports to expose to the host
	HealthCheck   func() error                       // A function to verify the service is healthy
	Configuration map[string]interface{}             // service specific configuration
	Notify        func(*IService, interface{}) error // A function to run when notified of a data event
	PostStart     func(*IService) error              // A function to run after the initial start of the service
	HostNetwork   bool                               // enables host network in the container
}

type IServiceTest

type IServiceTest interface {
	GetService(c *C) *IService
	Create(c *C)
	Destroy(c *C)
	SetUp(c *C)
}

type Manager

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

A manager of docker services run in ephemeral containers

var Mgr *Manager

func NewManager

func NewManager(imagesDir, volumesDir string) *Manager

Returns a new Manager struct and starts the Manager's main loop()

func (*Manager) Notify

func (m *Manager) Notify(val interface{}) error

Notify() sends a notify() message to all the containers with the given data val

func (*Manager) Register

func (m *Manager) Register(svc *IService) error

Register() registers a container to be managed by the *Manager

func (*Manager) SetConfigurationOption

func (m *Manager) SetConfigurationOption(name, key string, value interface{}) error

func (*Manager) SetVolumesDir

func (m *Manager) SetVolumesDir(dir string)

SetVolumesDir sets the volumes dir for *Manager

func (*Manager) Start

func (m *Manager) Start() error

Start() starts all the containers managed by the *Manager

func (*Manager) Stop

func (m *Manager) Stop() error

Stop() stops all the containers currently registered to the *Manager

func (*Manager) TearDown

func (m *Manager) TearDown() error

TearDown() causes the *Manager's loop() to exit

func (*Manager) Wipe

func (m *Manager) Wipe() error

Wipe() removes the data directory associated with the Manager

type ManagerTestSuite

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

func (*ManagerTestSuite) AddTestService

func (t *ManagerTestSuite) AddTestService(svc IServiceTest)

func (*ManagerTestSuite) SetUpSuite

func (t *ManagerTestSuite) SetUpSuite(c *C)

func (*ManagerTestSuite) SetUpTest

func (t *ManagerTestSuite) SetUpTest(c *C)

func (*ManagerTestSuite) TearDownSuite

func (t *ManagerTestSuite) TearDownSuite(c *C)

type StartError

type StartError int

func (StartError) Error

func (err StartError) Error() string

type StopError

type StopError int

func (StopError) Error

func (err StopError) Error() string

Jump to

Keyboard shortcuts

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