From ccc7aaf0ce47262bebef9cfe565c8df5f4fd7ff3 Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Wed, 6 May 2020 09:55:40 +0300 Subject: [PATCH] Fix "Migrating to a new server" flow due to dynamic user/group creation --- docs/maintenance-migrating.md | 6 ++++-- roles/matrix-base/tasks/main.yml | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/maintenance-migrating.md b/docs/maintenance-migrating.md index fcfe4e163..71a38e583 100644 --- a/docs/maintenance-migrating.md +++ b/docs/maintenance-migrating.md @@ -1,8 +1,10 @@ # Migrating to new server 1. Prepare by lowering DNS TTL for your domains (`matrix.DOMAIN`, etc.), so that DNS record changes (step 4 below) would happen faster, leading ot less downtime -2. Stop all services on the old server and make sure they won't be starting again. Execute this on the old server: `systemctl disable --now matrix*` +2. Stop all services on the old server and make sure they won't be starting again. Execute this on the old server: `systemctl disable --now matrix*` 3. Copy directory `/matrix` from the old server to the new server. Make sure to preserve ownership and permissions (use `cp -p` or `rsync -ar`)! 4. Make sure your DNS records are adjusted to point to the new server's IP address 5. Remove old server from the `inventory/hosts` file and add new server. -6. Run `ansible-playbook -i inventory/hosts setup.yml --tags=setup-all,start`. This will create the matrix user and group and start all services on the new server +6. Run `ansible-playbook -i inventory/hosts setup.yml --tags=setup-system-user`. This will create the `matrix` user and group on the new server +7. Because the `matrix` user and group are created dynamically on each server, the user/group id may differ between the old and new server. We suggest that you adjust ownership of `/matrix` files manually by running this on the new server: `chown -R matrix:matrix /matrix`. +8. Run `ansible-playbook -i inventory/hosts setup.yml --tags=setup-all,start` to finish the installation and start all services diff --git a/roles/matrix-base/tasks/main.yml b/roles/matrix-base/tasks/main.yml index c51d6811a..a1bb6754b 100644 --- a/roles/matrix-base/tasks/main.yml +++ b/roles/matrix-base/tasks/main.yml @@ -18,6 +18,7 @@ when: run_setup|bool tags: - always + - setup-system-user - import_tasks: "{{ role_path }}/tasks/setup_matrix_base.yml" when: run_setup|bool