Build and Run dqlite on Alpine Linux
apk add raft-dev dqlite dqlite-dev --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing
apk add sqlite-dev --repository=http://dl-cdn.alpinelinux.org/alpine/edge/main
apk add musl-dev go git jq curl
cd /root
git clone https://github.com/canonical/go-dqlite.git
cd /root/go-dqlite
go install -tags libsqlite3 ./cmd/dqlite-demo
/root/go/bin/dqlite-demo --api 172.17.0.2:8001 --db 172.17.0.2:9001
Reuse build on a second node (dqlite-demo has been cp to host /$someDir)
docker run -itv /$someDir:/shared alpine /bin/sh
apk add sqlite-dev --repository=http://dl-cdn.alpinelinux.org/alpine/edge/main
apk add dqlite-dev --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing
/shared/dqlite-demo --api 172.17.0.3:8001 --db 172.17.0.3:9001 --join 172.17.0.2:9001
curl -X PUT -d '{"val": 1}' http://172.17.0.2:8001/1
curl http://172.17.0.2:8001/1 # {"val": 1}
curl http://172.17.0.3:8001/1 # {"val": 1}
# Stop node 1
curl http://172.17.0.3:8001/1 # {"val": 1}
curl -X PUT -d '{"val": 2}' http://172.17.0.3:8001/2
# re Start node 1
curl http://172.17.0.2:8001/2 # {"val": 2}
go install -tags libsqlite3 ./cmd/dqlite
/root/go/bin/dqlite -s 172.17.0.2:9001 demo
dqlite> .cluster
2dc171858c3155be|172.17.0.2:9001|voter
abdfb92ed87f28d7|172.17.0.3:9001|voter
f5a9b88a043bbc7e|172.17.0.4:9001|voter
dqlite> .leader
172.17.0.2:9001