Die Replicated! Die!

In the "cloud-first" world, we often treat everything as throw-away (because it is), but sometimes it's just a lot easier to run a few commands to purge an install to get back to a clean state than it is to blow away a whole VPS and start over (or reinstall a server from scratch - ick!)

First, Really Remove Docker

Replicated is very sticky. If you want to get back to a clean state, first you need to run some mad Docker foo.

Since this would be dangerous if you're also running other docker services and I don't want to re-type all my warnings and explanations (because I don't know how to copy and paste, of course), I'll just link to the article where I covered that:

It's the nuclear option, but it'll twist the arm of your Replicated instances and make them obey (whereas otherwise they may keep respawning).

Finally, Really Remove Replicated

Actually, I don't even remember where I found this, but it was in a script file on a machine that had a Replicated install, and when I ran it and rebooted I was able to re-install fresh.

purge-replicated.sh:

set -x

service replicated stop
service replicated-ui stop
service replicated-operator stop

docker stop replicated-premkit
docker stop replicated-statsd
docker rm -f replicated replicated-ui replicated-operator replicated-premkit replicated-statsd retraced-api retraced-processor retraced-cron retraced-nsqd retraced-postgres

docker images | grep "quay\.io/replicated" | awk '{print $3}' | xargs sudo docker rmi -f
docker images | grep "registry\.replicated\.com/library/retraced" | awk '{print $3}' | xargs sudo docker rmi -f

apt-get remove -y replicated replicated-ui replicated-operator
apt-get purge -y replicated replicated-ui replicated-operator

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*

And you'll need to run it with sudo (or otherwise as root) to make the magic happen:

sudo bash purge-replicated.sh

After that, your Replicated install should be completely purged.

Don't forget to reboot!

Just a spoon full of reboot helps the old services go down... in the most delightful way!

I don't know 100% whether or not it matters, but I come from the old school days where if something on your machine is sticking around, you delete it, reboot, and delete it again! (just to be safe)

Anyway, I feel a lot better after a reboot, and things worked for me, and so I advise you to do the same.

sudo shutdown -r now

P.S. Just keep in mind that on an ephemeral instance, such as Amazon AWS EC2, a reboot is essentially the same and starting over from scratch anyway - disk changes are only persisted on mounted volumes.


By AJ ONeal

If you loved this and want more like it, sign up!


Did I make your day?
Buy me a coffeeBuy me a coffee  

(you can learn about the bigger picture I'm working towards on my patreon page )