Skip to content

openstatusHQ/deno-litestream-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deno + SQLite + Litestream

How to speed run it locally

Install Litestream and start an S3 bucket

Install Litestream via brew (see all installation options):

brew install benbjohnson/litestream/litestream

Run MinIO (local S3 bucket) in a tab:

docker run -p 9000:9000 -p 9001:9001 minio/minio server /data --console-address ":9001"

Open browser http://localhost:9001 and enter default credentials.

Username: minioadmin
Password: minioadmin

Create a bucket "mybkt" in the GUI.

Install Deno and run the task

curl -fsSL https://deno.land/install.sh | sh

Run the task:

deno task start

The server is running on http://localhost:8000.

The task will create a data.db instance in the root directory if not existing and starts the Litestream replication to your S3 bucket.

Test replication

In a separate tab, open the SQLite instance and insert items in your database:

sqlite3 data.db
INSERT INTO fruits (name, color) VALUES ('apple', 'red');
INSERT INTO fruits (name, color) VALUES ('banana', 'yellow');
INSERT INTO fruits (name, color) VALUES ('grape', 'purple');

Each time you delete the data.db files (including shm 'shared memory' and wal 'write ahead log' files), it will get the duplication from your S3 bucket when you start the task.

About

Deno + SQLite + Litestream

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published