Getting started with PropaneDB

The standard way to run PropaneDB is to deploy it as a Docker container:
docker pull ghcr.io/elan8/propanedb:latest
In order to use PropaneDB with your application, you can use the Golang driver.
  1. First define your messages and RPC's in a .proto file and generate GRPC code and a Descriptor file:
    protoc --go_out=:. --go-grpc_out=:. --descriptor_set_out=./propane/test.bin -I. ./api/test.proto
  2. Open a terminal and use the following command to start an instance of PropaneDB
    docker run -p=50051:50051 ghcr.io/elan8/propanedb:latest
  3. First import the driver in your Go app and other dependencies (assuming you are using Go modules)
    import ( "context" "log" "io/ioutil" "github.com/elan8/propanedb-go-driver/propane" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/descriptorpb" )
  4. Connect to PropaneDB and create a database
    databaseName := "test" ctx := context.Background() port := "50051" b, err := ioutil.ReadFile("../propane/test.bin") if err != nil { log.Fatalf("Error: %s", err) } fds := &descriptorpb.FileDescriptorSet{} proto.Unmarshal(b, fds) client, err := propane.Connect(ctx, "localhost:"+port) if err != nil { log.Fatalf("Error: %s", err) } err = client.CreateDatabase(ctx, databaseName, fds) if err != nil { log.Printf("Error: %s", err) }
  5. Instantiate a Protobuf message (=struct in Go) that you previously defined in your .proto file and store it in the database:
    item1 := &propane.TestEntity{} item1.Description = "Test 1" id1, err := client.Put(ctx, item1) if err != nil { log.Fatalf("Error: %s", err) } log.Print("Id1=" + id1)

Related projects

Sourcecode

If you want to build PropaneDB yourself, you can download the source code from Github: https://www.github.com/elan8/propanedb