diff --git a/README.md b/README.md
index 5da75d54..e1097c68 100644
--- a/README.md
+++ b/README.md
@@ -61,6 +61,8 @@ The following environment variables are supported:
| **PUPPETDB_SERVER_URLS** | The `server_urls` to set in `/etc/puppetlabs/puppet/puppetdb.conf`
`https://puppetdb:8081` |
| **PUPPETDB_HOSTNAME** | The DNS name of the puppetdb
Defaults to `puppetdb` |
| **PUPPETDB_SSL_PORT** | The TLS port of the puppetdb
Defaults to `8081` |
+| **PUPPETSERVER_GRAPHITE_EXPORTER_ENABLED** | Activate the graphite exporter. Also needs **PUPPETSERVER_GRAPHITE_HOST** and **PUPPETSERVER_GRAPHITE_PORT**
Defaults to `false` |
+| **PUPPETSERVER_ENVIRONMENT_TIMEOUT** | Configure the environment timeout
Defaults to `unlimited` |
## Initialization Scripts
diff --git a/puppetserver/Dockerfile b/puppetserver/Dockerfile
index 51ef299c..f92cb2f8 100644
--- a/puppetserver/Dockerfile
+++ b/puppetserver/Dockerfile
@@ -37,7 +37,9 @@ ENV PUPPETSERVER_JAVA_ARGS="-Xms1024m -Xmx1024m" \
PUPPETDB_SERVER_URLS=https://puppetdb:8081 \
PUPPET_STORECONFIGS_BACKEND="puppetdb" \
PUPPET_STORECONFIGS=true \
- PUPPET_REPORTS="puppetdb"
+ PUPPET_REPORTS="puppetdb" \
+ PUPPETSERVER_GRAPHITE_EXPORTER_ENABLED=false \
+ PUPPETSERVER_ENVIRONMENT_TIMEOUT=unlimited
# NOTE: this is just documentation on defaults
EXPOSE 8140
@@ -51,6 +53,7 @@ COPY docker-entrypoint.sh \
healthcheck.sh \
/
COPY docker-entrypoint.d /docker-entrypoint.d
+COPY metrics.conf.tmpl /metrics.conf.tmpl
# k8s uses livenessProbe, startupProbe, readinessProbe and ignores HEALTHCHECK
HEALTHCHECK --interval=20s --timeout=15s --retries=12 --start-period=3m CMD ["/healthcheck.sh"]
diff --git a/puppetserver/docker-entrypoint.d/83-environment-cache.sh b/puppetserver/docker-entrypoint.d/83-environment-cache.sh
new file mode 100755
index 00000000..4bef8194
--- /dev/null
+++ b/puppetserver/docker-entrypoint.d/83-environment-cache.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+#
+if [ -n "$PUPPETSERVER_ENVIRONMENT_TIMEOUT" ]; then
+ echo "Settings environment_timeout to ${PUPPETSERVER_ENVIRONMENT_TIMEOUT}"
+ puppet config set --section master environment_timeout $PUPPETSERVER_ENVIRONMENT_TIMEOUT
+else
+ echo "Removing environment_timeout"
+ puppet config delete --section master environment_timeout
+fi
+
diff --git a/puppetserver/docker-entrypoint.d/84-enable_graphite.sh b/puppetserver/docker-entrypoint.d/84-enable_graphite.sh
new file mode 100755
index 00000000..72d12cda
--- /dev/null
+++ b/puppetserver/docker-entrypoint.d/84-enable_graphite.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+if [[ "$PUPPETSERVER_GRAPHITE_EXPORTER_ENABLED" == "true" ]]; then
+ if [ -n "$PUPPETSERVER_GRAPHITE_HOST" and -n "$PUPPETSERVER_GRAPHITE_PORT" ]; then
+ echo "Enabling graphite exporter"
+ sed -e "s/GRAPHITE_HOST/$PUPPETSERVER_GRAPHITE_HOST/" -e "s/GRAPHITE_PORT/$PUPPETSERVER_GRAPHITE_PORT/" /metrics.conf.tmpl > /etc/puppetlabs/puppetserver/conf.d/metrics.conf
+ else
+ echo "ERROR: no PUPPETSERVER_GRAPHITE_HOST or PUPPETSERVER_GRAPHITE_PORT set."
+ exit 99
+ fi
+fi
+
diff --git a/puppetserver/metrics.conf.tmpl b/puppetserver/metrics.conf.tmpl
new file mode 100644
index 00000000..2151a48c
--- /dev/null
+++ b/puppetserver/metrics.conf.tmpl
@@ -0,0 +1,53 @@
+# settings related to metrics
+metrics: {
+ # a server id that will be used as part of the namespace for metrics produced
+ # by this server
+ server-id: localhost
+ registries: {
+ puppetserver: {
+ # specify metrics to allow in addition to those in the default list
+ #metrics-allowed: ["compiler.compile.production"]
+
+ reporters: {
+ # enable or disable JMX metrics reporter
+ jmx: {
+ enabled: true
+ }
+ # enable or disable Graphite metrics reporter
+ graphite: {
+ enabled: true
+ }
+ }
+
+ }
+ }
+
+ # this section is used to configure settings for reporters that will send
+ # the metrics to various destinations for external viewing
+ reporters: {
+ graphite: {
+ # graphite host
+ host: "GRAPHITE_HOST"
+ # graphite metrics port
+ port: GRAPHITE_PORT
+ # how often to send metrics to graphite
+ update-interval-seconds: 5
+ }
+ }
+ metrics-webservice: {
+ jolokia: {
+ # Enable or disable the Jolokia-based metrics/v2 endpoint.
+ # Default is true.
+ # enabled: false
+
+ # Configure any of the settings listed at:
+ # https://jolokia.org/reference/html/agents.html#war-agent-installation
+ servlet-init-params: {
+ # Specify a custom security policy:
+ # https://jolokia.org/reference/html/security.html
+ # policyLocation: "file:///etc/puppetlabs/puppetserver/jolokia-access.xml"
+ }
+ }
+ }
+
+}