Matrix server installed with docs, but /data/homeserver.yaml file not found

Hello everyone

I got a VPS so I can run my Matrix server on it.

When I start the installation of the Matrix container with Docker, the installation goes fine; it tells me that the configuration file is located at /data/homeserver.yaml, but when I return to the root I don’t have a data folder.

debian@vps-*********:~$ docker run -it --rm
--mount type=volume,src=synapse-data,dst=/data
-e SYNAPSE_SERVER_NAME=my.matrix.host
-e SYNAPSE_REPORT_STATS=yes
matrixdotorg/synapse:latest generate
Unable to find image 'matrixdotorg/synapse:latest' locally
latest: Pulling from matrixdotorg/synapse
bcdd12241c3a: Pull complete
e95a6c7ea7d4: Pull complete
a61b58932a64: Pull complete
d52729f33c0e: Pull complete
a31b57aa9776: Pull complete
3e49ec65d3ca: Pull complete
8cba1604ea56: Pull complete
7e21098d2a85: Pull complete
8fe808f7d6d7: Pull complete
f71a21c1dcd3: Pull complete
aaaaef2085f6: Download complete
Digest: sha256:6882d26594b87171e0fe807ac6bd7f0000665cd70e73fb88c58ec9bff14c19ce
Status: Downloaded newer image for matrixdotorg/synapse:latest
Setting ownership on /data to 991:991
Config file '/data/homeserver.yaml' already exists

It already exists because I had tried to uninstall/reinstall it.

Thanks to everyone

Hola @Gus

Cuando creas un volumen con el comando --mount type=volume,src=synapse-data,dst=/data estás usando un volumen con nombre 'named volume'. Docker guarda estos volúmenes en una ruta gestionada por él, generalmente en /var/lib/docker/volumes/ en Linux. Por eso no ves una carpeta data directamente en tu raíz.

Para ver tus archivos de configuración, como homeserver.yaml, puedes ejecutar docker volume inspect synapse-data para ver la ruta exacta en el host donde Docker está almacenando los datos. Ahí es donde deberías encontrar el archivo homeserver.yaml.

La forma más rápida y limpia de verificar que el archivo existe es ejecutar un contenedor temporal que monte el mismo volumen. Puedes lanzar un comando como docker run -it --rm -v synapse-data:/data alpine ls -l /data para ver el contenido del volumen. Esto debería mostrarte el archivo de configuración.

Si el archivo no existe, tendrás que forzar la regeneración de la configuración.

Espero haberte ayudado,
Sergio Turpín

Hello

Thanks for your reply, I admit I’m not yet very accustomed to Docker in general; my installations are done with apt.
Indeed, the file is exactly where you indicated.

Thanks

All the best

I'm still surprised that I have to switch to root to access the configuration files.

Is it generally like this with a container installation?

It looks like the problem stems from the fact that you're using a Docker volume rather than a regular directory on the system. With the parameter --mount type=volume,src=synapse-data,dst=/data the files are stored inside the synapse-data volume, so you won't simply see them in the /data directory on the VPS.

You can check the volume's contents with the command:


docker volume inspect synapse-data

or enter a temporary container and inspect the files:


docker run --rm -it -v synapse-data:/data alpine sh
ls -la /data

There should be a homeserver.yaml there. If you want to keep the configuration in a normal folder, instead of type=volume you can use a bind mount, e.g. -v /path/on/server:/data. Then the files will be visible directly on the VPS.

With such Docker installations it’s also worth double‑checking that the old volume wasn’t left over from a previous attempt, because the “file already exists” message often points to that. By the way you can find more interesting topics online here: https://vegashero.com.pl/app/. Good luck with configuring Matrix! :slightly_smiling_face:

Docker runs the processes inside the container with a specific user. When you mount a volume from your host into the container, the files that are created inside that volume from the container take the permissions of the user that creates them. If the Synapse image runs with a specific user (such as 991), and your user on the host is debian, it’s normal that you can’t read those files because the permissions don’t match.

You can add your debian user (or whichever you have) to the group that has access to the volume directory. For example, if the volume is at /var/lib/docker/volumes/synapse-data/_data, you can run:

sudo chown -R debian:debian /var/lib/docker/volumes/synapse-data/_data

You can also change the group permissions so that your user can read them. A clean way is to pass the container the UID and GID of your debian user on the host.

Since all this can be a bit overwhelming, I recommend you take a look at this :down_arrow:

https://docs.docker.com/guides/admin-user-management/

Let us know how it goes, cheers.
Sergio Turpín

Hello

Alright, I’m starting to get a sense of how Docker works.

I’ll study the topic thoroughly, then I’ll see whether to go with a Docker installation or a classic one.

I imagine the two setups are about the same in terms of installation? From what I’ve read, a classic version is simpler to install but less convenient for ongoing maintenance.

Thanks for the links

Exactly! In terms of final functionality, the result is the same, i.e., your Matrix server will be running and will work. The difference is the path you choose to get there.

:right_arrow: With the classic installation. You install each component (Python, PostgreSQL, the Matrix server, etc…) directly on your VPS’s operating system. The result is a system that works, but all those components are ‘mixed’ with the system.

:right_arrow: Installation with Docker. Each service component runs inside its own container, isolated from the operating system. You store the configuration and the data in volumes, which are folders you control and that are independent of the container. Your installation isn’t in the system, but in the docker-compose.yml file and the volumes. The advantage? To update, you just change the image version in the file and run docker-compose up -d. To move everything to another server, copy the file and the volumes. It’s more complex at first, but later maintenance is much cleaner and more predictable :slightly_smiling_face:

I hope you understand it a bit better. Let us know how it goes.
Sergio Turpín