2019-05-07 21:23:35 +02:00
#jinja2: lstrip_blocks: "True"
2018-11-28 11:02:51 +01:00
#!/bin/bash
if [ "$(id -u)" != "0" ]; then
2019-01-26 08:37:26 +01:00
echo "This script must be executed as root! Aborting."
exit 1
2018-11-28 11:02:51 +01:00
fi
2019-02-28 10:51:09 +01:00
echo "WARNING! You are about to remove everything the playbook installs for {{ matrix_server_fqn_matrix }}: matrix, docker images,..."
2018-11-28 11:02:51 +01:00
echo -n "If you're sure you want to do this, type: 'Yes, I really want to remove everything!'"
read sure
if [ "$sure" != "Yes, I really want to remove everything!" ]; then
2019-01-26 08:37:26 +01:00
echo "Good thing I asked, exiting"
exit 0
2018-11-28 11:02:51 +01:00
else
2024-10-18 16:28:00 +02:00
echo "Stop and remove Matrix services"
2021-01-24 18:42:32 +01:00
2022-11-04 15:38:38 +01:00
for s in $(find {{ devture_systemd_docker_base_systemd_path }}/ -type f -name "matrix-*" -printf "%f\n"); do
2021-01-25 07:58:23 +01:00
systemctl disable --now $s
2022-11-04 15:38:38 +01:00
rm -f {{ devture_systemd_docker_base_systemd_path }}/$s
2019-01-26 08:37:26 +01:00
done
2021-01-24 18:42:32 +01:00
2019-01-26 08:37:26 +01:00
systemctl daemon-reload
2021-01-24 18:42:32 +01:00
2020-11-24 08:38:17 +01:00
echo "Remove unused Docker images and resources"
docker system prune -af
Relocate Traefik (to matrix-traefik.service && /matrix/traefik base path)
The migration is automatic. Existing users should experience a bit of
downtime until the playbook runs to completion, but don't need to do
anything manually.
This change is provoked by https://github.com/spantaleev/matrix-docker-ansible-deploy/pull/2535
While my statements there ("Traefik is a shared component among
sibling/related playbooks and should retain its global
non-matrix-prefixed name and path") do make sense, there's another point
of view as well.
With the addition of docker-socket-proxy support in bf2b54080789f7e,
we potentially introduced another non-`matrix-`-prefixed systemd service
and global path (`/devture-container-socket-proxy`). It would have
started to become messy.
Traefik always being called `devture-traefik.service` and using the `/devture-traefik` path
has the following downsides:
- different playbooks may write to the same place, unintentionally,
before you disable the Traefik role in some of them.
If each playbook manages its own installation, no such conflicts
arise and you'll learn about the conflict when one of them starts its
Traefik service and fails because the ports are already in use
- the data is scattered - backing up `/matrix` is no longer enough when
some stuff lives in `/devture-traefik` or `/devture-container-socket-proxy` as well;
similarly, deleting `/matrix` is no longer enough to clean up
For this reason, the Traefik instance managed by this playbook
will now be called `matrix-traefik` and live under `/matrix/traefik`.
This also makes it obvious to users running multiple playbooks, which
Traefik instance (powered by which playbook) is the active one.
Previously, you'd look at `devture-traefik.service` and wonder which
role was managing it.
2023-03-06 08:32:13 +01:00
echo "This playbook creates a lot of matrix-* networks. Consider removing them manually ('docker network ls', followed by 'docker network rm NETWORK_NAME')"
2019-04-27 22:12:05 +02:00
echo "Remove {{ matrix_base_data_path }} directory"
rm -fr "{{ matrix_base_data_path }}"
2019-01-26 08:37:26 +01:00
exit 0
2018-11-28 11:02:51 +01:00
fi