Skip to content

Instantly share code, notes, and snippets.

@big-samantha
Last active October 26, 2018 15:06
Show Gist options
  • Save big-samantha/2794f83d556ef441dcaab70b5c7fa30b to your computer and use it in GitHub Desktop.
Save big-samantha/2794f83d556ef441dcaab70b5c7fa30b to your computer and use it in GitHub Desktop.
How to completely wipe your code manager install and resync from scratch.

The best way to ensure we completely address this would be to just clear the File Sync cache. To do so:

  1. On the master, shutdown the pe-puppetserver service: service pe-puppetserver stop

  2. On the master, delete all the files inside /etc/puppetlabs/code, and /etc/puppetlabs/code-staging including all hidden files, leaving only the production environment:

# find /etc/puppetlabs/code -mindepth 1 -delete
# mkdir -p /etc/puppetlabs/code/environments/production
# mv /etc/puppetlabs/code-staging /etc/puppetlabs/code-staging.old
# mkdir /etc/puppetlabs/code-staging
  1. On the master, delete File Sync's data-dir: rm -rf /opt/puppetlabs/server/data/puppetserver/filesync
  1. On the master, ensure permissions on /code and /code-staging are correct:

    # chown -R pe-puppet:pe-puppet /etc/puppetlabs/code-staging
    # chown -R pe-puppet:pe-puppet /etc/puppetlabs/code
    
  1. Ensure all environments are enabled on the PuppetDB node: sudo su - pe-postgres -s /bin/bash -c "/opt/puppetlabs/server/bin/psql -d 'pe-classifier' -c \"UPDATE environments SET deleted = 'f' WHERE deleted = 't';\""

  2. Temporarily disable the environment cache on the Master node: puppet apply -e "pe_hocon_setting { 'cache': ensure => present, path => '/etc/puppetlabs/puppetserver/conf.d/pe-puppet-server.conf', setting => 'jruby-puppet.environment-class-cache-enabled', value => false }"

  3. On the master, restart the pe-puppetserver service: service pe-puppetserver start

  4. Run a code deploy to confirm whether or not it is working.

  5. If the code deploy is successful, reload the classes on the Console node by hitting the update-classes endpoint: curl -X POST https://$(hostname -f):4433/classifier-api/v1/update-classes --cert $(puppet config print hostcert) --key $(puppet config print hostprivkey) --cacert $(puppet config print localcacert)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment