Exemplo n.º 1
0
// Run starts every services and required resources of caretakerd.
// This is a blocking method.
func (instance *Caretakerd) Run() (values.ExitCode, error) {
	var r *rpc.RPC
	defer func() {
		instance.uninstallTerminationNotificationHandler()
		if r != nil {
			r.Stop()
		}
	}()

	execution := NewExecution(instance)
	if instance.config.RPC.Enabled == values.Boolean(true) {
		r = rpc.NewRPC(instance.config.RPC, execution, instance, instance.logger)
		r.Start()
	}
	instance.installTerminationNotificationHandler()
	instance.execution = execution
	return execution.Run()
}
Exemplo n.º 2
0
func (instance *Config) init() {
	(*instance).Logger = logger.NewConfig()
	(*instance).Command = []values.String{}
	(*instance).PreCommands = [][]values.String{}
	(*instance).PostCommands = [][]values.String{}
	(*instance).Type = AutoStart
	(*instance).CronExpression = NewCronExpression()
	(*instance).StartDelayInSeconds = values.NonNegativeInteger(0)
	(*instance).RestartDelayInSeconds = values.NonNegativeInteger(5)
	(*instance).SuccessExitCodes = values.ExitCodes{values.ExitCode(0)}
	(*instance).StopSignal = defaultStopSignal()
	(*instance).StopSignalTarget = values.ProcessGroup
	(*instance).StopCommand = []values.String{}
	(*instance).StopWaitInSeconds = values.NonNegativeInteger(30)
	(*instance).User = values.String("")
	(*instance).Environment = Environments{}
	(*instance).Directory = values.String("")
	(*instance).AutoRestart = values.OnFailures
	(*instance).InheritEnvironment = values.Boolean(true)
	(*instance).Access = access.NewNoneConfig()
}
Exemplo n.º 3
0
package rpc

import (
	"github.com/echocat/caretakerd/defaults"
	"github.com/echocat/caretakerd/values"
)

var defaultValues = map[string]interface{}{
	"Enabled": values.Boolean(false),
	"Listen":  defaults.ListenAddress(),
}

// # Description
//
// Defines the remote access to caretakerd.
type Config struct {
	// @default false
	//
	// If this is set to ``true`` it is possible to control caretakerd remotely.
	// This includes the [``caretakerctl``](#commands.caretakerctl) command and also
	// by the services itself.
	//
	// > **Hint:** This does **NOT** automatically grants each of it caretakerd access rights.
	// > This is separately handled by the following access properties:
	// >
	// > * {@ref github.com/echocat/caretakerd/control.Config#Access Control.access} for caretakerctl
	// > * {@ref github.com/echocat/caretakerd/service.Config#Access Services.access} for services
	Enabled values.Boolean `json:"enabled" yaml:"enabled"`

	// @default "tcp://localhost:57955"
	//