Resetting a replicated swarm installation


#1

Often when prototyping an application it makes sense to install fresh rather than upgrade an app. On native this is relatively simple - stop Replicated with systemctl stop replicated replicated-ui replicated-operator, remove /var/lib/replicated/ with rm -rf /var/lib/replicated/*, and start Replicated again systemctl start replicated replicated-ui replicated-operator. This removes all app and Replicated settings allowing for a fresh installation without having to completely reinstall Replicated!

Unfortunately, Swarm does not store its files at /var/lib/replicated - instead they are stored in a named Docker volume. The equivalent procedure is docker service scale replicated_replicated=0 replicated_replicated-ui=0 to stop Replicated, docker run --rm -it -v replicated_replicated-data-volume:/datavol alpine /bin/sh -c "rm -rf /datavol/*" to clear the files, and then docker service scale replicated_replicated=1 replicated_replicated-ui=1 to start Replicated again. More obscure, but the same result!