You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
matrix-docker-ansible-deploy/roles/custom/matrix_playbook_migration/tasks/devture_traefik_to_matrix_t...

36 lines
1.7 KiB

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.
1 year ago
---
# This migrates Traefik from the old path (`/devture-traefik`) to the new path (`/matrix/traefik`, controlled by `devture_traefik_base_path`),
# and from the old hardcoded systemd service name (`devture-traefik.service`) to the new one (`matrix-traefik.service`, controlled by `devture_traefik_identifier`).
#
# Here, we merely disable (and stop) the old systemd service and relocate the data (`/devture-traefik` directory).
# The Traefik role itself (running later) will then ensure this data is up-to-date and will set up the new systemd service.
# It only makes sense to migrate if the identifier or path are different than the default (what we were using before).
- when: "devture_traefik_identifier != 'devture-traefik' or devture_traefik_base_path != '/devture-traefik'"
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.
1 year ago
block:
- name: Check existence of devture-traefik.service systemd service
ansible.builtin.stat:
path: "{{ devture_systemd_docker_base_systemd_path }}/devture-traefik.service"
register: devture_traefik_service_stat
- when: devture_traefik_service_stat.stat.exists | bool
block:
- name: Ensure devture-traefik.service systemd service is stopped
ansible.builtin.systemd:
name: devture-traefik
state: stopped
enabled: false
daemon_reload: true
- name: Ensure Traefik directory relocated
ansible.builtin.command:
cmd: "mv /devture-traefik {{ devture_traefik_base_path }}"
creates: "{{ devture_traefik_base_path }}"
removes: "/devture-traefik"
- name: Ensure Traefik systemd service doesn't exist
ansible.builtin.file:
path: "{{ devture_systemd_docker_base_systemd_path }}/devture-traefik.service"
state: absent