From e417ac4922131910816adfa151068dd4d4174aa1 Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Thu, 1 Nov 2018 09:48:20 +0200 Subject: [PATCH] Add support for Postgres 11 --- CHANGELOG.md | 8 ++++++++ roles/matrix-server/defaults/main.yml | 3 ++- roles/matrix-server/tasks/setup/setup_postgres.yml | 5 +++++ roles/matrix-server/tasks/upgrade_postgres.yml | 10 +++++++++- 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 59a6c5bdc..352ec47c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # 2018-11-01 +## Postgres 11 support + +The playbook now installs [Postgres 11](https://www.postgresql.org/about/news/1894/) by default. + +If you have have an existing setup, it's likely running on an older Postgres version (9.x or 10.x). You can easily upgrade by following the [Maintenance / upgrading PostgreSQL](docs/maintenance-upgrading-postgres.md) guide. + + ## (BC Break) Renaming playbook variables Due to the large amount of features added to this playbook lately, to keep things manageable we've had to reorganize its configuration variables a bit. @@ -19,6 +26,7 @@ The following playbook variables were renamed: - from `matrix_docker_image_postgres_v10` to `matrix_postgres_docker_image_v10` - from `matrix_docker_image_postgres_latest` to `matrix_postgres_docker_image_latest` + # 2018-10-26 ## Mautrix Whatsapp bridging support diff --git a/roles/matrix-server/defaults/main.yml b/roles/matrix-server/defaults/main.yml index ca8dbd9a4..44a4276f3 100644 --- a/roles/matrix-server/defaults/main.yml +++ b/roles/matrix-server/defaults/main.yml @@ -146,7 +146,8 @@ matrix_postgres_data_path: "{{ matrix_base_data_path }}/postgres" matrix_postgres_docker_image_v9: "postgres:9.6.10-alpine" matrix_postgres_docker_image_v10: "postgres:10.5-alpine" -matrix_postgres_docker_image_latest: "{{ matrix_postgres_docker_image_v10 }}" +matrix_postgres_docker_image_v11: "postgres:11.0-alpine" +matrix_postgres_docker_image_latest: "{{ matrix_postgres_docker_image_v11 }}" matrix_coturn_docker_image: "instrumentisto/coturn:4.5.0.8" diff --git a/roles/matrix-server/tasks/setup/setup_postgres.yml b/roles/matrix-server/tasks/setup/setup_postgres.yml index d2666bf51..bbaebad79 100644 --- a/roles/matrix-server/tasks/setup/setup_postgres.yml +++ b/roles/matrix-server/tasks/setup/setup_postgres.yml @@ -33,6 +33,11 @@ matrix_postgres_docker_image_to_use: "{{ matrix_postgres_docker_image_v9 }}" when: "pg_version.startswith('9.')" +- name: Determine Postgres version to use (use 10.x, if detected) + set_fact: + matrix_postgres_docker_image_to_use: "{{ matrix_postgres_docker_image_v10 }}" + when: "pg_version == '10' or pg_version.startswith('10.')" + - debug: msg: "NOTE: Your setup is on an old Postgres version ({{ matrix_postgres_docker_image_to_use }}), while {{ matrix_postgres_docker_image_latest }} is supported. You can upgrade using --tags=upgrade-postgres" when: "matrix_postgres_docker_image_to_use != matrix_postgres_docker_image_latest" diff --git a/roles/matrix-server/tasks/upgrade_postgres.yml b/roles/matrix-server/tasks/upgrade_postgres.yml index 0b1d262b0..822bd428f 100644 --- a/roles/matrix-server/tasks/upgrade_postgres.yml +++ b/roles/matrix-server/tasks/upgrade_postgres.yml @@ -60,10 +60,18 @@ matrix_postgres_docker_image_to_use: "{{ matrix_postgres_docker_image_v9 }}" when: "pg_version.startswith('9.')" +- name: Determine Postgres version to use (use 10.x, if detected) + set_fact: + matrix_postgres_docker_image_to_use: "{{ matrix_postgres_docker_image_v10 }}" + when: "pg_version == '10' or pg_version.startswith('10.')" + - name: Abort, if already at latest Postgres version - fail: msg="You are already running the latest Postgres version supported. Nothing to do" + fail: msg="You are already running the latest Postgres version supported ({{ matrix_postgres_docker_image_latest }}). Nothing to do" when: "matrix_postgres_docker_image_to_use == matrix_postgres_docker_image_latest" +- debug: + msg: "Upgrading database from {{ matrix_postgres_docker_image_to_use }} to {{ matrix_postgres_docker_image_latest }}" + - name: Ensure matrix-synapse is stopped service: name=matrix-synapse state=stopped