Skip to content

Commit

Permalink
Document matrix-synapse-s3-storage-provider-migrate.{service,timer}
Browse files Browse the repository at this point in the history
  • Loading branch information
spantaleev committed Oct 14, 2022
1 parent 3cf0dcd commit de8fd51
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
14 changes: 13 additions & 1 deletion docs/configuring-playbook-synapse-s3-storage-provider.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ The way media storage providers in Synapse work has some caveats:

You may be thinking **if all files are stored locally as well, what's the point**?

You can run some scripts to delete the local files once in a while, thus freeing up local disk space. If these files are needed in the future (for serving them to users, etc.), Synapse will pull them from the media storage provider on demand.
You can run some scripts to delete the local files once in a while (which we do automatically by default - see [Periodically cleaning up the local filesystem](#periodically-cleaning-up-the-local-filesystem)), thus freeing up local disk space. If these files are needed in the future (for serving them to users, etc.), Synapse will pull them from the media storage provider on demand.

While you will need some local disk space around, it's only to accommodate usage, etc., and won't grow as large as your S3 store.

Expand Down Expand Up @@ -104,3 +104,15 @@ docker run -it --rm \
tianon/backblaze-b2:3.6.0 \
-c 'b2 authorize-account $B2_KEY_ID $B2_KEY_SECRET && b2 sync /work b2://$B2_BUCKET_NAME --skipNewer'
```

## Periodically cleaning up the local filesystem

As described in [How it works?](#how-it-works) above, when new media is uploaded to the Synapse homeserver, it's first stored locally and then also stored on the remote S3 storage.

By default, we periodically ensure that all local files are uploaded to S3 and are then removed from the local filesystem. This is done automatically using:

- the `/usr/local/bin/matrix-synapse-s3-storage-provider-migrate` script
- .. invoked via the `matrix-synapse-s3-storage-provider-migrate.service` service
- .. triggered by the `matrix-synapse-s3-storage-provider-migrate.timer` timer, every day at 05:00

So.. you don't need to perform any maintenance yourself.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Description=Migrates locally-stored Synapse media store files to S3
[Timer]
Unit=matrix-synapse-s3-storage-provider-migrate.service
OnCalendar=*-*-* 05:00:00
RandomizedDelaySec=2h

[Install]
WantedBy=timers.target

0 comments on commit de8fd51

Please sign in to comment.