element-hq / element-hq/synapse
Unable to automatically create media storage path in docker volume
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 600
- Avg merge
- 5d 22h
- Merged PRs (30d)
- 51
Description
### Description
When using a named volume to store the `/data` folder, with the `media_store_path` set inside that volume at `/data/media_store`, synapse failed to launch because it was unable to create that directory; I had to manually create it as root.
### Steps to reproduce
- have a `named volume` mounted into the container at `/data`
- set `media_store_path` to a location inside that volume
### Homeserver
another homeserver
### Synapse Version
1.132.0
### Installation Method
Docker (matrixdotorg/synapse)
### Database
N/A
### Workers
Single process
### Platform
Ubuntu server 24.04.2 LTS
Docker Engine (CE) 28.2.2
### Configuration
### `docker-compose.yml`:
```yml
services:
synapse:
image: ghcr.io/element-hq/synapse
# ...
volumes:
- synapse_data:/config
volumes:
synapse_data: {}
```
---
### `homeserver.yaml`:
```yml
media_store_path: /data/media_store
```
### Relevant log output
```shell
Starting synapse with args -m synapse.app.homeserver --config-path /config/homeserver.yaml
Traceback (most recent call last):
File "", line 198, in _run_module_as_main
File "", line 88, in _run_code
File "/usr/local/lib/python3.12/site-packages/synapse/app/homeserver.py", line 421, in
main()
File "/usr/local/lib/python3.12/site-packages/synapse/app/homeserver.py", line 411, in main
hs = setup(sys.argv[1:])
^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/synapse/app/homeserver.py", line 320, in setup
config = HomeServerConfig.load_or_generate_config(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/synapse/config/_base.py", line 841, in load_or_generate_config
obj.parse_config_dict(
File "/usr/local/lib/python3.12/site-packages/synapse/config/_base.py", line 869, in parse_config_dict
self.invoke_all(
File "/usr/local/lib/python3.12/site-packages/synapse/config/_base.py", line 443, in invoke_all
res[config_class.section] = getattr(config, func_name)(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/synapse/config/repository.py", line 157, in read_config
self.media_store_path = self.ensure_directory(
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/synapse/config/_base.py", line 292, in ensure_directory
os.makedirs(dir_path, exist_ok=True)
File "", line 225, in makedirs
PermissionError: [Errno 13] Permission denied: '/data/media_store'
```
### Anything else that would be useful to know?
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.