AVENTER-UG / docker-matrix

docker image for matrix.org
https://riot.im/app/#/room/#dockermatrix:matrix.aventer.biz
GNU General Public License v2.0
93 stars 19 forks source link

Error on container boot #67

Open RiffyDivine opened 5 months ago

RiffyDivine commented 5 months ago

Morning, so I had some issues getting this up and running. I have fixed most of said issues but I am not sure about this one. I am not sure what the permission issue is with the turnserver or how to correct it, unless that is normal. But also the error during initialization has me stumped right now. Anyone know how to fix it or even where I should start?

Added my compose file at the end in case the error is there.

WARN[0000] /home/riffy/docker/matrix-synapse/compose.yaml: version is obsolete [+] Running 0/0 ⠋ Container matrix-synapse-docker-matrix-1 Recreated 0.1s Attaching to docker-matrix-1 docker-matrix-1 | -=> start turn docker-matrix-1 | -=> start matrix docker-matrix-1 | Cannot create pid file: /var/run/turnserver.pid: Permission denied docker-matrix-1 | This server is configured to use 'matrix.org' as its trusted key server via the docker-matrix-1 | 'trusted_key_servers' config option. 'matrix.org' is a good choice for a key docker-matrix-1 | server since it is long-lived, stable and trusted. However, some admins may docker-matrix-1 | wish to use another server for this purpose. docker-matrix-1 | docker-matrix-1 | To suppress this warning and continue using 'matrix.org', admins should set docker-matrix-1 | 'suppress_key_server_warning' to 'true' in homeserver.yaml. docker-matrix-1 | -------------------------------------------------------------------------------- docker-matrix-1 | ** docker-matrix-1 | Error during initialisation: docker-matrix-1 | Traceback (most recent call last): docker-matrix-1 | File "/matrix/venv/lib/python3.11/site-packages/synapse/app/homeserver.py", line 359, in setup docker-matrix-1 | hs.setup() docker-matrix-1 | File "/matrix/venv/lib/python3.11/site-packages/synapse/server.py", line 347, in setup docker-matrix-1 | self.datastores = Databases(self.DATASTORE_CLASS, self) docker-matrix-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ docker-matrix-1 | File "/matrix/venv/lib/python3.11/site-packages/synapse/storage/databases/init.py", line 72, in init docker-matrix-1 | with make_conn(database_config, engine, "startup") as db_conn: docker-matrix-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ docker-matrix-1 | File "/matrix/venv/lib/python3.11/site-packages/synapse/storage/database.py", line 165, in make_conn docker-matrix-1 | native_db_conn = engine.module.connect(db_params) docker-matrix-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ docker-matrix-1 | sqlite3.OperationalError: unable to open database file docker-matrix-1 |
docker-matrix-1 | There may be more information in the logs. docker-matrix-1 | ****
Gracefully stopping... (press Ctrl+C again to force) [+] Stopping 1/1 ✔ Container matrix-synapse-docker-matrix-1 Stopped 21.1s canceled

version: "3.3" services: docker-matrix: user: 991:991 ports:

andreaspeters commented 5 months ago

Hi @RiffyDivine

thanks for open an issue.

The turnserver permission denied message is not pretty but it also does not has any impact. Btw, you can disable the turnserver if you set the environment variable COTURN_ENABLE: "false".

To your database error. My first question would be, if there is a homeserver.db file in your config directory? If yes, then have a look if the permission are 991:991. If yes, then please take a look into the homeserver.yaml file and share us the database part. It should looks similarly to this one:

database:                                                                                                                                                                                                                             
   name: sqlite3                                                                                                                                                                                                                       
     args:                                                                                                                                                                                                                               
        database: /data/homeserver.db 

Thanks. :-)

RiffyDivine commented 5 months ago

Thanks, but yes I believe I need the turn server to get it all up and running for the users I got. Mostly based on any attempt to get voip/streaming working so far have failed. Chat is fine.

But for the database it says this. But looking at what you posted, does the args need to be indented more since mine is inline with name line. I will go try that just to see.

database:
  name: sqlite3
  args:
    database: /homeserver.db

Well here was the output from moving things around.

WARN[0000] /home/docker/matrix-synapse/compose.yaml: `version` is obsolete 
[+] Running 1/0
 ✔ Container matrix-synapse-docker-matrix-1  Created                                 0.0s 
Attaching to docker-matrix-1
docker-matrix-1  | -=> start turn
docker-matrix-1  | -=> start matrix
docker-matrix-1  | Cannot create pid file: /var/run/turnserver.pid: Permission denied
docker-matrix-1  | Traceback (most recent call last):
docker-matrix-1  |   File "<frozen runpy>", line 198, in _run_module_as_main
docker-matrix-1  |   File "<frozen runpy>", line 88, in _run_code
docker-matrix-1  |   File "/matrix/venv/lib/python3.11/site-packages/synapse/app/homeserver.py", line 405, in <module>
docker-matrix-1  |     main()
docker-matrix-1  |   File "/matrix/venv/lib/python3.11/site-packages/synapse/app/homeserver.py", line 395, in main
docker-matrix-1  |     hs = setup(sys.argv[1:])
docker-matrix-1  |          ^^^^^^^^^^^^^^^^^^^
docker-matrix-1  |   File "/matrix/venv/lib/python3.11/site-packages/synapse/app/homeserver.py", line 304, in setup
docker-matrix-1  |     config = HomeServerConfig.load_or_generate_config(
docker-matrix-1  |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
docker-matrix-1  |   File "/matrix/venv/lib/python3.11/site-packages/synapse/config/_base.py", line 799, in load_or_generate_config
docker-matrix-1  |     config_dict = read_config_files(config_files)
docker-matrix-1  |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
docker-matrix-1  |   File "/matrix/venv/lib/python3.11/site-packages/synapse/config/_base.py", line 882, in read_config_files
docker-matrix-1  |     yaml_config = yaml.safe_load(file_stream)
docker-matrix-1  |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
docker-matrix-1  |   File "/matrix/venv/lib/python3.11/site-packages/yaml/__init__.py", line 125, in safe_load
docker-matrix-1  |     return load(stream, SafeLoader)
docker-matrix-1  |            ^^^^^^^^^^^^^^^^^^^^^^^^
docker-matrix-1  |   File "/matrix/venv/lib/python3.11/site-packages/yaml/__init__.py", line 81, in load
docker-matrix-1  |     return loader.get_single_data()
docker-matrix-1  |            ^^^^^^^^^^^^^^^^^^^^^^^^
docker-matrix-1  |   File "/matrix/venv/lib/python3.11/site-packages/yaml/constructor.py", line 49, in get_single_data
docker-matrix-1  |     node = self.get_single_node()
docker-matrix-1  |            ^^^^^^^^^^^^^^^^^^^^^^
docker-matrix-1  |   File "/matrix/venv/lib/python3.11/site-packages/yaml/composer.py", line 36, in get_single_node
docker-matrix-1  |     document = self.compose_document()
docker-matrix-1  |                ^^^^^^^^^^^^^^^^^^^^^^^
docker-matrix-1  |   File "/matrix/venv/lib/python3.11/site-packages/yaml/composer.py", line 55, in compose_document
docker-matrix-1  |     node = self.compose_node(None, None)
docker-matrix-1  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
docker-matrix-1  |   File "/matrix/venv/lib/python3.11/site-packages/yaml/composer.py", line 84, in compose_node
docker-matrix-1  |     node = self.compose_mapping_node(anchor)
docker-matrix-1  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
docker-matrix-1  |   File "/matrix/venv/lib/python3.11/site-packages/yaml/composer.py", line 133, in compose_mapping_node
docker-matrix-1  |     item_value = self.compose_node(node, item_key)
docker-matrix-1  |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
docker-matrix-1  |   File "/matrix/venv/lib/python3.11/site-packages/yaml/composer.py", line 84, in compose_node
docker-matrix-1  |     node = self.compose_mapping_node(anchor)
docker-matrix-1  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
docker-matrix-1  |   File "/matrix/venv/lib/python3.11/site-packages/yaml/composer.py", line 127, in compose_mapping_node
docker-matrix-1  |     while not self.check_event(MappingEndEvent):
docker-matrix-1  |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
docker-matrix-1  |   File "/matrix/venv/lib/python3.11/site-packages/yaml/parser.py", line 98, in check_event
docker-matrix-1  |     self.current_event = self.state()
docker-matrix-1  |                          ^^^^^^^^^^^^
docker-matrix-1  |   File "/matrix/venv/lib/python3.11/site-packages/yaml/parser.py", line 428, in parse_block_mapping_key
docker-matrix-1  |     if self.check_token(KeyToken):
docker-matrix-1  |        ^^^^^^^^^^^^^^^^^^^^^^^^^^
docker-matrix-1  |   File "/matrix/venv/lib/python3.11/site-packages/yaml/scanner.py", line 116, in check_token
docker-matrix-1  |     self.fetch_more_tokens()
docker-matrix-1  |   File "/matrix/venv/lib/python3.11/site-packages/yaml/scanner.py", line 223, in fetch_more_tokens
docker-matrix-1  |     return self.fetch_value()
docker-matrix-1  |            ^^^^^^^^^^^^^^^^^^
docker-matrix-1  |   File "/matrix/venv/lib/python3.11/site-packages/yaml/scanner.py", line 577, in fetch_value
docker-matrix-1  |     raise ScannerError(None, None,
docker-matrix-1  | yaml.scanner.ScannerError: mapping values are not allowed here
docker-matrix-1  |   in "/data/homeserver.yaml", line 25, column 9
  Gracefully stopping... (press Ctrl+C again to force)
[+] Stopping 1/1
 ✔ Container matrix-synapse-docker-matrix-1  Stopped                                                                                21.2s 
canceled
mvgorcum commented 5 months ago

The error you posted last means that you have an issue with your homeserver.yaml file, and by your comment I think that's because you miss and extra indent before args:

That should look like:

database:
  name: sqlite3
    args:
      database: /data/homeserver.db

Second: you really should consider using postgresql for your database rather than sqlite. That's not specific to this container, but general synapse advice. See here.

Third: if you decide to keep sqlite you'll want to make sure that the homeserver.db file you define in the homeserver.yaml is in a mapped volume, such that the database file remains outside of the container, otherwise you'll lose all the data of your server when updating/recreating your container.