Understanding file sync and the staging directory

To sync your code across your primary server and compilers, and to make sure that code stays consistent, Code Manager relies on file sync and two different code directories: the staging directory and the live code directory.

Without Code Manager or file sync, Puppet code lives in the codedir, or live code directory, at /etc/puppetlabs/code.

With Code Manager and file sync, the file sync client service regularly checks for changes to staged code files in the staged code directory on the primary server (at /etc/puppetlabs/code-staging). If it detects a change, the file sync client service fetches the changes and syncs the files to the live codedir on each compiler and the primary server (at /etc/puppetlabs/code). The file sync client service uses HTTPS to poll for changes and JGit to fetch changes.

Because Code Manager moves new code from source control into the staging directory, and file sync moves it into the live code directory, you no longer write code in the codedir. If you manually edit the codedir, the next time Code Manager deploys code from source control, it overwrites your changes.

Don't directly modify code in the staging directory or live code directory (codedir). Code Manager overwrites the staging directory with changes from the control repo, and file sync overwrites the codedir with changes from the staging directory. Any changes made to these directories manually are overwritten.

Related information