Aegis documentation

#Cube: supervisor

Supervisor 4.3 as a second control plane: the keeper supervises the platform's daemons, Supervisor runs whatever an operator wants running next to them (workers, bots, long-running scripts) with restarts, logs and a status command.

In the panel: Management → Supervisor. Every write there is a task.

#Configuration

toml
[supervisor]config_dir = "/aegis/config/supervisor"log_dir = "/aegis/logs/supervisor"run_dir = "/aegis/run/supervisor"
KeyDefaultMeaning
config_dir/aegis/config/supervisorsupervisord.conf and programs/*.conf
log_dir/aegis/logs/supervisorsupervisord log and per-program logs
run_dir/aegis/run/supervisorcontrol socket and pid file

Programs are not keys: each one is a file under config_dir/programs/, written by programs add (see below).

#Files

text
<supervisor.config_dir>/├── supervisord.conf          main configuration└── programs/    └── <name>.conf           one ``[program:…]`` block per command<supervisor.log_dir>/├── supervisord.log└── <name>.log, <name>-error.log<supervisor.run_dir>/├── supervisord.pid└── supervisor.sock

#Commands

bash
aegis cubes supervisor configure   # configuration, start or restartaegis cubes supervisor validate    # supervisorctl statusaegis cubes supervisor reload      # reread + update, no restartaegis cubes supervisor start|stop|restart|statusaegis cubes supervisor programs listaegis cubes supervisor programs add worker --command="/usr/bin/php worker.php"     --directory=/aegis/www/app --user=aegisaegis cubes supervisor programs remove workeraegis cubes supervisor expose

programs add writes the program file and then runs reread + update, so the new program starts without touching the others. programs remove deletes the file and stops the program the same way.

#Program file

ini
; Aegis  program worker; generated by aegis cubes supervisor[program:worker]command=/usr/bin/php worker.phpdirectory=/aegis/www/appuser=aegisautostart=trueautorestart=truestartsecs=5stopasgroup=truekillasgroup=truestdout_logfile=/aegis/logs/supervisor/worker.logstderr_logfile=/aegis/logs/supervisor/worker-error.logstdout_logfile_maxbytes=20MBstderr_logfile_maxbytes=20MB

#Process

toml
[services.supervisor]command  = <runtime>/bin/supervisord -n -c <config_dir>/supervisord.confpid_file = <run_dir>/supervisord.pid

Two settings keep the keeper in charge: nodaemon=true in the rendered configuration (Supervisor would otherwise fork and the keeper would see the process exit) and -n on the command line.

Where the binaries are: Supervisor is a Python package, so supervisord and supervisorctl land in the bundled runtime's bin directory, not in the application prefix. The cube looks there first.

#validate and reload

validate runs supervisorctl status. Exit code 3 means "some program is stopped", which is a valid state, so only other codes are treated as errors.

reload is supervisorctl reread followed by supervisorctl update: programs whose files changed are restarted, the rest keep running.

#expose

bash
aegis cubes supervisor exposecube           supervisorinstalled      /aegis/apps/system/supervisor/4.3configuration  /aegis/config/supervisorstate          running pid 893865config         /aegis/config/supervisor/supervisord.confprograms       1socket         /aegis/run/supervisor/supervisor.sockpublished      /aegis/bin/supervisord /aegis/bin/supervisorctl