supervisord

package module
v0.8.3 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2023 License: MIT Imports: 29 Imported by: 0

README

Go Report Card

Why this project?

The python script supervisord is a powerful tool used by a lot of guys to manage the processes. I like supervisord too.

But this tool requires that the big python environment be installed in target system. In some situation, for example in the docker environment, the python is too big for us.

This project re-implements supervisord in go-lang. Compiled supervisord is very suitable for environments where python is not installed.

Building the supervisord

Before compiling the supervisord, make sure the go-lang 1.11+ is installed in your environment.

To compile supervisord for linux, run following commands:

  1. go generate
  2. GOOS=linux go build -tags release -a -ldflags "-linkmode external -extldflags -static" -o supervisord

Run the supervisord

After a supervisord binary has been generated, create a supervisord configuration file and start the supervisord like this:

$ cat supervisor.conf
[program:test]
command = /your/program args
$ supervisord -c supervisor.conf

Please note that config-file location autodetected in this order:

  1. $CWD/supervisord.conf
  2. $CWD/etc/supervisord.conf
  3. /etc/supervisord.conf
  4. /etc/supervisor/supervisord.conf (since Supervisor 3.3.0)
  5. ../etc/supervisord.conf (Relative to the executable)
  6. ../supervisord.conf (Relative to the executable)

Run as daemon with web-ui

Add the inet interface in your configuration:

[inet_http_server]
port=127.0.0.1:9001

then run

$ supervisord -c supervisor.conf -d

In order to manage the daemon, you can use supervisord ctl subcommand, available subcommands are: status, start, stop, shutdown, reload.

$ supervisord ctl status
$ supervisord ctl status program-1 program-2...
$ supervisord ctl status group:*
$ supervisord ctl stop program-1 program-2...
$ supervisord ctl stop group:*
$ supervisord ctl stop all
$ supervisord ctl start program-1 program-2...
$ supervisord ctl start group:*
$ supervisord ctl start all
$ supervisord ctl shutdown
$ supervisord ctl reload
$ supervisord ctl signal <signal_name> <process_name> <process_name> ...
$ supervisord ctl signal all
$ supervisord ctl pid <process_name>
$ supervisord ctl fg <process_name>

Please note that supervisor ctl subcommand works correctly only if http server is enabled in [inet_http_server], and serverurl correctly set. Unix domain socket is not currently supported for this pupose.

Serverurl parameter detected in the following order:

  • check if option -s or --serverurl is present, use this url
  • check if -c option is present, and the "serverurl" in "supervisorctl" section is present, use "serverurl" in section "supervisorctl"
  • check if "serverurl" in section "supervisorctl" is defined in autodetected supervisord.conf-file location and if it is - use found value
  • use http://localhost:9001

Check the version

Command "version" will show the current supervisord binary version.

$ supervisord version

Supported features

Http server

Http server can work via both unix domain socket and TCP. Basic auth is optional and supported too.

The unix domain socket setting is in the "unix_http_server" section. The TCP http server setting is in "inet_http_server" section.

If both "inet_http_server" and "unix_http_server" are not set up in the configuration file, no http server will be started.

Supervisord daemon settings

Following parameters configured in "supervisord" section:

  • logfile. Where to put log of supervisord itself.
  • logfile_maxbytes. Rotate log-file after it exceeds this length.
  • logfile_backups. Number of rotated log-files to preserve.
  • loglevel. Logging verbosity, can be trace, debug, info, warning, error, fatal and panic (according to documentation of module used for this feature). Defaults to info.
  • pidfile. Full path to file containing process id of current supervisord instance.
  • minfds. Reserve al least this amount of file descriptors on supervisord startup. (Rlimit nofiles).
  • minprocs. Reserve at least this amount of processes resource on supervisord startup. (Rlimit noproc).
  • identifier. Identifier of this supervisord instance. Required if there is more than one supervisord run on one machine in same namespace.

Supervised program settings

Supervised program settings configured in [program:programName] section and include these options:

  • command. Command to supervise. It can be given as full path to executable or can be calculated via PATH variable. Command line parameters also should be supplied in this string.
  • process_name. the process name
  • numprocs. number of process
  • numprocs_start. ??
  • autostart. Should be supervised command run on supervisord start? Defaults to true.
  • startsecs. The total number of seconds which the program needs to stay running after a startup to consider the start successful (moving the process from the STARTING state to the RUNNING state). Set to 0 to indicate that the program needn’t stay running for any particular amount of time.
  • startretries. The number of serial failure attempts that supervisord will allow when attempting to start the program before giving up and putting the process into an FATAL state. See Process States for explanation of the FATAL state.
  • autorestart. Automatically re-run supervised command if it dies.
  • exitcodes. The list of “expected” exit codes for this program used with autorestart. If the autorestart parameter is set to unexpected, and the process exits in any other way than as a result of a supervisor stop request, supervisord will restart the process if it exits with an exit code that is not defined in this list.
  • stopsignal. Signal to send to command to gracefully stop it. If more than one stopsignal is configured, when stoping the program, the supervisor will send the signals to the program one by one with interval "stopwaitsecs". If the program does not exit after all the signals sent to the program, supervisord will kill the program.
  • stopwaitsecs. Amount of time to wait before sending SIGKILL to supervised command to make it stop ungracefully.
  • stdout_logfile. Where STDOUT of supervised command should be redirected. (Particular values described lower in this file).
  • stdout_logfile_maxbytes. Log size after exceed which log will be rotated.
  • stdout_logfile_backups. Number of rotated log-files to preserve.
  • redirect_stderr. Should STDERR be redirected to STDOUT.
  • stderr_logfile. Where STDERR of supervised command should be redirected. (Particular values described lower in this file).
  • stderr_logfile_maxbytes. Log size after exceed which log will be rotated.
  • stderr_logfile_backups. Number of rotated log-files to preserve.
  • environment. List of VARIABLE=value to be passed to supervised program. It has higher priority than envFiles.
  • envFiles. List of .env files to be loaded and passed to supervised program.
  • priority. The relative priority of the program in the start and shutdown ordering
  • user. Sudo to this USER or USER:GROUP right before exec supervised command.
  • directory. Jump to this path and exec supervised command there.
  • stopasgroup. Also stop this program when stopping group of programs where this program is listed.
  • killasgroup. Also kill this program when stopping group of programs where this program is listed.
  • restartpause. Wait (at least) this amount of seconds after stpping suprevised program before strt it again.
  • restart_when_binary_changed. Boolean value (false or true) to control if the supervised command should be restarted when its executable binary changes. Defaults to false.
  • restart_cmd_when_binary_changed. The command to restart the program if the program binary itself is changed.
  • restart_signal_when_binary_changed. The signal sent to the program for restarting if the program binary is changed.
  • restart_directory_monitor. Path to be monitored for restarting purpose.
  • restart_file_pattern. If a file changes under restart_directory_monitor and filename matches this pattern, the supervised command will be restarted.
  • restart_cmd_when_file_changed. The command to restart the program if any monitored files under restart_directory_monitor with pattern restart_file_pattern are changed.
  • restart_signal_when_file_changed. The signal will be sent to the proram, such as Nginx, for restarting if any monitored files under restart_directory_monitor with pattern restart_file_pattern are changed.
  • depends_on. Define supervised command start dependency. If program A depends on program B, C, the program B, C will be started before program A. Example:
[program:A]
depends_on = B, C

[program:B]
...
[program:C]
...

Set default parameters for all supervised programs

All common parameters that are identical for all supervised programs can be defined once in "program-default" section and omited in all other program sections.

In example below the VAR1 and VAR2 environment variables apply to both test1 and test2 supervised programs:

[program-default]
environment=VAR1="value1",VAR2="value2"
envFiles=global.env,prod.env

[program:test1]
...

[program:test2]
...

Group

Section "group" is supported and you can set "programs" item

Events

Supervisord 3.x defined events are supported partially. Now it supports following events:

  • all process state related events
  • process communication event
  • remote communication event
  • tick related events
  • process log related events

Logs

Supervisord can redirect stdout and stderr ( fields stdout_logfile, stderr_logfile ) of supervised programs to:

  • /dev/null. Ignore the log - send it to /dev/null.
  • /dev/stdout. Write log to STDOUT.
  • /dev/stderr. Write log to STDERR.
  • syslog. Send the log to local syslog service.
  • syslog @[protocol:]host[:port]. Send log events to remote syslog server. Protocol must be "tcp" or "udp", if missing, "udp" assumed. If port is missing, for "udp" protocol, it's defaults to 514 and for "tcp" protocol, it's value is 6514.
  • file name. Write log to specified file.

Multiple log files can be configured for the stdout_logfile and stderr_logfile with ',' as delimiter. For example:

stdout_logfile = test.log, /dev/stdout
syslog settings

if write the log to the syslog, following additional parameter can be set like:

syslog_facility=local0
syslog_tag=test
syslog_stdout_priority=info
syslog_stderr_priority=err
  • syslog_facility, can be one of(case insensitive): KERNEL, USER, MAIL, DAEMON, AUTH, SYSLOG, LPR, NEWS, UUCP, CRON, AUTHPRIV, FTP, LOCAL0~LOCAL7
  • syslog_stdout_priority, can be one of(case insensitive): EMERG, ALERT, CRIT, ERR, WARN, NOTICE, INFO, DEBUG
  • syslog_stderr_priority, can be one of(case insensitive): EMERG, ALERT, CRIT, ERR, WARN, NOTICE, INFO, DEBUG

Web GUI

Supervisord has builtin web GUI: you can start, stop & check the status of program from the GUI. Following picture shows the default web GUI:

alt text

Please note that in order to see|use Web GUI you should configure it in /etc/supervisord.conf both in [inet_http_server] (and|or [unix_http_server] if you prefer unix domain socket) and [supervisorctl]:

[inet_http_server]
port=127.0.0.1:9001
;username=test1
;password=thepassword

[supervisorctl]
serverurl=http://127.0.0.1:9001

Usage from a Docker container

supervisord is compiled inside a Docker image to be used directly inside another image, from the Docker Hub version.

FROM debian:latest
COPY --from=sunbird1015/supervisord:latest /usr/local/bin/supervisord /usr/local/bin/supervisord
CMD ["/usr/local/bin/supervisord"]

Integrate with Prometheus

The Prometheus node exporter supported supervisord metrics are now integrated into the supervisor. So there is no need to deploy an extra node_exporter to collect the supervisord metrics. To collect the metrics, the port parameter in section "inet_http_server" must be configured and the metrics server is started on the path /metrics of the supervisor http server.

For example, if the port parameter in "inet_http_server" is "127.0.0.1:9001" and then the metrics server should be accessed in url "http://127.0.0.1:9001/metrics"

Register service

Autostart supervisord after os started. Look up supported platforms at kardianos/service.

# install
sudo supervisord service install -c full_path_to_conf_file
# uninstall
sudo supervisord service uninstall
# start
supervisord service start
# stop
supervisord service stop

Documentation

Index

Constants

View Source
const (
	// SupervisorVersion the version of supervisor
	SupervisorVersion = "3.0"
)

Variables

View Source
var HTTP http.FileSystem = http.Dir("./webgui")

HTTP auto generated

Functions

This section is empty.

Types

type BaseChecker

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

BaseChecker basic implementation of ContentChecker

func NewBaseChecker

func NewBaseChecker(includes []string, timeout int) *BaseChecker

NewBaseChecker creates BaseChecker object

func (*BaseChecker) Check

func (bc *BaseChecker) Check() bool

Check content of the input data

func (*BaseChecker) Write

func (bc *BaseChecker) Write(b []byte) (int, error)

Write data to the checker

type ConfApi

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

func NewConfApi

func NewConfApi(supervisor *Supervisor) *ConfApi

NewLogtail creates a Logtail object

func (*ConfApi) CreateHandler

func (ca *ConfApi) CreateHandler() http.Handler

CreateHandler creates http handlers to process the program stdout and stderr through http interface

type ContentChecker

type ContentChecker interface {
	Check() bool
}

ContentChecker defines check interface

type HTTPChecker

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

HTTPChecker implements the ContentChecker by HTTP protocol

func NewHTTPChecker

func NewHTTPChecker(url string, timeout int) *HTTPChecker

NewHTTPChecker creates HTTPChecker object

func (*HTTPChecker) Check

func (hc *HTTPChecker) Check() bool

Check content of HTTP response

type LogReadInfo

type LogReadInfo struct {
	Offset int // the log offset
	Length int // the length of log to read
}

LogReadInfo the input argument to read the log of supervisor

type Logtail

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

Logtail tails the process log through http interface

func NewLogtail

func NewLogtail(supervisor *Supervisor) *Logtail

NewLogtail creates a Logtail object

func (*Logtail) CreateHandler

func (lt *Logtail) CreateHandler() http.Handler

CreateHandler creates http handlers to process the program stdout and stderr through http interface

type ProcessLogReadInfo

type ProcessLogReadInfo struct {
	Name   string // the program name
	Offset int    // the offset of the program log
	Length int    // the length of log to read
}

ProcessLogReadInfo the input argument to read the log of program

type ProcessStdin

type ProcessStdin struct {
	Name  string // program name
	Chars string // inputs from client
}

ProcessStdin process stdin from client

type ProcessTailLog

type ProcessTailLog struct {
	LogData  string
	Offset   int64
	Overflow bool
}

ProcessTailLog the output of tail the program log

type RPCTaskResult

type RPCTaskResult struct {
	Name        string `xml:"name"`        // the program name
	Group       string `xml:"group"`       // the group of the program
	Status      int    `xml:"status"`      // the status of the program
	Description string `xml:"description"` // the description of program
}

RPCTaskResult result of some remote commands

type RemoteCommEvent

type RemoteCommEvent struct {
	Type string // the event type
	Data string // the data of event
}

RemoteCommEvent remove communication event from client side

type ScriptChecker

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

ScriptChecker implements ContentChecker by calling external script

func NewScriptChecker

func NewScriptChecker(args []string) *ScriptChecker

NewScriptChecker creates ScriptChecker object

func (*ScriptChecker) Check

func (sc *ScriptChecker) Check() bool

Check return code of the script. If return code is 0, check is successful

type StartProcessArgs

type StartProcessArgs struct {
	Name string // program name
	Wait bool   `default:"true"` // Wait the program starting finished
}

StartProcessArgs arguments for starting a process

type StateInfo

type StateInfo struct {
	Statecode int    `xml:"statecode"`
	Statename string `xml:"statename"`
}

StateInfo describe the state of supervisor

type Supervisor

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

Supervisor manage all the processes defined in the supervisor configuration file. All the supervisor public interface is defined in this class

func NewSupervisor

func NewSupervisor(configFile string) *Supervisor

NewSupervisor create a Supervisor object with supervisor configuration file

func (*Supervisor) AddProcessGroup

func (s *Supervisor) AddProcessGroup(r *http.Request, args *struct{ Name string }, reply *struct{ Success bool }) error

AddProcessGroup adds a process group to the supervisor

func (*Supervisor) ClearAllProcessLogs

func (s *Supervisor) ClearAllProcessLogs(r *http.Request, args *struct{}, reply *struct{ RPCTaskResults []RPCTaskResult }) error

ClearAllProcessLogs clears logs of all programs

func (*Supervisor) ClearLog

func (s *Supervisor) ClearLog(r *http.Request, args *struct{}, reply *struct{ Ret bool }) error

ClearLog clear the supervisor log

func (*Supervisor) ClearProcessLogs

func (s *Supervisor) ClearProcessLogs(r *http.Request, args *struct{ Name string }, reply *struct{ Success bool }) error

ClearProcessLogs clears log of given program

func (*Supervisor) GetAllProcessInfo

func (s *Supervisor) GetAllProcessInfo(r *http.Request, args *struct{}, reply *struct{ AllProcessInfo []types.ProcessInfo }) error

GetAllProcessInfo get all the program information managed by supervisor

func (*Supervisor) GetConfig

func (s *Supervisor) GetConfig() *config.Config

GetConfig get the loaded supervisor configuration

func (*Supervisor) GetIdentification

func (s *Supervisor) GetIdentification(r *http.Request, args *struct{}, reply *struct{ ID string }) error

GetIdentification get the supervisor identifier configured in the file

func (*Supervisor) GetManager

func (s *Supervisor) GetManager() *process.Manager

GetManager get the Manager object created by supervisor

func (*Supervisor) GetPID

func (s *Supervisor) GetPID(r *http.Request, args *struct{}, reply *struct{ Pid int }) error

GetPID get the pid of supervisor

func (*Supervisor) GetProcessInfo

func (s *Supervisor) GetProcessInfo(r *http.Request, args *struct{ Name string }, reply *struct{ ProcInfo types.ProcessInfo }) error

GetProcessInfo get the process information of one program

func (*Supervisor) GetPrograms

func (s *Supervisor) GetPrograms() []string

GetPrograms Get all the name of programs

Return the name of all the programs

func (*Supervisor) GetState

func (s *Supervisor) GetState(r *http.Request, args *struct{}, reply *struct{ StateInfo StateInfo }) error

GetState get the state of supervisor

func (*Supervisor) GetSupervisorID

func (s *Supervisor) GetSupervisorID() string

GetSupervisorID get the supervisor identifier from configuration file

func (*Supervisor) GetSupervisorVersion

func (s *Supervisor) GetSupervisorVersion(r *http.Request, args *struct{}, reply *struct{ Version string }) error

GetSupervisorVersion get the supervisor version

func (*Supervisor) GetVersion

func (s *Supervisor) GetVersion(r *http.Request, args *struct{}, reply *struct{ Version string }) error

GetVersion get the version of supervisor

func (*Supervisor) IsRestarting

func (s *Supervisor) IsRestarting() bool

IsRestarting check if supervisor is in restarting state

func (*Supervisor) ReadLog

func (s *Supervisor) ReadLog(r *http.Request, args *LogReadInfo, reply *struct{ Log string }) error

ReadLog read the log of supervisor

func (*Supervisor) ReadProcessStderrLog

func (s *Supervisor) ReadProcessStderrLog(r *http.Request, args *ProcessLogReadInfo, reply *struct{ LogData string }) error

ReadProcessStderrLog reads stderr log of given program

func (*Supervisor) ReadProcessStdoutLog

func (s *Supervisor) ReadProcessStdoutLog(r *http.Request, args *ProcessLogReadInfo, reply *struct{ LogData string }) error

ReadProcessStdoutLog reads stdout of given program

func (*Supervisor) Reload

func (s *Supervisor) Reload(restart bool) (addedGroup []string, changedGroup []string, removedGroup []string, err error)

Reload supervisord configuration.

func (*Supervisor) ReloadConfig

func (s *Supervisor) ReloadConfig(r *http.Request, args *struct{}, reply *types.ReloadConfigResult) error

ReloadConfig reloads supervisord configuration file

func (*Supervisor) RemoveProcessGroup

func (s *Supervisor) RemoveProcessGroup(r *http.Request, args *struct{ Name string }, reply *struct{ Success bool }) error

RemoveProcessGroup removes a process group from the supervisor

func (*Supervisor) Restart

func (s *Supervisor) Restart(r *http.Request, args *struct{}, reply *struct{ Ret bool }) error

Restart the supervisor

func (*Supervisor) SendProcessStdin

func (s *Supervisor) SendProcessStdin(r *http.Request, args *ProcessStdin, reply *struct{ Success bool }) error

SendProcessStdin send data to program through stdin

func (*Supervisor) SendRemoteCommEvent

func (s *Supervisor) SendRemoteCommEvent(r *http.Request, args *RemoteCommEvent, reply *struct{ Success bool }) error

SendRemoteCommEvent emit a remote communication event

func (*Supervisor) Shutdown

func (s *Supervisor) Shutdown(r *http.Request, args *struct{}, reply *struct{ Ret bool }) error

Shutdown the supervisor

func (*Supervisor) SignalAllProcesses

func (s *Supervisor) SignalAllProcesses(r *http.Request, args *types.ProcessSignal, reply *struct{ AllProcessInfo []types.ProcessInfo }) error

SignalAllProcesses send signal to all the processes in the supervisor

func (*Supervisor) SignalProcess

func (s *Supervisor) SignalProcess(r *http.Request, args *types.ProcessSignal, reply *struct{ Success bool }) error

SignalProcess send a signal to running program

func (*Supervisor) SignalProcessGroup

func (s *Supervisor) SignalProcessGroup(r *http.Request, args *types.ProcessSignal, reply *struct{ AllProcessInfo []types.ProcessInfo }) error

SignalProcessGroup send signal to all processes in one group

func (*Supervisor) StartAllProcesses

func (s *Supervisor) StartAllProcesses(r *http.Request, args *struct {
	Wait bool `default:"true"`
}, reply *struct{ RPCTaskResults []RPCTaskResult }) error

StartAllProcesses start all the programs

func (*Supervisor) StartProcess

func (s *Supervisor) StartProcess(r *http.Request, args *StartProcessArgs, reply *struct{ Success bool }) error

StartProcess start the given program

func (*Supervisor) StartProcessGroup

func (s *Supervisor) StartProcessGroup(r *http.Request, args *StartProcessArgs, reply *struct{ AllProcessInfo []types.ProcessInfo }) error

StartProcessGroup start all the processes in one group

func (*Supervisor) StopAllProc

func (s *Supervisor) StopAllProc()

func (*Supervisor) StopAllProcesses

func (s *Supervisor) StopAllProcesses(r *http.Request, args *struct {
	Wait bool `default:"true"`
}, reply *struct{ RPCTaskResults []RPCTaskResult }) error

StopAllProcesses stop all programs managed by supervisor

func (*Supervisor) StopProcess

func (s *Supervisor) StopProcess(r *http.Request, args *StartProcessArgs, reply *struct{ Success bool }) error

StopProcess stop given program

func (*Supervisor) StopProcessGroup

func (s *Supervisor) StopProcessGroup(r *http.Request, args *StartProcessArgs, reply *struct{ AllProcessInfo []types.ProcessInfo }) error

StopProcessGroup stop all processes in one group

func (*Supervisor) TailProcessStderrLog

func (s *Supervisor) TailProcessStderrLog(r *http.Request, args *ProcessLogReadInfo, reply *ProcessTailLog) error

TailProcessStderrLog tails stderr of the program

func (*Supervisor) TailProcessStdoutLog

func (s *Supervisor) TailProcessStdoutLog(r *http.Request, args *ProcessLogReadInfo, reply *ProcessTailLog) error

TailProcessStdoutLog tails stdout of the program

func (*Supervisor) WaitForExit

func (s *Supervisor) WaitForExit()

WaitForExit waits for supervisord to exit

type SupervisorRestful

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

SupervisorRestful the restful interface to control the programs defined in configuration file

func NewSupervisorRestful

func NewSupervisorRestful(supervisor *Supervisor) *SupervisorRestful

NewSupervisorRestful create a new SupervisorRestful object

func (*SupervisorRestful) CreateProgramHandler

func (sr *SupervisorRestful) CreateProgramHandler() http.Handler

CreateProgramHandler create http handler to process program related restful request

func (*SupervisorRestful) CreateSupervisorHandler

func (sr *SupervisorRestful) CreateSupervisorHandler() http.Handler

CreateSupervisorHandler create http rest interface to control supervisor itself

func (*SupervisorRestful) ListProgram

func (sr *SupervisorRestful) ListProgram(w http.ResponseWriter, req *http.Request)

ListProgram list the status of all the programs

json array to present the status of all programs

func (*SupervisorRestful) ReadStdoutLog

func (sr *SupervisorRestful) ReadStdoutLog(w http.ResponseWriter, req *http.Request)

ReadStdoutLog read the stdout of given program

func (*SupervisorRestful) Reload

func (sr *SupervisorRestful) Reload(w http.ResponseWriter, req *http.Request)

Reload the supervisor configuration file through rest interface

func (*SupervisorRestful) Shutdown

func (sr *SupervisorRestful) Shutdown(w http.ResponseWriter, req *http.Request)

Shutdown the supervisor itself

func (*SupervisorRestful) StartProgram

func (sr *SupervisorRestful) StartProgram(w http.ResponseWriter, req *http.Request)

StartProgram start the given program through restful interface

func (*SupervisorRestful) StartPrograms

func (sr *SupervisorRestful) StartPrograms(w http.ResponseWriter, req *http.Request)

StartPrograms start one or more programs through restful interface

func (*SupervisorRestful) StopProgram

func (sr *SupervisorRestful) StopProgram(w http.ResponseWriter, req *http.Request)

StopProgram stop a program through the restful interface

func (*SupervisorRestful) StopPrograms

func (sr *SupervisorRestful) StopPrograms(w http.ResponseWriter, req *http.Request)

StopPrograms stop programs through the restful interface

type SupervisorWebgui

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

SupervisorWebgui the interface to show a WEBGUI to control the supervisor

func NewSupervisorWebgui

func NewSupervisorWebgui(supervisor *Supervisor) *SupervisorWebgui

NewSupervisorWebgui create a new SupervisorWebgui object

func (*SupervisorWebgui) CreateHandler

func (sw *SupervisorWebgui) CreateHandler() http.Handler

CreateHandler create a http handler to process the request from WEBGUI

type TCPChecker

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

TCPChecker check by TCP protocol

func NewTCPChecker

func NewTCPChecker(host string, port int, includes []string, timeout int) *TCPChecker

NewTCPChecker creates TCPChecker object

func (*TCPChecker) Check

func (tc *TCPChecker) Check() bool

Check if it is ready by reading the tcp data

type XMLRPC

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

XMLRPC mange the XML RPC servers start XML RPC servers to accept the XML RPC request from client side

func NewXMLRPC

func NewXMLRPC() *XMLRPC

NewXMLRPC create a new XML RPC object

func (*XMLRPC) StartInetHTTPServer

func (p *XMLRPC) StartInetHTTPServer(user string, password string, listenAddr string, s *Supervisor, startedCb func())

StartInetHTTPServer start http server on tcp with path listenAddr. If both user and password are not empty, the user must provide user and password for basic authentication when making an XML RPC request.

func (*XMLRPC) StartUnixHTTPServer

func (p *XMLRPC) StartUnixHTTPServer(user string, password string, listenAddr string, s *Supervisor, startedCb func())

StartUnixHTTPServer start http server on unix domain socket with path listenAddr. If both user and password are not empty, the user must provide user and password for basic authentication when making an XML RPC request.

func (*XMLRPC) Stop

func (p *XMLRPC) Stop()

Stop network listening

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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