Matrix-Synapse does not start

Since Truenas did NOT support matrix as a native app as of yet, I attempted to go with this solution.

I also wanted to make sure I could touch the files, so I mounted all the volumes on directories in my smb share: /mnt/poolname/smbsharename (ofc this isn’t how it’s really named. will not disclose for privacy reasons)

I also used my personal domain: domain.com (not how my domain is named either. will not disclose for privacy reasons)

Docker-compose script

version: '3'

services:

# Synapse host for your Matrix instance
  synapse:
    image: matrixdotorg/synapse:latest
    restart: always
    volumes:
      - /mnt/poolname/smbsharename/Docker/synapse/files/data:/data
      - /mnt/poolname/smbsharename/Docker/synapse/files/homeserver.yaml:/data/homeserver.yaml
      - /mnt/poolname/smbsharename/Docker/synapse/files/secrets/:/synapse-secrets/
      - /mnt/poolname/smbsharename/Docker/synapse/files/letsencrypt:/etc/letsencrypt
      - /mnt/poolname/smbsharename/Docker/synapse/files/nginx-proxy-manager/.well-known/matrix:/var/www/matrix.white.fm/.well-known/matrix
    environment:
      - SYNAPSE_SERVER_NAME=domain.com
      - SYNAPSE_REPORT_STATS=yes
      - SYNAPSE_NO_TLS=true
      - SYNAPSE_DB_HOST=postgres
      - SYNAPSE_DB_NAME=synapse
      - SYNAPSE_DB_USER=synapse_user
      - SYNAPSE_DB_PASSWORD=16digitpasswords
      - SYNAPSE_ADMIN_USER=admin
      - SYNAPSE_ADMIN_PASS=$$(cat /synapse-secrets/matrix_admin_pass.txt)
    ports:
      - "8008:8008"
      - "8448:8448"
    labels:
      - 'nginx.enable=true'
      - 'nginx.http.routers.matrix.rule=Host(`domain.com`)'
      - 'nginx.http.routers.matrix.tls=true'
      - 'nginx.http.services.matrix.loadbalancer.server.port=8008'
 
# Postgres DB host for your Matrix instance
  postgres:
    image: postgres
    restart: always
    environment:
      POSTGRES_PASSWORD: 16digitpasswords
      POSTGRES_USER: synapse_user
      POSTGRES_DB: synapse
      POSTGRES_INITDB_ARGS: "--encoding=UTF8 --lc-collate=C --lc-ctype=C"
    volumes:
      -  /mnt/poolname/smbsharename/Docker/synapse/files/secrets/postgresmatrix:/var/lib/postgresql/data
      
 # Redis host for your Matrix instance
  redis:
    image: redis
    container_name: redis
    restart: always

# Nginx Proxy Manager
#  app:
#    image: 'jc21/nginx-proxy-manager:latest'
#    restart: unless-stopped
#    ports:
#      - '80:80'
#      - '81:81'
#      - '443:443'
#    environment:
#      DB_MYSQL_HOST: "db"
#      DB_MYSQL_PORT: 3306
#      DB_MYSQL_USER: "npm"
#      DB_MYSQL_PASSWORD: "npm"
#      DB_MYSQL_NAME: "npm"
#    volumes:
#      - ./data:/data
#      - ./letsencrypt:/etc/letsencrypt
#      - ./nginx-proxy-manager/.well-known/matrix:/var/www/matrix.white.fm/.well-known/matrix
      
 # the database for your NPM instance
# db:
#    image: 'jc21/mariadb-aria:latest'
#    restart: unless-stopped
#    environment:
#      MYSQL_ROOT_PASSWORD: 'npm'
#      MYSQL_DATABASE: 'npm'
#      MYSQL_USER: 'npm'
#      MYSQL_PASSWORD: 'npm'
#    volumes:
#      - ./data/mysql:/var/lib/mysql

# The chat interface for your Matrix instance
  element:
    image: vectorim/element-web:latest
    restart: unless-stopped
    volumes:
      - /mnt/poolname/smbsharename/Docker/synapse/files/element-config.json:/app/config.json
    ports:
      - "8080:80"

# Maubot (https://github.com/maubot/maubot)
#  maubot:
#      image: 'dock.mau.dev/maubot/maubot:latest'
#      restart: unless-stopped
#      ports:
#          - '29316:29316'
#      volumes:
#          - './maubot:/data:z'
          
# This container is the database for Maubot          
#  postgres-maubot:
#    image: 'postgres:latest'
#    ports:
#      - 5432:5432
#    environment:
#      POSTGRES_USER: postgres # The PostgreSQL user (useful to connect to the database)
#      POSTGRES_PASSWORD: KMeEqPH4rLvHeel9 # The PostgreSQL password (useful to connect to the database)
#      POSTGRES_DB: postgres # The PostgreSQL default database (automatically created at first launch)         
# 
 # Use this container as an SMTP relay routing through Google yes
  postfix:
  # follow the instructions for using Google's SMTP relay here: https://apps.google.com/supportwidget/articlehome?hl=en&article_url=https%3A%2F%2Fsupport.google.com%2Fa%2Fanswer%2F2956491%3Fhl%3Den&assistant_id=generic-unu&product_context=2956491&product_name=UnuFlow&trigger_context=a
    image: juanluisbaptiste/postfix:alpine
    container_name: postfix
    restart: unless-stopped
    expose:
      - 25
    environment:
      SMTP_SERVER: smtp-relay.gmail.com
      SMTP_PORT: 587
      SMTP_USERNAME: randomusername@domain.com
      SMTP_PASSWORD: other16digitpasswords
      SERVER_HOSTNAME: domain.com

#Use this container as a webhook relay to send encrypted webhook messages to your server
#  webhooks:
#    depends_on:
#      - synapse
#    environment:
#      ALLOW_UNICODE: 'True'
#      DISPLAY_APP_NAME: 'True'
#      KNOWN_TOKENS: 'EXAMPLETOKEN,!roomID:YOURSERVERNAME.COM,NetworkNotifications'
#      MATRIX_ADMIN_ROOM: '!adminRoomID:YOURSERVERNAME.COM'
#      MATRIX_DEVICE:  matrix-ubuntu-docker
#      MATRIX_PASSWORD: 'YOURSUPERSECRETPASSWORD'
#      MATRIX_SERVER: https://matrix.YOURDOMAIN.COM
#      MATRIX_SSLVERIFY: 'True'
#      MATRIX_USERID: '@webhooks:YOURDOMAIN.COM'
#      MESSAGE_FORMAT: yaml
#      USE_MARKDOWN: 'True'
#    image: jceloria/matrix-encrypted-webhooks:latest
#    ports:
#      - 8000:8000
#    restart: unless-stopped
#    volumes:
#      - /opt/data/matrix/webhooks/config:/webhooks-config

The guide also mentioned that I should download and edit these other files in the github .

So I edited the homserver.yaml, element-config.json, and the files in the secrets folder, then put them in the directories listed above in the volumes for my synapse install.

edited parts of the homeserver.yaml script

# This homeserver.yaml works in my environment with Docker Compose, but you may need to make adjustments for your particular environmnet.

modules:
server_name: "domain.com"
web_client_location: https://element.domain.com/
public_baseurl: https://matrix.domain.com/

edited parts of the element-config.json script

{
    "default_server_config": {
        "m.homeserver": {
            "base_url": "https://element.domain.com",
            "server_name": "domain.com"

synapse_secrets.env

SYNAPSE_SERVER_NAME=domain.com
SYNAPSE_REPORT_STATS=yes
SYNAPSE_ADMIN_USER=admin
SYNAPSE_ADMIN_PASS=$$(cat /secrets/matrix_admin_pass.txt)

matrix_admin_pass.txt

complicated16digitpassword

When I tried to run it, redis, element, and postfix ran with no problems. However, both the postgres and synapse would not start. Am I missing something here?

has anyone gotten matrix to run on their system at all?

Try searching ‘postgres’ on the forums to see if the recent posts helps on that.

1 Like

they all seem to be the native postgres app. I’m almost certain there’s something I have missing in the script but I can’t find it.

no, it’s not postgres either probably. the other native apps seem to work JUST FINE with postgres being exited after they start. so synapse seems to just be the problem.

It may take a day or so to get any replies. Thanksgiving Holiday in the US. Forums seem slow.

1 Like

No worries. I also found out on my own that synapse has no permissions on the homeserver.yaml that I gave it. That seems to be the issue as well.

ok, I just decided to get rid of all the perms problems straight away and installed dockge. dockge made the directories and handled all perms on its own. HOWEVER, PermissionError: [Errno 13] Permission denied: '/data/domain.com.signing.key' is an error that I am getting even still.

The first problem is that synapse has to configure the homeserver.yaml file itself.