mirror of
https://github.com/spantaleev/matrix-docker-ansible-deploy.git
synced 2025-08-08 16:01:32 +02:00
.github
docs
examples
group_vars
inventory
roles
matrix-aux
matrix-awx
matrix-base
matrix-bot-go-neb
matrix-bot-matrix-reminder-bot
matrix-bot-mjolnir
matrix-bridge-appservice-discord
matrix-bridge-appservice-irc
matrix-bridge-appservice-slack
matrix-bridge-appservice-webhooks
matrix-bridge-beeper-linkedin
matrix-bridge-heisenbridge
matrix-bridge-mautrix-facebook
matrix-bridge-mautrix-googlechat
matrix-bridge-mautrix-hangouts
matrix-bridge-mautrix-instagram
matrix-bridge-mautrix-signal
matrix-bridge-mautrix-telegram
matrix-bridge-mautrix-whatsapp
matrix-bridge-mx-puppet-discord
matrix-bridge-mx-puppet-groupme
matrix-bridge-mx-puppet-instagram
matrix-bridge-mx-puppet-skype
matrix-bridge-mx-puppet-slack
matrix-bridge-mx-puppet-steam
matrix-bridge-mx-puppet-twitter
matrix-bridge-sms
matrix-client-element
matrix-client-hydrogen
matrix-common-after
matrix-corporal
matrix-coturn
matrix-dendrite
matrix-dimension
matrix-dynamic-dns
matrix-email2matrix
matrix-etherpad
matrix-grafana
matrix-jitsi
matrix-ma1sd
matrix-mailer
matrix-nginx-proxy
matrix-postgres
defaults
tasks
util
import_generic_sqlite_db.yml
import_postgres.yml
import_synapse_sqlite_db.yml
init.yml
main.yml
migrate_postgres_data_directory.yml
run_vacuum.yml
setup_postgres.yml
upgrade_postgres.yml
validate_config.yml
templates
matrix-postgres-backup
matrix-prometheus
matrix-prometheus-node-exporter
matrix-prometheus-postgres-exporter
matrix-redis
matrix-registration
matrix-sygnal
matrix-synapse
matrix-synapse-admin
.editorconfig
.gitignore
CHANGELOG.md
LICENSE
README.md
ansible.cfg
setup.yml
72 lines
2.8 KiB
YAML
72 lines
2.8 KiB
YAML
---
|
|
|
|
# We used to store Postgres data directly under `/matrix/postgres` (what is now considered `matrix_postgres_base_path`).
|
|
#
|
|
# From now on, we expect to store Postgres data one directory below now (`/matrix/postgres/data` - `matrix_postgres_data_path`).
|
|
# We wish to use the base directory for other purposes (storing environment variable files, etc.).
|
|
# Mixing those with the Postgres data is no good and it leads to Postgres's `initdb` complaining to initialize
|
|
# a database in a non-empty directory.
|
|
#
|
|
# For this reason, we store the Postgres data in `/matrix/postgres/data` and need to relocate any installations
|
|
# which still store it in the parent directory (`/matrix/postgres`).
|
|
|
|
- name: Check if old Postgres data directory is used
|
|
stat:
|
|
path: "{{ matrix_postgres_base_path }}/PG_VERSION"
|
|
register: result_pg_old_data_dir_stat
|
|
|
|
- name: Warn if old Postgres data directory detected
|
|
debug:
|
|
msg: >
|
|
Found that you have Postgres data in `{{ matrix_postgres_base_path }}`.
|
|
From now on, Postgres data is supposed to be stored in `{{ matrix_postgres_data_path }}` instead.
|
|
We'll stop Postgres and relocate the files there for you.
|
|
when: "result_pg_old_data_dir_stat.stat.exists"
|
|
|
|
# We should stop Postgres first, before building a list of files,
|
|
# as to ignore any `postmaster.pid` files, etc.
|
|
- name: Ensure matrix-postgres is stopped
|
|
service:
|
|
name: matrix-postgres
|
|
state: stopped
|
|
daemon_reload: yes
|
|
when: "result_pg_old_data_dir_stat.stat.exists"
|
|
|
|
- name: Find files and directories in old Postgres data path
|
|
find:
|
|
paths: "{{ matrix_postgres_base_path }}"
|
|
file_type: any
|
|
excludes: ["data"]
|
|
register: "result_pg_old_data_dir_find"
|
|
when: "result_pg_old_data_dir_stat.stat.exists"
|
|
|
|
- name: Ensure new Postgres data path exists
|
|
file:
|
|
path: "{{ matrix_postgres_data_path }}"
|
|
state: directory
|
|
mode: 0700
|
|
owner: "{{ matrix_user_username }}"
|
|
group: "{{ matrix_user_groupname }}"
|
|
when: "result_pg_old_data_dir_stat.stat.exists"
|
|
|
|
- block:
|
|
- name: Relocate Postgres data files from old directory to new
|
|
command: "mv {{ item.path }} {{ matrix_postgres_data_path }}/{{ item.path|basename }}"
|
|
with_items: "{{ result_pg_old_data_dir_find.files }}"
|
|
when: "result_pg_old_data_dir_stat.stat.exists"
|
|
|
|
# Intentionally not starting matrix-postgres here.
|
|
# It likely needs to be updated to point to the new directory.
|
|
# In fact, let's even get rid of the outdated service, to ensure no one will start it
|
|
# and have it initialize a new database.
|
|
|
|
- name: Ensure outdated matrix-postgres.service doesn't exist
|
|
file:
|
|
path: "{{ matrix_systemd_path }}/matrix-postgres.service"
|
|
state: absent
|
|
when: "result_pg_old_data_dir_stat.stat.exists"
|
|
|
|
- name: Ensure systemd reloaded after getting rid of outdated matrix-postgres.service
|
|
service:
|
|
daemon_reload: yes
|
|
when: "result_pg_old_data_dir_stat.stat.exists" |