Matrix Synapse
Learn how to configure Matrix Synapse for use with Filebase.

What is Matrix Synapse?

Matrix.org is an open federated instant messaging and VoIP ecosystem. Matrix uses environments called ‘rooms’, that are distributed domains located across multiple servers. Domains are accessed and references with the format:
@username:matrix-room
Matrix Synapse is a homeserver implementation of Matrix.org. Synapse is primarily written using Python and Python modules. The Synapse S3 Storage Provider module allows for connection of your Synapse Homeserver to Filebase.
Read below to learn how to use Matrix Synapse with Filebase.

Prerequisites:

  • Download and install Matrix Synapse.
  • Download and install Python.
  • Download and install the following Python packages:
    • argparse
    • datetime
    • os
    • sqlite3
    • boto3
    • botocore
    • humanize
    • psycopg2
    • tqdm
    • yaml
  • Sign up for a free Filebase account.
  • Have your Filebase Access and Secret Keys. Learn how to view your access keys here.
  • Create a Filebase Bucket. Learn how to create a bucket here.

1. Once you’ve installed Matrix, navigate into the installation directory.

By default on *unix systems, this is /etc/matrix-synapse.

2. Use the following command to download the synapse-s3-storage-provider module:

3. Install the synapse-s3-storage-provider module by navigating into the synapse-s3-storage-provider directory and running the installation script:

./setup.py install

4. Navigate back into the /etc/matrix-synapse directory.

Open the homeserver.yaml file. Scroll down to the ‘Modules’ section and paste the following information:
media_storage_providers:
- module: s3_storage_provider.S3StorageProviderBackend
store_local: True
store_remote: True
store_synchronous: True
config:
bucket: FILEBASE_BUCKET_NAME
# All of the below options are optional, for use with non-AWS S3-like
# services, or to specify access tokens here instead of some external method.
region_name: us-east-1
endpoint_url: s3.filebase.com
access_key_id: FILEBASE_ACCESS_KEY
secret_access_key: FILEBASE_SECRET_KEY
# The object storage class used when uploading files to the bucket.
# Default is STANDARD.
#storage_class: "STANDARD_IA"
# The maximum number of concurrent threads which will be used to connect
# to S3. Each thread manages a single connection. Default is 40.
#
#threadpool_size: 20
Replace the following values:
  • FILEBASE_BUCKET_NAME: Filebase Bucket Name
  • FILEBASE_ACCESS_KEY: Filebase Access Key
  • FILEBASE_SECRET_KEY: Filebase Secret Key

5. While within the homeserver.yaml file, take note of the postgresSQL database credentials under database.args.

6. Navigate into the ./synapse-s3-storage-provider/scripts directory, create a new file called database.yaml.

In this file, put your postgresSQL credentials.

7. Sync your files to be uploaded. This command syncs files that have not been updated in 2 months.

s3_media_upload update /path/to/media/store 2m

8. Then, upload these files to your Filebase bucket:

s3_media_upload upload /path/to/media/store FILEBASE_BUCKET_NAME--storage-class STANDARD_IA --delete
If you have any questions, please join our Discord server, or send us an email at [email protected]
Copy link
On this page
What is Matrix Synapse?
1. Once you’ve installed Matrix, navigate into the installation directory.
2. Use the following command to download the synapse-s3-storage-provider module:
3. Install the synapse-s3-storage-provider module by navigating into the synapse-s3-storage-provider directory and running the installation script:
4. Navigate back into the /etc/matrix-synapse directory.
5. While within the homeserver.yaml file, take note of the postgresSQL database credentials under database.args.
6. Navigate into the ./synapse-s3-storage-provider/scripts directory, create a new file called database.yaml.
7. Sync your files to be uploaded. This command syncs files that have not been updated in 2 months.
8. Then, upload these files to your Filebase bucket: