Skip to content

Remove a dev facility

This page takes a dev facility off this machine: its service, its web address, its database and its account, and its settings. Nothing of it is worth keeping, because all of it was built from a dump and can be built again, so nothing here asks for confirmation.

Every command uses the facility's short name as <facility> and its address as <address>, from the table on Build a dev facility.

Stop its server

systemctl --user disable --now zfm-server@<facility>

disable is for the next login, --now is for now.

Take it off the air

sudo rm /etc/caddy/conf.d/<facility>.caddy
sudo caddy validate --config /etc/caddy/Caddyfile
sudo systemctl reload caddy
sudo sed -i '/ <address>$/d' /etc/hosts

Every other facility keeps serving through the reload. The hosts line goes from whichever machine runs the browser, which is this one when you added it here.

Drop its database and its account

The database name, the account and its password are the one string in the facility's settings:

cd "$ZFM_ROOT_DIR"
grep DB_NAME zf-server/environments/<facility>.env
docker exec zfm-mysql mysql -uroot -prootpass -e "DROP DATABASE IF EXISTS <db-name>; DROP USER IF EXISTS '<db-name>'@'%';"

rootpass is the admin db password, which the container was started with.

Delete its settings

cd "$ZFM_ROOT_DIR"
rm zf-server/environments/<facility>.env

Am I done?

systemctl --user list-units 'zfm-server@*'
docker exec zfm-mysql mysql -uroot -prootpass -e 'SHOW DATABASES'
ls /etc/caddy/conf.d zf-server/environments

The facility is in none of the four answers.