matrix-org / rust-synapse-compress-state

A tool to compress some state in a Synapse instance's database
https://pypi.org/project/synapse-auto-compressor/
Apache License 2.0
143 stars 33 forks source link

Add Dockerfile #22

Closed t3chguy closed 2 years ago

t3chguy commented 3 years ago

Simple Dockerfile to not have to install rust/cargo on my Synapse docker host

schildbach commented 3 years ago

Can you add a bit of documentation on how to use this via Docker? I'm running the Synapse docker and hope to be able to compress state using this PR.

t3chguy commented 3 years ago

After building it using something like docker build -t rust-synapse-compress-state . in a git checkout containing this Dockerfile (and the rest of the repo) there are a couple of ways to use this

Either using docker run + mounting or via docker run sh

I used the former, with something like:

docker run --network root_default -v (pwd):/output -it rust-synapse-compress-state -t -p "host=postgres user=matrix password=PASSWORD dbname=synapse" -r "!ROOMID:server" -o /output/ROOMID.sql

--network to attach it to my the same internal network as my docker-compose'd Synapse & Postgres

Then from there I applied it to my db using

dc exec -T postgres psql -U postgres synapse < state-compressions/ROOMID.sql

schildbach commented 3 years ago

Thanks! I was able to run this, largely following your instructions. Comments for future users:

t3chguy commented 3 years ago

Ah yes, my bad, I lean on my crutches too much (fish-shell and a few aliases)