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 ## ## Database ##
{% if SYNAPSE_DB_PASSWORD %} {% if POSTGRES_PASSWORD %}
database: database:
name: "psycopg2" name: "psycopg2"
args: args:
user: "{{ SYNAPSE_DB_USER or "matrix" }}" user: "{{ POSTGRES_USER or "matrix" }}"
password: "{{ SYNAPSE_DB_PASSWORD }}" password: "{{ POSTGRES_PASSWORD }}"
database: "{{ SYNAPSE_DB_DATABASE or "matrix" }}" database: "{{ POSTGRES_DB or "matrix" }}"
host: "{{ SYNAPSE_DB_HOST or "db" }}" host: "{{ POSTGRES_HOST or "db" }}"
port: "{{ SYNAPSE_DB_PORT or "5432" }}" port: "{{ POSTGRES_PORT or "5432" }}"
cp_min: 5 cp_min: 5
cp_max: 10 cp_max: 10
{% else %} {% else %}

View File

@ -6,13 +6,18 @@ version: '3'
services: services:
synapse: 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 # See the readme for a full documentation of the environment settings
environment: environment:
- SYNAPSE_SERVER_NAME=my.matrix.host - SYNAPSE_SERVER_NAME=my.matrix.host
- SYNAPSE_DB_PASSWORD=changeme - SYNAPSE_ENABLE_REGISTRATION=yes
volumes: volumes:
- ./files:/data - ./files:/data
depends_on:
- db
# One may either expose ports directly # One may either expose ports directly
ports: ports:
- 8448:8448/tcp - 8448:8448/tcp
@ -29,4 +34,4 @@ services:
- POSTGRES_USER=matrix - POSTGRES_USER=matrix
- POSTGRES_PASSWORD=changeme - POSTGRES_PASSWORD=changeme
volumes: volumes:
- ./schemas:/var/lib/postgres - ./schemas:/var/lib/postgresql/data