Configure the environment timeout setting

The enviroment_timeout setting determines how often the primary Puppet server caches the data it loads from an environment. For best performance, change the settings after you have a mature code deployment process.

  1. Set environment_timeout = unlimited in puppet.conf.
  2. Change your code deployment process to refresh the primary server whenever you deploy updated code. For example, set a postrun command in your r10k config or add a step to your continuous integration job.

    • With Puppet Server, refresh environments by calling the environment-cache API endpoint. Ensure you have write access to the puppet-admin section of the puppetserver.conf file.

    • With a Rack primary server, restart the web server or the application server. Passenger lets you touch a restart.txt file to refresh an application without restarting Apache. See the Passenger docs for details.

Results

The environment-timeout setting can be overridden per-environment in environment.conf.

Only use the value 0 or unlimited. Most primary servers use a pool of Ruby interpreters, which all have their own cache timers. When these timers are out of sync, agents can be served inconsistent catalogs. To avoid that inconsistency, refresh the primary server when deploying.