Lockless code deploys
When deploying code, Puppet Server blocks requests, including catalog compilation, until file sync is done updating the Puppet code directory. However, you can enable lockless code deploys to deploy code without blocking requests to Puppet Server. With lockless code deploys, the file sync client updates code into versioned code directories instead of blocking requests and overwriting the live code directory.
/opt/puppetlabs/server/data/puppetserver/filesync/client/versioned-dirs/puppet-code/
When you enable lockless code deploys, the standard code directory (/etc/puppetlabs/code
) is reconfigured to /etc/puppetlabs/puppetserver/code
, which points, via
symlink, to the most recent versioned code directory (at the versioned directories
filepath specified above). If you disable lockless deploys after enabling it, your code
directory moves back to the default location.
With lockless deploys, you can deploy a new version of code alongside an old version.
When a catalog compiles starts, it uses the full path to the most recent version of code
in the versioned code directory (via the /etc/puppetlabs/puppetserver/code
symlink). Existing catalog compiles
continue using the version they started on and new compiles use the latest code
version.
To conserve disk space, code written to versioned directories is optimized to reduce
duplication, and directories older than the latest and its predecessor are cleaned up
after 30 minutes. If you deploy code very frequently, you might prefer to decrease the
versioned-dirs-ttl
setting, which is specified, in
minutes, in file-sync.conf
within each file sync
client.
Enable lockless code deploys
You can enable lockless code deploys on compilers individually or all at once. You must enable lockless code deploys on the primary server, the replica, and all compilers; however, we recommend testing one compiler before enabling lockless code deploys on all Puppet Server instances.
Enable lockless code deploys on one compiler
Use these steps to enable lockless code deploys on one Puppet Server instance.
Enable lockless code deploys on all Puppet Server instances
Use enable lockless code deploys globally (on the primary server, the replica, and
all compilers), you need to set the puppet_enterprise::profile::master::versioned_deploys
parameter to true
.
pe.conf
or
the PE console (as configuration data).- Open your default Hiera
.yaml
file in a text editor.Tip: For information about Hiera data files, including file paths, refer to Configure settings with Hiera. - Add the
versioned_deploys
parameter and set it totrue
. For example:puppet_enterprise::profile::master::versioned_deploys: true
- Save the file and run Puppet on your primary
server and all compilers
twice:
puppet agent -t; puppet agent -t
- On your primary server, run:
puppet code deploy --all --wait
Important: You must deploy all environments (with--all
) to avoid errors.
To use the PE console to enable lockless code deploys:
System requirements for lockless deploys
Enabling lockless deploys increases the disk storage required on your primary server and compilers because code is written to multiple versioned directories, instead of a single live code directory. Follow these guidelines for estimating your required system capacity.
(Size of typical environment)×(Number of active environments)
For
example, if your typical environment is 200 MB on disk when deployed, and you have 25
active environments, your disk storage calculation is 200 MB ×
25
, which equals 5,000 MB or 5 GB.(Size of typical environment × .25)×(Number of environments deployed multiple times per day)×(Number of deployments per day)
Continuing
the previous example, if 6 of your 200 MB environments are deployed up to 10 times per
day, your additional disk storage calculation is (200 MB × .25) ×
6 × 10
, which equals 3,000 MB or 3 GB of additional disk space. In total,
this example requires 8 GB available for your primary server and each compiler.