From 31bbe9a45701ed26f00604a44629d455b7818130 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Tue, 19 Dec 2023 10:00:16 +0100 Subject: [PATCH] Implemented postgres support --- .../templates/docker-compose.yml.j2 | 25 +++++++++---------- .../templates/homeserver.yaml.j2 | 2 +- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/roles/docker-matrix/templates/docker-compose.yml.j2 b/roles/docker-matrix/templates/docker-compose.yml.j2 index 7ddf0468..1dd9c749 100644 --- a/roles/docker-matrix/templates/docker-compose.yml.j2 +++ b/roles/docker-matrix/templates/docker-compose.yml.j2 @@ -21,21 +21,20 @@ services: database: logging: driver: journald - image: mariadb - restart: always - environment: - MYSQL_DATABASE: "matrix" - MYSQL_USER: "matrix" - MYSQL_PASSWORD: "{{matrix_database_password}}" - MYSQL_ROOT_PASSWORD: "{{matrix_database_password}}" - MARIADB_AUTO_UPGRADE: "1" + image: postgres:16 + restart: unless-stopped volumes: - - database:/var/lib/mysql + - database:/var/lib/postgresql/data + environment: + - POSTGRES_DB=matrix + - POSTGRES_USER=matrix + - POSTGRES_PASSWORD={{matrix_database_password}} + - POSTGRES_INITDB_ARGS=--encoding=UTF8 --locale=C healthcheck: - test: "/usr/bin/mariadb --user=matrix --password={{matrix_database_password}} --execute \"SHOW DATABASES;\"" - interval: 3s - timeout: 1s - retries: 5 + test: ["CMD-SHELL", "pg_isready -U matrix"] + interval: 10s + timeout: 5s + retries: 6 # bridges #mautrix-telegram: diff --git a/roles/docker-matrix/templates/homeserver.yaml.j2 b/roles/docker-matrix/templates/homeserver.yaml.j2 index 61fb3cb2..3c95afd4 100644 --- a/roles/docker-matrix/templates/homeserver.yaml.j2 +++ b/roles/docker-matrix/templates/homeserver.yaml.j2 @@ -9,7 +9,7 @@ listeners: - names: [client, federation] compress: false database: - name: mysql + name: psycopg2 args: user: matrix password: {{matrix_database_password}}