My idea is to enable everyone to use DGraph, to make DGraph as a default choice of database for application developers to build their mobile/web applications. One of the very significant steps needed to get there is to make setting up of Dgraph super simple and really easy, It should be made so simple that anyone can now, for the first time in history, should be able to have a GraphDB up running and ready to use in less than a minute.
In this regard here my propsal for the Install section of the Readme.md. That needs DGraph to offer binary releases ( One of advantages of DGraph being build in Go, need not ask users to install complicated libraries, just a binary would suffice! ).
$ docker pull dgraph/dgraph:latest
# Setting a somedir volume on the host will persist your data.
$ docker run -t -i -v /somedir:/dgraph -p 80:8080 dgraph/dgraph:latest
# Ensure mutations directory exists.
$ mkdir /dgraph/m
# Run the server
$ dgraph --mutations /dgraph/m --postings /dgraph/p --uids /dgraph/u
From Source
NOTE: Source installation is intended for only developers and advanced users. For general use, please download official releases from https://download.dgraph.io/.
If you do not have a working Golang environment, please install Go 1.6 from here.
$ go get -d github.com/dgraph-io/dgraph
# Make file takes care of installing RocksDB dependency too.
$ make
$ $GOPATH/bin/dgraph --mutations /dgraph/m --postings /dgraph/p --uids /dgraph/u
@hackintoshrao: This looks really good. I think @ashwin95r has a task to look into building binaries for Dgraph. If you’re interested, talk to him and see if you want to pick it up.
Doing a direct go build . gives a dynamically linked executable which depends on librocksdb and doesnt run on machines which do not have rocksDB installed. I’m working on creating a statically linked binary and let’s see if it works out. go build --ldflags '-extldflags "-static"' .
It’ll great to have it soon. But yes, there might be lot on the road for you guys. I’ll work on building a static binary meanwhile and see how it goes.
I statically compiled the dgraphassigner and I’ll share the binary in slack. This would be the command to build any binary statically : go build --ldflags '-extldflags "-static"' .
I’m still not able to compile the server statically
# github.com/dgraph-io/dgraph/dgraph
/usr/local/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
/tmp/go-link-159525422/000000.o: In function `_cgo_29becdab8e08_C2func_getaddrinfo':
/tmp/workdir/go/src/net/cgo_unix.go:57: warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from t
he glibc version used for linking
Looks like we need to switch from glibc to musl gcc or find some other way to tackle this. Once that is done we could have independent binaries.