Matrix/Synapse: Fly volumes interferring with copied host files in Dockerfile/image

The relevant Matrix Synapse docs:

The mounts section of my fly.toml:

  destination = "/data"
  source = "matrix_data"

I’ve already used Synapse’s generate command to get a valid homeserver.yaml file, which I copy into the container image.

My Dockerfile:

FROM matrixdotorg/synapse:v1.68.0


COPY homeserver.yaml .
RUN chown -R $UID:$GID .

However, when trying to deploy to Fly, I get the following error:

Config file '/data/homeserver.yaml' does not exist.

I also tried setting the SYNAPSE_CONFIG_DIR env var to /config (and then changing WORKDIR /data to WORKDIR /config) so that it the config file wouldn’t conflict with the volume, but that gives me another error:

PermissionError: [Errno 13] Permission denied: '/data/'
[info] Generating log config file /data/ which will log to /data/homeserver.log

So then I try editing homeserver.yaml and changing log_config: "/data/" to log_config: "/config/", but all that does is change the error path:

PermissionError: [Errno 13] Permission denied: '/config/'
[info] Generating log config file /config/ which will log to /config/homeserver.log

When I try building/running this setup locally, everything works:

  • docker build -t synapsetest .
  • docker run -d --name synapse --mount type=volume,src=synapse-data,dst=/data -p 8008:8008 synapsetest
    • Logs show Starting synapse with args -m --config-path /data/homeserver.yaml with no errors afterwards
    • http://localhost:8008/ shows a successful Synapse page


  • It looks like Fly’s volume mount is somehow interferring with the data Synapse needs to run.
    • I’ve tried deleting and recreating my Fly volume several times to no avail.
    • My best guess is that because Synapse relies on pre-generated config files that are then copied to a volume mount, it is not compatible with Fly’s voluming strategy that only allows the running app to write to the volume?
  • Is it possible to view the contents of a fly volume? I assume I could just fly ssh console and then ls -al /data, but in this case I can’t even get a deploy working so I can’t think of another way to view the volume contents without a running service.

If anyone has any ideas, I’d appreciate it! :smile: