-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Documentation for media_storage_providers #7140
Comments
I'm also interested in what the media storage is for. For me too, the file is stored locally in the file system AND on the S3. But if I delete the local directory, all files are still available to me. I use a Minio server as S3 storage. |
What I just noticed is that all pre-generated thumbnails are ONLY stored on the S3 as expected. 🤔 |
The documentation is pretty light, but seems to be at https://github.com/matrix-org/synapse/blob/develop/docs/media_repository.md, the default config could certainly offer a bit more info: synapse/docs/sample_config.yaml Lines 695 to 708 in 883ac4b
Looking at some of the code it seems that the "local" vs. "remote" in those configurations is whether the media was uploaded directly to this server vs. whether it was received over federation (it does not mean whether the data is stored "locally" on the server vs. "remote on S3", which is how I originally read it). See synapse/synapse/config/repository.py Lines 46 to 48 in 9dfcf47
What's your configuration for synapse/synapse/config/repository.py Lines 118 to 126 in 883ac4b
|
I have not specified |
The synapse/synapse/config/repository.py Lines 112 to 117 in 883ac4b
|
Okay, I think I understand how the media storage providers are meant. The storage of the media is primarily managed by the MediaStorage and not the StorageProvider.
This in turn always saves the file first in the local directory: synapse/synapse/rest/media/v1/media_storage.py Lines 65 to 70 in 9dfcf47
And then this locally stored file is passed on to the StorageProviders: synapse/synapse/rest/media/v1/media_storage.py Lines 109 to 112 in 9dfcf47
I'm slowly beginning to understand what the s3_media_upload.py cleanup job is all about. However, it should not be a problem to simply delete the local files from synapse/synapse/rest/media/v1/media_storage.py Lines 143 to 151 in 9dfcf47
I hope I have analyzed it correctly. |
Hey @tristanlins, yes this seems correct to me. |
Can we add a link to this issue at the relevant place in the sample config file? Thanks! |
Note there is an alternative solution which in theory should be easy to config so that the only media directory is an S3 bucket. I'm going to try it myself when I set my server up within the next few days. You install and configure Goofys, make sure it mounts an S3 bucket directory on boot, and then you can simply change the media directory in the Matrix config to that one and turn off the S3 storage provider. As far as Matrix is concerned it is writing media to the local filesystem but it'll be transparently using your S3 bucket instead. This is the S3 config from the popular Ansible Docker deploy. |
Any luck with this? I am looking for the same solution on how to replace local media storage with S3. |
I bet using goofys works worse and is more brittle than just using the s3 storage provider. The local storage even has the advantage of being a cache for recently uploaded files. Why not just run the clean-up script regularly? (Or run synapse in ephemeral containers, which, at least for me, is already sufficient?) |
Couple of reasons:
|
I want to use the
s3_storage_provider.S3StorageProviderBackend
.I configured it and when images are send over my synapse server they are also stored in the s3 bucket.
Here is how i configured it:
But the images are still also stored locally on disk at
/var/lib/matrix-synapse/media
and if i remove the folder/var/lib/matrix-synapse/media
the images are not shown anymore although they are still in the s3 bucket. So it seems to me that thes3_storage_provider.S3StorageProviderBackend
does nothing but also store the data as a backup option?I also could not find any documentation about
media_storage_providers
in this repo.Can someone explain what they are and how they are supposed to work please.
My use case is that i want only to use the S3 Bucket and no local storage. Is this possible with
media_storage_providers
?The text was updated successfully, but these errors were encountered: