Example repository for embedding Litestream in a Go application.

Overview

Litestream as Library

This repository is an example of embedding Litestream as a library in a Go application. The Litestream API is not stable so you may need to update your code in the future when you upgrade.

Install

To install, run:

go install .

You should now have a litestream-library-example in $GOPATH/bin.

Usage

This example application uses AWS S3 and only provides a -bucket configuration flag. It will pull AWS credentials from environment variables so you will need to set those:

export AWS_ACCESS_KEY_ID=xxxxxxxxxxxxxxxxxxxx
export AWS_SECRET_ACCESS_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

You'll need to setup an S3 bucket and use that name when running the app.

litestream-library-example -dsn /path/to/db -bucket YOURBUCKETNAME

On your first run, it will see that there is no snapshot available so the application will create a new database. If you restart the application then it will see the local database and use that.

If you remove the database:

rm /path/to/db* /path/to/.db-litestream

Then when you restart the application, it will fetch the latest snapshot and replay all WAL files up to the latest position.

Synchronous replication

This repository provides an example of confirming that the replica syncs to S3 before returning to the caller. Replicating to S3 can be slow so you may end up waiting several hundred milliseconds before the sync returns.

You might also like...
The resource repository of the book
The resource repository of the book "gRPC - Up and Running".

The resource repository of the book "gRPC - Up and Running".

go mev-geth example. signTx,send transaction to relay.

go-mev-geth go mev-geth example. signTx,send transaction to relay. sample smart contract /eth/contract/mevtransfer/mevtransfer.sol pragma solidity 0.6

Example code for my Cadence Intro Workshop

Temporal Intro Workshop This repository contains example code for my Temporal Intro Workshop. Prerequisites Git, Make, etc. Make sure you have the lat

Example resource for alt:V Go module

Example resource for alt:V Go module

Example go clean architecture folder pattern

Golang Clean Architecture (Maintenance) Berikut ini adalah folder structure pattern yang biasa saya gunakan, walaupun tidak semua nya saya terapkan di

Example skills and a cli utility written in Go for interacting with Webex Assistant Skills

Webex Assistant Skills - Go This repository holds example skills and a cli utility written in Go for interacting with Webex Assistant Skills. It is in

This is an example of a keep-it-simple directory layout for Go projects that was created using DDD principles, please copy and share if you like it.

DDD Go Template This project was created to illustrate a great architectural structure I developed together with @fabiorodrigues in the period I was w

Questions and answers example project.

Question Answer Service REST Service for questions and answers Database modeling Directory tree pkg: Here is the main source code. sql: Here are all t

Go realworld example

TODOs Users and Authentication POST /user/login: Existing user login POST /users: Register a new user GET /user: Get current user PUT /user: Update cu

Owner
Ben Johnson
Ben Johnson
Repository for COMP 429 Programming Assignment# 1 - A simple chat application, by Sabra Bilodeau.

Chatty COMP 429 Programming Assignment 1 A Chat Application for Remote Message Exchange by Sabra Bilodeau Getting Started with Chatty Building the Pro

Sabra Bilodeau 0 Nov 28, 2021
Repository for learning GO lang

LearnGOLang Repository for learning GO lang. What is Go? Go is a fast, statically typed compiled language Compiled to machine level code, does not nee

Allan 0 Oct 15, 2021
This is the repository for the LinkedIn Learning course Learning Go.

Learning Go This is the repository for the LinkedIn Learning course Learning Go. The full course is available from LinkedIn Learning. What is Go? Go i

Zhenguan Tang 0 Nov 2, 2021
A repository for showcasing my knowledge of the Google Go (2009) programming language, and continuing to learn the language.

Learning Google Golang (programming language) Not to be confused with the Go! programming language by Francis McCabe I don't know very much about the

Sean P. Myrick V19.1.7.2 2 Nov 6, 2022
A repository for showcasing my knowledge of the Go! (2003) programming language, and continuing to learn the language.

Learning Go! (programming language) Not to be confused with Google Golang (2009) I don't know too much about the Go! programming language, but I know

Sean P. Myrick V19.1.7.2 2 Oct 22, 2022
This repository contains Sougata Khan's solutions to the Exercism Golang Track

Exercism Golang Track This repository contains Sougata Khan's solutions to the Exercism Golang Track Exercises Exercism Problem Solution Description H

Sougata Khan 0 Dec 29, 2021
🐨 Go lang Study Repository.

go ?? Go lang Study Repository. 01 - Hello World Hello world in GO! What have learned? Create a module using the go init command. Declare a package. I

klaby 1 Feb 15, 2022
Gotk4-subclassing - Experimental repository for gotk4 subclassing

gotk4 A GTK4 bindings generator for Go. Package documentation | Package examples

null 1 Jan 8, 2022
The repository intent is store some Go Lang codes.

⚠️ Go programming course ⚠️ This repository was created to share the Learn How To Code: Google's Go (golang) Programming Language code created by Todd

Vagner Wentz 2 Jan 16, 2022
A repository with my resolutions of the GO exercises from github.com/gophercises

GOPHERCISES A repository with my resolutions of the GO exercises from github.com/gophercises Gophercises is a FREE course that will help you become mo

Lucas Oliveira 0 Feb 1, 2022