Building Ratel

I’m new to Dgraph and Go and experimenting with getting Ratel setup. I already have a Alpha and Zero installed and running on CentOS and now trying to build Ratel from source.

I’m trying to follow the directions as noted in the Git repo INSTRUCTIONS.md

I’ve installed Go and upgraded to Node 14.7.3.

Per the directions, I ran:
go get -u github.com/dgraph-io/ratel

This creates:
/data/1/apps/go/pkg/mod/github.com/dgraph-io/ratel@v0.0.0-20210528215746-9debcc4717cc

I exported my $GOPATH to the above ratel path.

The directions say to then cd to “go/src/github.com/dgraph-io/ratel/”

However, there is no go/src directory, it’s go/pkg.
Following the path down to the scripts directory, the files are there, but they’re missing execute privileges.
So, then I ran:
chmod 755 -R /data/1/apps/go/pkg/mod/github.com/dgraph-io/ratel@v0.0.0-20210528215746-9debcc4717cc
Then I get an error:
fatal: Not a git repository (or any parent up to mount point /data/1)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

Am I missing something here?

So, the next thing I tried was:
cd /data/1/apps/go
git clone https: //github.com/dgraph-io/ratel
export GOPATH=/data/1/apps/go/ratel
./scripts/build.prod.sh

This went further and started building client files, however, resulted in the following messages:
The build folder is ready to be deployed.
Could not find go-bindata. Trying to install go-bindata.
$GOPATH/go.mod exists but should not

The directions say to next run:
./build/ratel
However, I don’t have a .build/ratel
I do have a:
./client/build

Trying to go into ./client and run ‘npm start’ results in “compiled with warnings” and there doesn’t seem to be any process running on port 8000;

What am I missing and any recommendations on where to go from here?

Thanks in advance for any guidance.

In the older Go versions with $GOPATH, your $GOPATH would need to be set before running the command go get -u. The latest versions of Go don’t require $GOPATH.

In the latest version of Go (go1.16.6 as of today) and Node you can install Ratel like so:

  1. Clone the Ratel repo wherever you wish
  2. At the step where go-bindata is installed, it needs to be in your $PATH. By default Go installs binaries in $HOME/go/bin
# Install Go and Node first
# Don't set GOPATH

git clone https://github.com/dgraph-io/ratel
cd ratel
export PATH="$HOME/go/bin:$PATH" # or have this in your shell profile
./scripts/build.prod.sh

And then your Ratel binary should be in ./build/ratel ready to execute.