Skip to content

fix refresh when service_manage = false - #129

Open
ThomasLohner wants to merge 15 commits into
ajcurated:masterfrom
ScaleCommerce:master
Open

fix refresh when service_manage = false#129
ThomasLohner wants to merge 15 commits into
ajcurated:masterfrom
ScaleCommerce:master

Conversation

@ThomasLohner

Copy link
Copy Markdown

This fixes #128. Changes to config or supervisord::program resources should always be applied, regardless of how the service is managed.

ThomasLohner and others added 15 commits February 14, 2019 14:42
…ip installations (skip install, if file exists to skip install in default pyenv)
…ndant pip installs in new virtual environments
… zpinit

When the global hiera key sc::service_manager is 'zpinit':
- supervisord::program emits a zpinit::service instead of supervisord config +
  supervisorctl, while STILL declaring Supervisord::Program[$title] so existing
  before/require/notify => Supervisord::Program[X] references keep resolving on
  both backends (no data rewrite needed);
- supervisord::install is a no-op (daemon not installed);
- supervisord::service is a no-op (daemon service not managed).

The supervisord class stays loadable as a harmless no-op, so nodes do not need
to exclude it. Transitional shim while the fleet migrates to zpinit.

Bump 0.6.1 -> 0.6.2.
Add a service_manager custom fact (reports 'zpinit' when zpinit is the
node's PID-1 supervisor, else 'supervisor') and make init.pp compute
$supervisord::service_manager from it, with sc::service_manager as an
optional explicit override. program.pp/install.pp/service.pp now read
that single value instead of each doing its own lookup. Nodes built from
the zpinit image are detected without any hiera key.
supervisord::config managed the daemon config dirs and notified
supervisord::reload, whose supervisorctl reread/update execs then failed
on zpinit nodes (no supervisorctl). A zpinit node has no supervisord
daemon, so gate both classes on the detected backend the same way
install.pp/service.pp already are. The classes stay declared so notify
and anchor references keep resolving.
supervisorctl start/stop/remove used the bare program name whenever
numprocs == 1. But a program with an explicit process_name containing
%(process_num) is a homogeneous process group even at numprocs == 1, so
the bare name is not addressable and supervisorctl reports 'no such
process' on every run (e.g. messenger-worker-priority-low). Switch $pname
to the ':*' group form when process_name templates the process number,
not just when numprocs > 1. Supervisor-backend only; the zpinit branch is
unaffected.
zpinit::service writes a TOML but does not load it into the running set;
loading was happening only for programs that also have a Service[name]
(via the zpinit Service provider's reread+update). Programs declared only
as supervisord::program with no Service (cron, gitlab-runner,
rundeck-node-consul-*) had their TOML written but never zpctl-updated, so
they stayed unloaded until the next zpinit restart.

Restore the global-reload step the supervisord backend has via
supervisord::reload: on zpinit that class now runs 'zpctl update' (global
config reload), and program.pp's zpinit branch notifies it on TOML change,
mirroring the supervisord branch's notify. Refreshonly + idempotent.
0.6.6 had the dispatch shim notify supervisord::reload to run zpctl update
on zpinit. That is the wrong layer: zpinit::service now triggers the reload
itself on TOML change (zpinit 0.6.0). Restore supervisord::reload to a
no-op on zpinit and drop the program.pp notify, so this module just
dispatches and zpinit owns when zpinit reloads.
On zpinit nodes the supervisord daemon is not installed, so any leftover
caller invoking supervisorctl (scripts, third-party tooling, cron jobs)
fails with 'command not found'. Drop a /usr/local/bin/supervisorctl ->
/usr/local/bin/zpctl symlink in supervisord::install's zpinit branch;
zpctl implements the same verbs, so those callers transparently drive
zpinit. Supervisor nodes are unaffected (else branch installs supervisord
as before).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

service_manage = false breaks refresh on config or resource changes

2 participants