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.
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.
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.