Litestream

Learn how to configure Litestream for use with Filebase.

What is Litestream?

Litestream is a replication tool for SQLite databases on macOS X and Linux Debian operating systems. Litestream runs separate background processes for creating continuous replicas of SQLite databases that are copied to external disks or cloud locations such as Filebase.

Read below to learn how to use Litestream with Filebase.

Prerequisites:

1. Create a sample database called test.db with the following command:

sqlite3 test.db

2. Next, locate the litestream.yml file.

On Linux Debian systems, this is located at /etc/litestream.yml

3. Open the litestream.yml file in your preferred text editor.

Replace the existing content in the file with the following:

access-key-id: FILEBASE_ACCESS_KEY
secret-access-key: FILEBASE_SECRET_KEY

dbs:
  - path: /path/to/database/test.db
    replicas:
      - type: s3
        bucket: filebase-bucket
        path: /path/inside/bucket/
        endpoint: s3.filebase.com
        force-path-style: true

Replace the following values:

  • access-key-id: Your Filebase Access Key

  • secret-access-key: Your Filebase Secret Key

  • path: Replace the first path variable with the path to your SQLite Database file. This file will have the file extension .db.

  • bucket: Your Filebase Bucket Name

  • path: Replace the second path variable with the path inside your Filebase bucket where you’d like to store the SQLite database snapshot files.

4. Start the Litestream service:

systemctl start litestream

5. View the contents of your Filebase bucket to confirm the snapshot was uploaded:

Last updated