Closed timo95 closed 5 years ago
You're right!
None of the bridges uninstall cleanly now.
They all just remove the systemd .service
file, but neither stop the currently-running service, nor restart Synapse.
I guess we should add a couple of tasks to the uninstall path of each bridge, which:
.service
file prior to deleting it.service
file exists, stop Synapse.service
file exists, stop the service.service
file (what we have now)We can't really start Synapse at the end of this uninstall flow, because there are other important tasks that need to run first.
Since the bridge is not installed, it won't get added to the matrix_synapse_app_service_config_files
list. Later on, when homeserver.yaml
gets generated (in setup_synapse_main.yml
), the configuration will be rebuild without the bridge's appservice being registered with Synapse.
Only once this has happened can we restart Synapse.
Still, even without starting Synapse from the uninstall flow, it's already better.
If people uninstall the bridge with --tags=setup-synapse,start
(or --tags=setup-all,start
) they will have Synapse restarted in the end.
Additional implementation pointers:
The matrix-mxisd
role does such a thing cleanly. It would be similar to what it does, but besides stopping just one service (itself), a bridge uninstall should also stop Synapse.
Here are the uninstall tasks from roles/matrix-mxisd/tasks/setup_mxisd.yml
as of right now:
#
# Tasks related to getting rid of mxisd (if it was previously enabled)
#
- name: Check existence of matrix-mxisd service
stat:
path: "/etc/systemd/system/matrix-mxisd.service"
register: matrix_mxisd_service_stat
- name: Ensure matrix-mxisd is stopped
service:
name: matrix-mxisd
state: stopped
daemon_reload: yes
register: stopping_result
when: "not matrix_mxisd_enabled and matrix_mxisd_service_stat.stat.exists"
- name: Ensure matrix-mxisd.service doesn't exist
file:
path: "/etc/systemd/system/matrix-mxisd.service"
state: absent
when: "not matrix_mxisd_enabled and matrix_mxisd_service_stat.stat.exists"
- name: Ensure systemd reloaded after matrix-mxisd.service removal
service:
daemon_reload: yes
when: "not matrix_mxisd_enabled and matrix_mxisd_service_stat.stat.exists"
- name: Ensure Matrix mxisd paths don't exist
file:
path: "{{ matrix_mxisd_base_path }}"
state: absent
when: "not matrix_mxisd_enabled"
- name: Ensure mxisd Docker image doesn't exist
docker_image:
name: "{{ matrix_mxisd_docker_image }}"
state: absent
when: "not matrix_mxisd_enabled"
If you'd like to take a stab at implementing it, let me know!
If not, I guess someone else (or me) would do it eventually.
I tried the bot and didn't like it. After setting
matrix_mautrix_whatsapp_enabled: false
and rerunning ansible, the bot stopped working, butdocker ps
still shows it as running.