Reuse environment variables of the postgres container

This commit is contained in:
kaiyou 2018-02-04 15:04:26 +01:00
parent 1ba2fe114c
commit a207cccb05
2 changed files with 14 additions and 9 deletions

View file

@ -46,15 +46,15 @@ listeners:
## Database ##
{% if SYNAPSE_DB_PASSWORD %}
{% if POSTGRES_PASSWORD %}
database:
name: "psycopg2"
args:
user: "{{ SYNAPSE_DB_USER or "matrix" }}"
password: "{{ SYNAPSE_DB_PASSWORD }}"
database: "{{ SYNAPSE_DB_DATABASE or "matrix" }}"
host: "{{ SYNAPSE_DB_HOST or "db" }}"
port: "{{ SYNAPSE_DB_PORT or "5432" }}"
user: "{{ POSTGRES_USER or "matrix" }}"
password: "{{ POSTGRES_PASSWORD }}"
database: "{{ POSTGRES_DB or "matrix" }}"
host: "{{ POSTGRES_HOST or "db" }}"
port: "{{ POSTGRES_PORT or "5432" }}"
cp_min: 5
cp_max: 10
{% else %}

View file

@ -6,13 +6,18 @@ version: '3'
services:
synapse:
image: matrix/synapse
image: synapse
# Since snyapse does not retry to connect to the database, restart upon
# failure
restart: unless-stopped
# See the readme for a full documentation of the environment settings
environment:
- SYNAPSE_SERVER_NAME=my.matrix.host
- SYNAPSE_DB_PASSWORD=changeme
- SYNAPSE_ENABLE_REGISTRATION=yes
volumes:
- ./files:/data
depends_on:
- db
# One may either expose ports directly
ports:
- 8448:8448/tcp
@ -29,4 +34,4 @@ services:
- POSTGRES_USER=matrix
- POSTGRES_PASSWORD=changeme
volumes:
- ./schemas:/var/lib/postgres
- ./schemas:/var/lib/postgresql/data