element-hq / element-hq/synapse
Data/config file errors when using Docker volumes (and fly.io)
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 600
- Avg merge
- 5d 22h
- Merged PRs (30d)
- 51
Description
This issue has been migrated from [#14122](https://github.com/matrix-org/synapse/issues/14122).
---
I've already used the `generate` command to get a valid `homeserver.yaml` file (which I then pulled from the local volume on my machine).
My `Dockerfile`:
```Dockerfile
FROM matrixdotorg/synapse:v1.68.0
ENV SYNAPSE_SERVER_NAME=matrix.my.domain
ENV SYNAPSE_REPORT_STATS=no
WORKDIR /data
COPY homeserver.yaml .
RUN chown -R $UID:$GID .
```
However, when trying to run, I get the following error:
```
Config file '/data/homeserver.yaml' does not exist.
```
I am deploying on https://fly.io/; I have a volume mount for `/data` that I'm pretty sure is empty (I deleted and recreated it several times), but I am not able to write to the volume directly because Fly does not allow that. The application has to do all writing, but I don't think Synapse supports this with this config file setup?
I figured I could set `SYNAPSE_CONFIG_DIR` env var to `/config` (and then change `WORKDIR /data` to `WORKDIR /config`) so that it wouldn't conflict with the volume, but that gives me another error:
```
PermissionError: [Errno 13] Permission denied: '/data/matrix.my.domain.log.config'
[info] Generating log config file /data/matrix.my.domain.log.config which will log to /data/homeserver.log
```
So then I try editing `homeserver.yaml` and changing `log_config: "/data/matrix.my.domain.log.config"` to `log_config: "/config/matrix.my.domain.log.config"`, but all that does is change the error path:
```
PermissionError: [Errno 13] Permission denied: '/config/matrix.my.domain.log.config'
[info] Generating log config file /config/matrix.my.domain.log.config which will log to /config/homeserver.log
```
If anyone has any ideas for me to try, I'd appreciate it! 😄
Contributor guide
Research direction
Read the Dockerfile and homeserver.yaml paths first, then inspect how the Synapse container handles /data, SYNAPSE_CONFIG_DIR, log_config, and mounted-volume permissions. Reproduce the startup errors with the stated image and Fly.io volume setup; done means the configuration starts without missing-file or PermissionError failures.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, python
- Domain
- backend, cloud, devops
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100