caretakerd

package module
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2016 License: MIT Imports: 19 Imported by: 0

README

Circle CI Go Report Card Gitter

caretakerd

caretakerd is a minimal process supervisor build for easy use with no dependencies.

Documentation

For general documentation please refer the official homepage: caretakerd.echocat.org.

For specific versions refer: caretakerd.echocat.org/all.

Building

Precondition

For building caretakerd there is only:

  1. a compatible operating system (Linux, Windows or Mac OS X)
  2. and a working Java 8 installation required.

There is no need for a working and installed Go installation (or anything else). The build system will download every dependency and build it if necessary.

Hint: The Go runtime build by the build system will be placed under ~/.go-bootstrap.

Run

On Linux and Mac OS X:

# Build binaries only
./mvnw compile

# Run tests (includes compile)
./mvnw test

# Build resulting packages (including documentation - includes compile)
./mvnw package

# Set the target version number, increase the version number, do mvnw package,
# deploy everything to GitHub releases and set next development version number.
./mvnw release:prepare release:perform

On Windows:

# Build binaries only
mvnw compile

# Run tests (includes compile)
mvnw test

# Build resulting packages (including documentation - includes compile)
mvnw package

# Set the target version number, increase the version number, do mvnw package,
# deploy everything to GitHub releases and set next development version number.
mvnw release:prepare release:perform
Build artifacts
  • Compiled and lined binaries can be found under ./target/gopath/bin/caretaker*
  • Generated document can be found under ./target/docs/caretakerd.html
  • Packaged TARZs and ZIPs can be found under ./target/caretakerd-*.tar.gz and ./target/caretakerd-*.zip

Contributing

caretakerd is an open source project of echocat. So if you want to make this project even better, you can contribute to this project on Github by fork us.

If you commit code to this project you have to accept that this code will be released under the license of this project.

Support

If you need support you can file a ticket at our issue tracker or join our chat at echocat.slack.com/messages/caretakerd.

License

See LICENSE file.

Documentation

Index

Constants

View Source
const (
	// Version contains the current version of caretakerd
	Version = "${project.version}"
	// BaseName contains the base name of caretaker executable
	BaseName = "caretaker"
	// DaemonName contains the name of caretakerd executable
	DaemonName = "caretakerd"
	// ControlName contains the name of caretakerctl executable
	ControlName = "caretakerctl"
	// Description contains the description of caretakerd.
	Description = "${project.description}"
	// URL contains the URL of caretakerd project page.
	URL = "${project.url}"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Appendable

type Appendable interface {
	Append(value string) error
}

Appendable indicates an instance where a string could be appended.

type Caretakerd

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

Caretakerd instance structure

func NewCaretakerd

func NewCaretakerd(conf Config, syncGroup *usync.Group) (*Caretakerd, error)

NewCaretakerd create a new Caretakerd instance from given config

func (*Caretakerd) Close

func (instance *Caretakerd) Close()

Close close the caretakerd instance and free resoruces. After call of this method it is not longer possible to use this instance.

func (*Caretakerd) ConfigObject

func (instance *Caretakerd) ConfigObject() interface{}

ConfigObject return config this instances was created with.

func (*Caretakerd) Control

func (instance *Caretakerd) Control() *control.Control

Control return instantiated control that belongs to this instance.

func (Caretakerd) IsOpen

func (instance Caretakerd) IsOpen() bool

IsOpen return true if caretakerd is still open. This should be false after Close() was called.

func (*Caretakerd) KeyStore

func (instance *Caretakerd) KeyStore() *keyStore.KeyStore

KeyStore return instantiated keyStore that belongs to this instance.

func (Caretakerd) Logger

func (instance Caretakerd) Logger() *logger.Logger

Logger return instantiated logger that belongs to this instance.

func (*Caretakerd) Run

func (instance *Caretakerd) Run() (values.ExitCode, error)

Run starts every services and requird resources of caretakerd. This method is blocking.

func (*Caretakerd) Services

func (instance *Caretakerd) Services() *service.Services

Services return instantiated services that belongs to this instance.

func (*Caretakerd) Stop

func (instance *Caretakerd) Stop()

Stop stops this instance (if running). This method is blocking until every service and resource is stopped.

type Config

type Config struct {
	// Defines how the encryption of caretakerd works.
	// This is especially important if {@ref #RPC RPC} is used.
	//
	// For details see {@ref github.com/echocat/caretakerd/keyStore.Config}.
	KeyStore keyStore.Config `json:"keyStore" yaml:"keyStore,omitempty"`

	// Defines how caretaker can controlled remotely.
	//
	// For details see {@ref github.com/echocat/caretakerd/rpc.Config}.
	RPC rpc.Config `json:"rpc" yaml:"rpc,omitempty"`

	// Defines the access rights of caretakerctl to caretakerd.
	// This requires {@ref #RPC RPC} enabled.
	//
	// For details see {@ref github.com/echocat/caretakerd/control.Config}.
	Control control.Config `json:"control" yaml:"control,omitempty"`

	// Configures the logger for caretakerd itself.
	// This does not include output of services.
	//
	// For details see {@ref github.com/echocat/caretakerd/logger.Config}.
	Logger logger.Config `json:"logger" yaml:"logger,omitempty"`

	// Services configuration to run with caretakerd.
	//
	// > **Important**: This is a map and requires exact one service
	// > configured as {@ref github.com/echocat/caretakerd/service.Config#Type type} = {@ref github.com/echocat/caretakerd/service.Type#Master master}.
	//
	// For details see {@ref github.com/echocat/caretakerd/service.Config}.
	Services service.Configs `json:"services" yaml:"services,omitempty"`
}

Root configuration of caretakerd.

func LoadFromYamlFile

func LoadFromYamlFile(fileName values.String) (Config, error)

LoadFromYamlFile loads caretakerd config from given yaml file.

func NewConfig

func NewConfig() Config

NewConfig create a new config instance.

func (*Config) BeforeUnmarshalYAML

func (instance *Config) BeforeUnmarshalYAML() error

BeforeUnmarshalYAML is used by yaml unmarcshalling. Do not call direct.

func (Config) EnrichFromEnvironment

func (instance Config) EnrichFromEnvironment() Config

EnrichFromEnvironment enrich the current Config instance with configuration from the environment variables.

func (Config) Validate

func (instance Config) Validate() error

Validate do validate action on this object and return an error object if any.

func (Config) ValidateMaster

func (instance Config) ValidateMaster() error

ValidateMaster return an error instance on every validation problem of the master service config instance.

func (Config) WriteToYamlFile

func (instance Config) WriteToYamlFile(fileName values.String) error

WriteToYamlFile write the config of current instance to given yaml file.

type ConfigDoesNotExistError

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

ConfigDoesNotExistError descripts an error if a config does not exists.

func (ConfigDoesNotExistError) Error

func (instance ConfigDoesNotExistError) Error() string

Error return the error message.

type Executable

type Executable interface {
	Services() *service.Services
	KeyStore() *keyStore.KeyStore
	Logger() *logger.Logger
}

Executable indicates an object that could be executed.

type Execution

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

Execution is an instance of an execution of every service of caretakerd.

func NewExecution

func NewExecution(executable Executable) *Execution

NewExecution create a new Execution instance of caretakerd.

Hint: A caretakerd Execution instance could only be called once.

func (*Execution) GetCountOfActiveExecutions

func (instance *Execution) GetCountOfActiveExecutions() int

GetCountOfActiveExecutions return number of active execution of services.

func (*Execution) GetFor

func (instance *Execution) GetFor(s *service.Service) (*service.Execution, bool)

GetFor get the current active service exectuion for the given service. Return false if there is no current matching execution.

func (*Execution) Information

func (instance *Execution) Information() map[string]service.Information

Information return an information object that contain an information for every configured service.

func (*Execution) InformationFor

func (instance *Execution) InformationFor(s *service.Service) service.Information

InformationFor return an information object for given service.

func (*Execution) Kill

func (instance *Execution) Kill(target *service.Service) error

Kill kills the given service.

func (*Execution) Restart

func (instance *Execution) Restart(target *service.Service) error

Restart stops and starts the given service.

func (*Execution) Run

func (instance *Execution) Run() (values.ExitCode, error)

Run starts the caretakerd Execution and start also every service and required resource. This method is blocking.

func (*Execution) Signal

func (instance *Execution) Signal(target *service.Service, what values.Signal) error

Signal sends the given signal to the given service.

func (*Execution) Start

func (instance *Execution) Start(target *service.Service) error

Start start the given service. This method is not blocking.

func (*Execution) Stop

func (instance *Execution) Stop(target *service.Service) error

Stop stops the given service.

func (*Execution) StopAll

func (instance *Execution) StopAll()

StopAll stop all running serivces.

type Putable

type Putable interface {
	Put(key string, value string) error
}

Putable indicates an instance a kind of map where a value with a key could be putted to.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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