Compare commits

...
Sign in to create a new pull request.

1 commit

Author SHA1 Message Date
c4d3a8f86d
matrix-synapse: (wip) switch to s3 media backend 2025-03-04 23:23:35 +01:00
4 changed files with 35 additions and 1 deletions

View file

@ -281,7 +281,10 @@ in
"redis"
];
plugins = [ config.services.matrix-synapse.package.plugins.matrix-synapse-shared-secret-auth ];
plugins = [
config.services.matrix-synapse.package.plugins.matrix-synapse-s3-storage-provider
config.services.matrix-synapse.package.plugins.matrix-synapse-shared-secret-auth
];
};
services.matrix-authentication-service = {

View file

@ -17,6 +17,7 @@
element-stickerpicker = prev.callPackage ./pkgs/element-stickerpicker {
inherit (inputs) element-stickers maunium-stickerpicker;
};
matrix-cache-gc = prev.callPackage ./pkgs/matrix-cache-gc.nix { inherit inputs; };
nextcloud-skeleton = prev.callPackage ./pkgs/nextcloud-skeleton { };
}
)

View file

@ -0,0 +1,30 @@
{
inputs,
writeShellApplication,
}:
writeShellApplication {
name = "matrix-cache-gc";
text = ''
## CONFIGURATION ##
#AWS_ACCESS_KEY_ID=GKxxx
#AWS_SECRET_ACCESS_KEY=xxxx
AWS_ENDPOINT_URL=https://buckets.pub.solar
S3_BUCKET=matrix-synapse
MEDIA_STORE=/var/lib/matrix-synapse/media_store
PG_USER=matrix-synapse
PG_DB=matrix
PG_HOST=/run/postgresql
## CODE ##
cat > database.yaml <<EOF
user: $PG_USER
database: $PG_DB
host: $PG_HOST
EOF
alias s3_media_upload=${inputs.nixpkgs.legacyPackages.x86_64-linux.matrix-synapse.plugins.matrix-synapse-s3-storage-provider}/bin/s3_media_upload
s3_media_upload update-db 1d
s3_media_upload --no-progress check-deleted "$MEDIA_STORE"
s3_media_upload --no-progress upload "$MEDIA_STORE" "$S3_BUCKET" --delete --endpoint-url "$AWS_ENDPOINT_URL"
'';
}