The https://github.com/wikimedia/service-runner project establishes a standard interface for node services. This means that each service (or collection of services) has the same commandline arguments, uses the same config format & starts up the same way.
We should be able to exploit this regularity to use a standard puppet module to set up each of these services. A lot of the templates should be identical with those needed for the Debian package (see T89900), so lets try to share as much of the template code as possible.
## Generic service tasks
### Can be done by Debian package or puppet
- Set up an init script / systemd unit
- Can use [the restbase init](https://github.com/wikimedia/operations-puppet/blob/production/modules/restbase/templates/restbase.init) as a template
- Parameters:
- service name: used for paths (config in /etc/{service}/, init in /etc/init.d/{service}), user, group
- user / group setup: use service name
- normally, no local logging (apart from syslog) should be needed any more - we use logstash
- could set up [an /etc/defaults/{service}](https://github.com/wikimedia/operations-puppet/blob/production/modules/restbase/templates/restbase.default.erb) file
### Unique to Puppet / trebuchet
- set up generic groups & sudo rules per service to allow members of a svc-{service}-deployers group to:
- service start, stop, restart
- execute commands as the service user / group: attach the node debugger, trigger heap dumps
- (ideally) perform common debug tasks like checking network connections per process with `netstat -p`
### Unique to trebuchet-based deploys
- set up the full trebuchet system (and make sure it actually works)
## Per-service settings
- config.yaml has at least some per-service settings that need to be modified for each instance of the service. We can create a thin puppet module for each service that contains a thin `init.pp` for the defaults and the config.yaml template. The template should ideally be shared with / provided by the service itself. It would also be desirable if modifications to this puppet template would not require global +2 in puppet, although I'm not sure how that would work.