Переглянути джерело

Reuse environment variables of the postgres container

kaiyou 6 роки тому
батько
коміт
a207cccb05

+ 6 - 6
contrib/docker/conf/homeserver.yaml

@@ -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 %}

+ 8 - 3
contrib/docker/docker-compose.yml

@@ -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