Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Auto-clean-up synapse database #283

Open
Gredin67 opened this issue Sep 21, 2021 · 5 comments
Open

[Feature] Auto-clean-up synapse database #283

Gredin67 opened this issue Sep 21, 2021 · 5 comments

Comments

@Gredin67
Copy link

what about implementing a cron job to run such a clean-up script by default with synapse_ynh ? It would improve a major synapse drawback, and improve privacy.

https://foss-notes.blog.nomagic.uk/2021/03/matrix-database-house-cleaning/
https://gitea.prk.st/romain/synapse-tools/src/branch/master/synapse-purge.sh

As these guys are maintaining a production synapse server I guess they would keep their clean-up scripts up-to-date.

@Thatoo
Copy link

Thatoo commented Sep 22, 2021

I feel that I have already read this somewhere...
I agree, synapse database becomes big quiet fast.
I would like a script that :

  • delete all data from a room that all members of our server have left.
  • delete all data older than two month from big rooms that was not originally created on our server (in our case, we didn't create big room in our server)
  • but I want to keep all history of direct chats and all history of rooms members of our servers have initiated if at least one member is still in it.

Of course I have no idea if its doable. Just requesting :-)

@tio-trom
Copy link

tio-trom commented Dec 2, 2021

That would be a great addition!

@tio-trom
Copy link

Can we merge this with #354 ?

@Gredin67
Copy link
Author

Gredin67 commented Sep 19, 2023 via email

@zyphlar
Copy link

zyphlar commented Jun 15, 2024

Running this script as a CRON job has been useful for me, though it'd be nice if it were just part of YunoHost (or Synapse!)

#!/bin/bash

set -eu

source /usr/share/yunohost/helpers

app=synapse

db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$(ynh_app_setting_get --app=$app --key=db_user)
db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
server_name=$(ynh_app_setting_get --app=$app --key=server_name)

iptables -A INPUT -s 172.17.0.0/16 -p tcp -m tcp --dport 5432 -j ACCEPT

docker run -it ungleich/rust-synapse-compress-state:2022-06-19 synapse_auto_compressor -p postgresql://$db_user:$db_pwd@172.17.0.1/$db_name -c 500 -n 100

iptables -D INPUT -s 172.17.0.0/16 -p tcp -m tcp --dport 5432 -j ACCEPT

ynh_psql_execute_as_root --database=$db_name --sql="vacuum full"

exit 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants