Jump to content

Does anyone have experience running Matrix Synapse on unraid?


relink

Recommended Posts

Posted

For those who don’t know Synapse is a federated messaging and voip platform. 

 

I am am trying to get a proper Synapse server running on my unraid box. I currently have one running but it’s not setup optimally at all. 

 

I am using This docker container. And if I leave it all default, it works but that’s far from optimal, as I’m starting to find out trying to join large rooms.

 

There are 3 things I need to get it perfect. At least the first 2 are critical. 

 

1. This container is setup to manage its setting through env variables OR a config file called homeserver.yaml

 

I need to get it able to pickup my config file, and it’s not. I set “SYNAPSE_CONFIG_PATH” as a variable and then set it to a path in my appdata folder. 

 

The reason for this is using a config file you get many more options. 

 

2. I need to get Synapse using Postgres instead of SQLite. So I installed Postgres 11 from CA. I set it up will all the default parameters from the Synapse docker so I didn’t have to do anything special...except the password of course. 

 

After getting postgres set up it dawned on me that I have no idea how to get the Synapse container talking to the Postgres container. 

 

3. Preferably I need to setup COTURN as well, however I haven’t had any issues without it yet. So I’d rather focus on the first 2 issues for now.

 

I have spent days talking with the Matrix Synapse community and unfortunately they just aren’t familiar with unraid, so are only able to offer so much. 

 

Posted

Does anyone in that community have experience running Synapse in a Docker? How do they deal with the settings you need in a Docker?
If not, does anyone in that community have experience running it in a VM?

Posted

They do, but mostly using ansible playbooks. And most people expect the Synapse server to be “the only” server on the network. They are using VPS providers mostly. Almost no one hosts at home like I am. 

 

So to them my setup is is very weird and people have trouble helping. Even though it is doable. That’s why I thought maybe you guys could help bridge the gap. 

Posted

Just to clarify I don’t need help from the ground up. I already have Synapse running on my unraid box. In fact I’ve been using it for almost a week now.

 

The problem is the couple of things I mentioned.

 

I am quickly starting to see the issue with SQLite vs Postgres I have joined some pretty big rooms through federation and MY GOD it’s slow. And everyone over there has told me it’s due to me using SQLite and that I have to switch because it will only get worse over time.

 

as for Synapse not seeing the config file...I mean that one sucks, but I could live with if I had to. But there are some additional options available through that file that I would really like to get working. Besides I have a feeling this one is probably simple and I’m just missing something. 

Posted (edited)

Not using this docker so I can't test, but this should get you setup.

3 hours ago, relink said:

1. This container is setup to manage its setting through env variables OR a config file called homeserver.yaml

I need to get it able to pickup my config file, and it’s not. I set “SYNAPSE_CONFIG_PATH” as a variable and then set it to a path in my appdata folder. 

The reason for this is using a config file you get many more options. 

Looks like you need to create an appdata config path like most dockers in unraid are setup AND create a variable with the key of SYNAPSE_CONFIG_PATH pointing to the container side path i.e. /config as the value

 

3 hours ago, relink said:

2. I need to get Synapse using Postgres instead of SQLite. So I installed Postgres 11 from CA. I set it up will all the default parameters from the Synapse docker so I didn’t have to do anything special...except the password of course. 

After getting postgres set up it dawned on me that I have no idea how to get the Synapse container talking to the Postgres container. 

If postgres is installed you need to create the synapse database user and database itself.

You will need to use the console for the docker container to complete this OR you can use the GUI tool like pgAdmin

Documentation details what needs to be done: https://github.com/matrix-org/synapse/blob/master/docs/postgres.rst

It also details porting from sqlite, but I would start clean slate.

 

Dockerhub details the container variables you need to pass for postgres, the snippet below should be enough to get the synapse talking to postgres.

https://hub.docker.com/r/matrixdotorg/synapse/

Quote

Database specific values (will use SQLite if not set):

POSTGRES_DB - The database name for the synapse postgres database. [default: synapse]

POSTGRES_HOST - The host of the postgres database if you wish to use postgresql instead of sqlite3. [default: db which is useful when using a container on the same docker network in a compose file where the postgres service is called db]

POSTGRES_PASSWORD - The password for the synapse postgres database. If this is set then postgres will be used instead of sqlite3. [default: none] NOTE: You are highly encouraged to use postgresql! Please use the compose file to make it easier to deploy.

POSTGRES_USER - The user for the synapse postgres database. [default: matrix]

 

 

Edited by tjb_altf4
Posted

Alright postgres is WORKING!!! awesome. 

 

However im still having issues with the config file now. I believe the issue is that the container is not generating the config file. I need to pass the following command to the container;

```

--generate-config -H domain.tld -c /data/homeserver.yaml

```

How do I do that? Just typing it into the console isn't working. 

  • 1 month later...
  • 2 weeks later...
Posted

I have also been trying to get synpase to work on my unraid box (still running 6.6.7).

I installed Postres without a problem.

I'm having a similar issues as you relink with the synpase docker.

I downloaded a clean homeserver.yaml from https://raw.githubusercontent.com/matrix-org/synapse/master/docker/conf/homeserver.yaml

 

When i start Synpase, it immediately crashes. I joined a screenshot of my container template and here is the console log for the synapse container:

Traceback (most recent call last):
File "/usr/local/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/local/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.6/site-packages/synapse/app/homeserver.py", line 661, in <module>
main()
File "/usr/local/lib/python3.6/site-packages/synapse/app/homeserver.py", line 656, in main
hs = setup(sys.argv[1:])
File "/usr/local/lib/python3.6/site-packages/synapse/app/homeserver.py", line 329, in setup
config_options,
File "/usr/local/lib/python3.6/site-packages/synapse/config/_base.py", line 362, in load_or_generate_config
generate_keys=generate_keys,
File "/usr/local/lib/python3.6/site-packages/synapse/config/_base.py", line 380, in read_config_files
yaml_config = self.read_config_file(config_file)
File "/usr/local/lib/python3.6/site-packages/synapse/config/_base.py", line 140, in read_config_file
return yaml.safe_load(file_stream)
File "/usr/local/lib/python3.6/site-packages/yaml/__init__.py", line 162, in safe_load
return load(stream, SafeLoader)
File "/usr/local/lib/python3.6/site-packages/yaml/__init__.py", line 114, in load
return loader.get_single_data()
File "/usr/local/lib/python3.6/site-packages/yaml/constructor.py", line 41, in get_single_data
node = self.get_single_node()
File "/usr/local/lib/python3.6/site-packages/yaml/composer.py", line 35, in get_single_node
if not self.check_event(StreamEndEvent):
File "/usr/local/lib/python3.6/site-packages/yaml/parser.py", line 98, in check_event
self.current_event = self.state()
File "/usr/local/lib/python3.6/site-packages/yaml/parser.py", line 143, in parse_implicit_document_start
StreamEndToken):
File "/usr/local/lib/python3.6/site-packages/yaml/scanner.py", line 116, in check_token
self.fetch_more_tokens()
File "/usr/local/lib/python3.6/site-packages/yaml/scanner.py", line 260, in fetch_more_tokens
self.get_mark())
yaml.scanner.ScannerError: while scanning for the next token
found character '%' that cannot start any token
in "/config/homeserver.yaml", line 5, column 2
Traceback (most recent call last):
File "/start.py", line 76, in <module>
subprocess.check_output(args + ["--generate-keys"])
File "/usr/local/lib/python3.6/subprocess.py", line 356, in check_output
**kwargs).stdout
File "/usr/local/lib/python3.6/subprocess.py", line 438, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['python', '-m', 'synapse.app.homeserver', '--config-path', '/config/', '--keys-directory', '/data', '--generate-keys']' returned non-zero exit status 1.

 

Would really appreciate any tip as to how to setup synapse.

One part of it is setting up my let's encrypt reverse proxy to work with it.

 

On 3/6/2019 at 12:44 PM, relink said:

Alright postgres is WORKING!!! awesome. 

 

However im still having issues with the config file now. I believe the issue is that the container is not generating the config file. I need to pass the following command to the container;

```

--generate-config -H domain.tld -c /data/homeserver.yaml 

``` 

How do I do that? Just typing it into the console isn't working. 

To answer your question, afaik you just paste your command in the "Post Arguments" section of the container template (in advanced view).

 

Capture.PNG

  • 4 weeks later...
Posted

Have any of you made any progress on this? I've been trying to do the same thing basically, but was running into many of the same problems listed above and then found this thread. Any ideas?

  • 4 months later...
  • 1 month later...
Posted
5 hours ago, saudotb said:

Did you find a solution for your problem with the '%' character?
I have been stuck for like a week now, would really appreciate the help.

You might want to tag the person you're asking or quote their message. 

  • 4 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...