rqlite is software, and it goes without saying it can always be improved. It's by no means finished -- issues are tracked, and I plan to develop this project further. Pull requests are welcome.
rqlite can be compiled and executed on Linux, OSX, and Microsoft Windows.
You may also wish to check out the rqlite Google Group.
If you open a pull request, please ensure the commit history is clean. Squash the commits into logical blocks, perhaps a single commit if that makes sense. What you want to avoid is commits such as "WIP" and "fix test" in the history. This is so we keep history on master clean and straightforward.
Please avoid using libaries other than those available in the standard library, unless necessary. This requirement is relaxed somewhat for software other than rqlite node software itself. To understand why this approach is taken, check out this post.
Building rqlite requires Go 1.16 or later. gvm is a great tool for installing and managing your versions of Go.
One goal of rqlite is to keep the build process as simple. Download, build, and run rqlite like so (tested on 64-bit Kubuntu 16.04 and OSX):
mkdir rqlite # Or any directory of your choice.
cd rqlite/
export GOPATH=$PWD
mkdir -p src/github.com/rqlite
cd src/github.com/rqlite
git clone git@github.com:rqlite/rqlite.git
cd rqlite
go install ./...
$GOPATH/bin/rqlited ~/node.1
This starts a rqlite server listening on localhost, port 4001. This single node automatically becomes the leader.
To rebuild and run, perhaps after making some changes to the source, do something like the following:
cd $GOPATH/src/github.com/rqlite/rqlite
go install ./...
$GOPATH/bin/rqlited ~/node.1
The process outlined above will work for Linux, OSX, and Windows. For Raspberry Pi, check out this issue.
This step is not necessary unless you are making changes to protobuf definitions.
Ensure you have the required tools installed, and that GOPATH
is set.
go get -u github.com/golang/protobuf/protoc-gen-go
go install github.com/golang/protobuf/protoc-gen-go
export GOBIN=$GOPATH/bin
export PATH=$PATH:$GOBIN
export DEST_DIR=$GOPATH/src
export SRC_DIR=$GOPATH/src/github.com/rqlite/rqlite/command
protoc -I=$SRC_DIR --proto_path=$GOPATH/src/github.com/rqlite/rqlite --go_out=$DEST_DIR $SRC_DIR/command.proto
export SRC_DIR=$GOPATH/src/github.com/rqlite/rqlite/cluster
protoc -I=$SRC_DIR --proto_path=$GOPATH/src/github.com/rqlite/rqlite --go_out=$DEST_DIR $SRC_DIR/message.proto
It can be rather slow to rebuild rqlite, due to the repeated compilation of the SQLite source code. You can compile and install the SQLite libary once, so subsequent builds are much faster. To do so, execute the following commands:
cd $GOPATH
go install github.com/rqlite/go-sqlite3
If you wish to work with fork of rqlite, your own fork for example, you must still follow the directory structure above. But instead of cloning the main repo, instead clone your fork. You must fork the project if you want to contribute upstream.
Follow the steps below to work with a fork:
export GOPATH=$HOME/rqlite
mkdir -p $GOPATH/src/github.com/rqlite
cd $GOPATH/src/github.com/rqlite
git clone git@github.com:<your Github username>/rqlite
Retaining the directory structure $GOPATH/src/github.com/rqlite
is necessary so that Go imports work correctly.
Be sure to run the unit test suite before opening a pull request. An example test run is shown below.
$ cd $GOPATH/src/github.com/rqlite/rqlite
$ go test ./...
? github.com/rqlite/rqlite [no test files]
ok github.com/rqlite/rqlite/auth 0.001s
? github.com/rqlite/rqlite/cmd/rqlite [no test files]
? github.com/rqlite/rqlite/cmd/rqlited [no test files]
ok github.com/rqlite/rqlite/db 0.769s
ok github.com/rqlite/rqlite/http 0.006s
ok github.com/rqlite/rqlite/store 6.117s
ok github.com/rqlite/rqlite/system_test 7.853s