Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/djmaze/synapse-purge
Purge old room events from synapse, a homeserver for the Matrix network
https://github.com/djmaze/synapse-purge
Last synced: 5 days ago
JSON representation
Purge old room events from synapse, a homeserver for the Matrix network
- Host: GitHub
- URL: https://github.com/djmaze/synapse-purge
- Owner: djmaze
- License: mit
- Created: 2018-09-15T16:16:59.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2021-06-08T21:21:10.000Z (over 3 years ago)
- Last Synced: 2024-08-02T12:49:05.262Z (3 months ago)
- Language: Ruby
- Homepage: https://hub.docker.com/r/decentralize/synapse-purge/
- Size: 34.2 KB
- Stars: 12
- Watchers: 5
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-starred - djmaze/synapse-purge - Purge old room events from synapse, a homeserver for the Matrix network (others)
README
# synapse-purge
Purge old room events from [Synapse](https://github.com/matrix-org/synapse), a homeserver for the [Matrix](https://matrix.org) network.
Currently, only remote events are purged. Events sent by local users are not deleted, as they may represent the only copies of this content in existence.
## Prerequisites
You need:
* access to synapse's database (postgresql only, read access is sufficient)
* an admin account on the homeserver
* Ruby or Docker installed on your serverAs you need direct database access, the app probably needs to run on the same host / network as synapse.
## Installation
Without Docker, clone this repository first. Then run:
```bash
bundle install --without development
```With Docker, use the supplied `docker-compose.yml` file as an example.
## Configuration
Copy `.env.example` to `.env` and adjust the homeserver URL, admin credentials and database URL for your configuration.
The purge will keep old events back as far as `DAYS_TO_KEEP` days (120 by default).
## Running
Without Docker:
```bash
ruby synapse-purge.rb
```With Docker Compose:
```bash
docker-compose run --rm app
```Alternatively, deploy using supplied `docker-compose.yml` on your Docker swarm.
## How it works
Synapse's [Purge History API](https://github.com/matrix-org/synapse/blob/master/docs/admin_api/purge_history_api.rst) works asynchronously. In order not to overload the homeserver, we purge rooms one-by-one.
The order of operation is as follows:
* The list of all rooms on the server is fetched from the database.
* For each room:
* A purge is initiated through the synapse admin API.
* The API is polled every half second for completion of the purge, until it is complete.## Support
Need help or having ideas for improvement? Join our [matrix room](https://matrix.to/#/!jMxweyLkWUsGViTtkk:strahlungsfrei.de).