mirror of
https://github.com/spantaleev/matrix-docker-ansible-deploy.git
synced 2024-12-24 18:08:28 +01:00
Use Postgres 10.x by default (only for new installs)
This playbook just tries to avoid trying to setup a Postgres 10 database with existing 9.x files, as that makes Postgres complain. Due to this, existing installs (still on 9.x) are detected and left on Postgres 9.x. They need to be upgraded to Postgres 10.x manually.
This commit is contained in:
parent
f1b4730e82
commit
cbee084ac1
@ -40,7 +40,11 @@ matrix_coturn_base_path: "{{ matrix_base_data_path }}/coturn"
|
||||
matrix_coturn_config_path: "{{ matrix_coturn_base_path }}/turnserver.conf"
|
||||
matrix_scratchpad_dir: "{{ matrix_base_data_path }}/scratchpad"
|
||||
|
||||
docker_postgres_image: "postgres:9.6.8-alpine"
|
||||
|
||||
docker_postgres_image_v9: "postgres:9.6.8-alpine"
|
||||
docker_postgres_image_v10: "postgres:10.4-alpine"
|
||||
docker_postgres_image_latest: "{{ docker_postgres_image_v10 }}"
|
||||
|
||||
docker_matrix_image: "matrixdotorg/synapse:v0.30.0"
|
||||
docker_nginx_image: "nginx:1.13.12-alpine"
|
||||
docker_riot_image: "avhost/docker-matrix-riot:v0.15.4"
|
||||
@ -48,6 +52,7 @@ docker_s3fs_image: "xueshanf/s3fs:latest"
|
||||
docker_goofys_image: "cloudproto/goofys:latest"
|
||||
docker_coturn_image: "instrumentisto/coturn:4.5.0.7"
|
||||
|
||||
|
||||
# To avoid Synapse's macaroon secret key from changing every time
|
||||
# a new config is built from scratch, you can specify one here.
|
||||
matrix_synapse_macaroon_secret_key: null
|
||||
|
@ -4,10 +4,39 @@
|
||||
# Generic tasks, no matter what kind of server we're using (internal/external)
|
||||
#
|
||||
|
||||
- name: Determine existing Postgres version (check PG_VERSION file)
|
||||
stat:
|
||||
path: "{{ matrix_postgres_data_path }}/PG_VERSION"
|
||||
register: result_pg_version_stat
|
||||
|
||||
- name: Determine existing Postgres version (read PG_VERSION file)
|
||||
slurp:
|
||||
src: "{{ matrix_postgres_data_path }}/PG_VERSION"
|
||||
register: result_pg_version
|
||||
when: "result_pg_version_stat.stat.exists"
|
||||
|
||||
- name: Determine existing Postgres version (default to empty)
|
||||
set_fact:
|
||||
pg_version: ""
|
||||
|
||||
- name: Determine existing Postgres version (make sense of PG_VERSION file)
|
||||
set_fact:
|
||||
pg_version: "{{ result_pg_version['content']|b64decode|replace('\n', '') }}"
|
||||
when: "result_pg_version_stat.stat.exists"
|
||||
|
||||
- name: Determine Postgres version to use (default to latest)
|
||||
set_fact:
|
||||
docker_postgres_image_to_use: "{{ docker_postgres_image_latest }}"
|
||||
|
||||
- name: Determine Postgres version to use (use 9.x, if detected)
|
||||
set_fact:
|
||||
docker_postgres_image_to_use: "{{ docker_postgres_image_v9 }}"
|
||||
when: "pg_version.startswith('9.')"
|
||||
|
||||
# Even if we don't run the internal server, we still need this for running the CLI
|
||||
- name: Ensure postgres Docker image is pulled
|
||||
docker_image:
|
||||
name: "{{ docker_postgres_image }}"
|
||||
name: "{{ docker_postgres_image_to_use }}"
|
||||
|
||||
- name: Ensure Postgres environment variables file created
|
||||
template:
|
||||
|
@ -14,7 +14,7 @@ ExecStart=/usr/bin/docker run --rm --name matrix-postgres \
|
||||
--env-file={{ matrix_environment_variables_data_path }}/env-postgres-server-docker \
|
||||
-v {{ matrix_postgres_data_path }}:/var/lib/postgresql/data \
|
||||
-v /etc/passwd:/etc/passwd:ro \
|
||||
{{ docker_postgres_image }}
|
||||
{{ docker_postgres_image_to_use }}
|
||||
ExecStop=-/usr/bin/docker stop matrix-postgres
|
||||
ExecStop=-/usr/bin/docker rm matrix-postgres
|
||||
Restart=always
|
||||
|
@ -7,5 +7,5 @@ docker run \
|
||||
{% if not matrix_postgres_use_external %}
|
||||
--link=matrix-postgres:{{ matrix_postgres_connection_hostname }} \
|
||||
{% endif %}
|
||||
{{ docker_postgres_image }} \
|
||||
{{ docker_postgres_image_to_use }} \
|
||||
psql -h {{ matrix_postgres_connection_hostname }}
|
Loading…
Reference in New Issue
Block a user