Skip to content

Instantly share code, notes, and snippets.

@nexdrew
Last active July 13, 2016 17:53
Show Gist options
  • Save nexdrew/fef928afacaa93acb0be to your computer and use it in GitHub Desktop.
Save nexdrew/fef928afacaa93acb0be to your computer and use it in GitHub Desktop.

Uninstalling npm Enterprise

While installing npme handles the installation of dependencies, uninstalling npme does not uninstall its dependencies. Here's a quick guide to uninstall and remove the different components that make up the Enterprise product.

  1. Uninstall the npme package

    sudo npm uninstall -g npme
    
  2. Note storage paths in admin console settings

    If you wish to remove all packages and data from your registry, please make a note of all the Storage paths you have configured for your instance at https://<your-server>:8800/settings.

    The default root is /usr/local/lib/npme. You can remove these in step 6 below.

  3. Uninstall the orchestration layer

    To uninstall and remove Replicated, please follow the instructions found here.

    Ubuntu/Debian:

    sudo service replicated stop
    sudo service replicated-ui stop 
    sudo service replicated-operator stop
    sudo docker rm -f replicated replicated-ui replicated-operator
    sudo docker images | grep "quay\.io/replicated" | awk '{print $3}' | xargs sudo docker rmi -f
    sudo apt-get remove -y replicated replicated-ui replicated-operator
    sudo apt-get purge -y replicated replicated-ui replicated-operator
    sudo rm -rf /var/lib/replicated* /etc/replicated* /etc/init/replicated* /etc/init.d/replicated* /etc/default/replicated* /var/log/upstart/replicated* /etc/systemd/system/replicated*
    

    CentOS/RHEL:

    sudo systemctl stop replicated replicated-ui replicated-operator
    sudo service replicated stop
    sudo service replicated-ui stop 
    sudo service replicated-operator stop
    sudo docker rm -f replicated replicated-ui replicated-operator
    sudo docker images | grep "quay\.io/replicated" | awk '{print $3}' | xargs sudo docker rmi -f
    sudo yum remove -y replicated replicated-ui replicated-operator
    sudo rm -rf /var/lib/replicated* /etc/replicated* /etc/init/replicated* /etc/default/replicated* /etc/systemd/system/replicated*
    
  4. Stop and remove all Docker containers and images

    Assuming you are not using Docker for anything else on your server, you may remove all running Docker containers and images with the following commands:

    # stop all containers
    sudo docker stop $(sudo docker ps -aq)
    # remove all containers
    sudo docker rm $(sudo docker ps -aq)
    # remove all images
    sudo docker rmi -f $(sudo docker images -q)
    
  5. Optionally uninstall Docker

    If you wish, you may also remove Docker itself. Use the instructions for your Linux distribution:

    Ubuntu/Debian instructions, sample:

    sudo apt-get autoremove --purge docker-engine
    sudo rm -rf /var/lib/docker
    

    CentOS/RHEL instructions, sample:

    sudo yum -y remove docker-engine
    sudo rm -rf /var/lib/docker
    
  6. Optionally remove packages and Enterprise data

    To completely wipe the Enterprise data, you should also remove the directories noted from step 2. Note that this will remove all packages you have published thus far!

    # caution! make sure the directory below is correct
    # caution! this will remove all published packages
    sudo rm -r /usr/local/lib/npme
    
  7. Optionally uninstall Node.js and npm

    Assuming you do not need Node.js or npm for anything else on your server, you may uninstall them via the system package manager you used to install Node.js.

    Ubuntu/Debian:

    sudo apt-get autoremove --purge nodejs
    

    CentOS/RHEL:

    sudo yum -y remove nodejs
    

This should remove all traces of npm Enterprise from your server.

Reinstalling npm Enterprise

Follow the same steps as outlined in the quickstart guide.

  1. Reinstall Node.js and npm

    Ubuntu/Debian:

    sudo apt-get install -y nodejs
    sudo npm i -g npm@latest
    

    CentOS/RHEL:

    sudo yum -y install nodejs
    sudo npm i -g npm@latest
    
  2. Install npme

    sudo npm install npme -g --unsafe
    

    Answer any prompts and wait for the installer to complete.

    Once it's done, verify docker and replicated daemons are running:

    sudo ps aux | grep -e docker -e replicated
    sudo docker ps -a
    replicated nodes
    
  3. Complete installation via admin web console

    Use the admin web console at https://<your-server>:8800 to complete the installation and configure your instance.

    See standard install instructions.

  4. Wait for the services to start

    reinstall-step4

  5. Check for error on startup

    On reinstallation, it's possible that the node used by Replicated may not be provisioned correctly, in which case you will receive an error on initial start of the appliance.

    reinstall-step5a

    To fix this, check the "Connected" and "Initialized" status of the single node under the Cluster page at https://<your-server>:8800/cluster.

    reinstall-step5b

    If they do not show as green/checked, then you will need to manually reset the node via the following CLI commands:

    # login with same credentials of admin web console
    sudo replicated login
    # get the app node name
    sudo replicated nodes
    # remove the host
    sudo replicated node rm <node-id>
    

    Next, visit the Cluster page again in the UI and click "Add Node".

    reinstall-step5c

    Select "Install Manually".

    reinstall-step5d

    Copy the displayed command:

    reinstall-step5e

    Run it in your SSH terminal. Note that the private_ip variable argument can be omitted.

    curl -sSL https://get.replicated.com/operator | sudo sh -s daemon-endpoint=<ip_from_ui>:9879 daemon-token=<token_from_ui> private-address=<ip_from_ui> public-address=<ip_from_ui>
    

    Then check the state of the node in the UI. It should now be connected and initialized.

    reinstall-step5f

    Start the registry services by going to the Dashboard and hitting the "Start Now" button.

    reinstall-step5g

    Once the services are up, verify a healthy node on the Cluster page.

    reinstall-step5h

    You are good to go! You can now configure your CLI client and start using your Enterprise registry!

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