Page MenuHomePhabricator

puppetdb4: systemd config review
Closed, ResolvedPublic

Description

The puppetlabs puppetdb-4.4 package includes a working, but unorthodox, systemd config. It wraps a few shell scripts presumably allowing puppet labs to be less platform dependent in their packaging.

Opening a task to review the differences between the current and new units and plan necessary modifications (if any)

Event Timeline

herron triaged this task as Medium priority.

Current:

[Unit]
Description="puppetDB centralized storage daemon"

[Service]
User=puppetdb
Group=puppetdb
Environment=CONFIG=/etc/puppetdb/conf.d
ExecStartPre=/bin/bash -c "test -e /var/log/puppetdb/puppetdb-oom.hprof && mv /var/log/puppetdb/puppetdb-oom.hprof /var/log/puppetdb/puppetdb-oom.hprof.prev || exit 0"
ExecStart=/usr/bin/java -Xmx6g -javaagent:/usr/share/java/prometheus/jmx_prometheus_javaagent.jar=10.64.32.199:9400:/etc/puppetdb/jvm_prometheus_puppetdb_jmx_exporter.yaml \
-XX:+ExitOnOutOfMemoryError -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/var/log/puppetdb/puppetdb-oom.hprof -Djava.security.egd=file:/dev/urandom \
-cp /usr/share/puppetdb/puppetdb.jar clojure.main -m com.puppetlabs.puppetdb.core services -c ${CONFIG}
ExecReload=/bin/kill -HUP $MAINPID
Restart=always
RestartSec=10s
SyslogIdentifier=puppetdb

[Install]
WantedBy=multi-user.target

new:

[Unit]
Description=puppetdb Service
After=syslog.target network.target

[Service]
Type=forking
EnvironmentFile=/etc/default/puppetdb
User=puppetdb
TimeoutStartSec=300
TimeoutStopSec=60
Restart=on-failure
StartLimitBurst=5
PIDFile=/var/run/puppetlabs/puppetdb/puppetdb.pid
#set default privileges to -rw-r-----
UMask=027


ExecReload=/opt/puppetlabs/server/apps/puppetdb/bin/puppetdb reload
ExecStart=/opt/puppetlabs/server/apps/puppetdb/bin/puppetdb start
ExecStop=/opt/puppetlabs/server/apps/puppetdb/bin/puppetdb stop

KillMode=process

SuccessExitStatus=143

StandardOutput=syslog

[Install]
WantedBy=multi-user.target

You'll notice that the new version lacks the oom settings (do we still need these?) among other settings. Jvm tuning, user, group, etc move to /etc/default/puppetdb

###########################################
# Init settings for puppetdb
###########################################

# Location of your Java binary (version 7 or higher)
JAVA_BIN="/usr/bin/java"

# Modify this if you'd like to change the memory allocation, enable JMX, etc
JAVA_ARGS="-Xmx4G -javaagent:/usr/share/java/prometheus/jmx_prometheus_javaagent.jar=10.68.21.45:9400:/etc/puppetdb/jvm_prometheus_puppetdb_jmx_exporter.yaml"

# These normally shouldn't need to be edited if using OS packages
USER="puppetdb"
GROUP="puppetdb"
INSTALL_DIR="/opt/puppetlabs/server/apps/puppetdb"
CONFIG="/etc/puppetlabs/puppetdb/conf.d"

# Bootstrap path
BOOTSTRAP_CONFIG="/etc/puppetlabs/puppetdb/bootstrap.cfg"

# SERVICE_STOP_RETRIES can be set here to alter the default stop timeout in
# seconds.  For systemd, the shorter of this setting or 'TimeoutStopSec' in
# the systemd.service definition will effectively be the timeout which is used.
SERVICE_STOP_RETRIES=60

# START_TIMEOUT can be set here to alter the default startup timeout in
# seconds.  For systemd, the shorter of this setting or 'TimeoutStartSec'
# in the service's systemd.service configuration file will effectively be the
# timeout which is used.
START_TIMEOUT=300


# Maximum number of seconds that can expire for a service reload attempt before
# the result of the attempt is interpreted as a failure.
RELOAD_TIMEOUT=120

We'd still need the oom settings to help debugging oom cases we've seen on nitrogen for example. Passing a directory instead of a file to -XX:HeapDumpPath will create dump files with pid and thus we can get rid of ExecStartPre setting too. Alternatively we can ship a systemd override file with the custom changes we need.

What is the status of this considering we are now [i plan to drop the old puppetdb's completely next week] on puppetdb6

MoritzMuehlenhoff claimed this task.

The systemd unit shipped in the Buster package is fine, this was specific to the Puppet Labs one, so closing.