Resetting file sync

You'll need to reset the file sync service if file sync enters a failure state, if file sync consumes all available disk space, or a repository becomes irreparably corrupted.

Before you begin:
  • Ensure that your Git server is reachable from your primary server.

Resetting the file sync service deletes the commit history for all repositories that file sync tracks. This frees up disk space and returns the service to a fresh state while preserving code in the staging directory.

  1. Stop Puppet services.

    On your primary server, the replica (if your installation includes disaster recovery), and any compilers in your installation, run the following commands:

    puppet resource service puppet ensure=stopped 
    puppet resource service pe-puppetserver ensure=stopped
  2. Stop orchestration services.

    On your primary server only, run the following command:

    puppet resource service pe-orchestration-services ensure=stopped
  3. Clean up the code directory.

    On your primary server, the replica, and compilers, delete all files inside the code directory, including all hidden files, and recreate the environments/production directory:

    find /etc/puppetlabs/code -mindepth 1 -delete 
    mkdir -p /etc/puppetlabs/code/environments/production
    chown -R pe-puppet:pe-puppet /etc/puppetlabs/code
    chmod 755 /etc/puppetlabs/code/environments
    chmod 750 /etc/puppetlabs/code/environments/production
  4. Move and recreate the code staging directory.

    On the primary server only, run the following commands:

    mv /etc/puppetlabs/code-staging /etc/puppetlabs/code-staging.old 
    mkdir /etc/puppetlabs/code-staging 
    chown pe-puppet:pe-puppet /etc/puppetlabs/code-staging 
    chmod 750 /etc/puppetlabs/code-staging
  5. Delete Code Manager directories.

    On your primary server, the replica, and compilers, delete all Code Manager directories for Puppet Server and the orchestrator:

    rm -rf /opt/puppetlabs/server/data/code-manager/git/ 
    rm -rf /opt/puppetlabs/server/data/code-manager/worker-caches/ 
    rm -rf /opt/puppetlabs/server/data/orchestration-services/data-dir 
    /opt/puppetlabs/server/data/orchestration-services/code 
    rm -rf /opt/puppetlabs/server/data/puppetserver/filesync
  6. Clear lockless code deploys symlink.

    If you have enabled lockless code deploys, run the following command on your primary server, the replica, and any compilers:

    unlink /etc/puppetlabs/puppetserver/code
  7. Restart Puppet services.

    On your primary server, the replica, and compilers, run the following commands:

    puppet resource service puppet ensure=running 
    puppet resource service pe-puppetserver ensure=running
  8. Restart orchestration services.

    On the primary server only, run the following command:

    puppet resource service pe-orchestration-services ensure=running
  9. Trigger a code deployment.

    Using Code Manager, use the command line to trigger a code deployment.

    puppet-code deploy --all --wait

Results: When you reset the file sync service, it creates fresh repositories on each client and on the storage server for the code it manages.