Hacking Keep » History » Revision 6
Revision 5 (Tom Clegg, 08/18/2014 03:57 PM) → Revision 6/9 (Tim Pierce, 08/28/2014 02:08 PM)
h1. Hacking Keep
{{toc}}
These instructions describe how to build the Arvados Keep storage server and/or proxy on your local machine.
h2. Install Go Source tree layout
The Arvados Keep storage server and proxy are written source code is in "Go":http://www.golang.org/. In order to build it locally, you must have the Go toolchain installed. Follow the instructions at http://golang.org/doc/install to install Go.
The rest of these instructions assume that you have a working Go installation on your system, and that your @GOPATH@ environment variable @/services/keepstore@. Proxy server is set appropriately. in @/services/keepproxy@.
If you have just installed Go for the first time, you may set @GOPATH@ to any empty directory. The Go toolchain will install Go packages and dependencies here.
<pre>
export GOPATH=~/gocode
mkdir -p $GOPATH
</pre>
h2. Get source code
Clone the Arvados git repository, if you have not already:
<pre>
cd
git clone git://git.curoverse.com/arvados.git
ls arvados/services/keep*
</pre>
*Note:* If you are an authorized committer, clone Clone @git@git.curoverse.com:arvados.git@ instead so if you may plan to push directly to git.curoverse.com.
h2. Install build-prerequisites
Install Go. See http://golang.org/doc/install or try this short cut:
<pre>
wget https://storage.googleapis.com/golang/go1.3.1.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.3.1.linux-amd64.tar.gz
cd /usr/local/bin
sudo ln -s ../go/bin/* .
</pre>
(Check https://code.google.com/p/go/downloads/list for other platforms and newer versions.)
h2. Set up GOPATH
<pre>
export GOPATH=~/gocode
mkdir -p $GOPATH
</pre>
h2. Tell Go to use your local copy
This step ensures that your development environment uses your locally-modified code, instead (Instead of automatically fetching the master branch from git.curoverse.com: the git repository)
<pre>
mkdir -p $GOPATH/src/git.curoverse.com
ln -s ~/arvados $GOPATH/src/git.curoverse.com/arvados.git
</pre>
Reason: The Keepstore and Keepproxy packages import other Go packages from the Arvados source tree. These packages have names like:
git.curoverse.com/arvados.git/sdk/go/keepclient
git.curoverse.com/arvados.git/sdk/go/arvadosclient
When the Go compiler needs to import one of these packages, it will look in @$GOPATH/src@ for the package source code. If it does not find the code locally, it will fetch the code from git.curoverse.com automatically. This symlink ensures that Go will find your local source code under @$GOPATH/src/git.curoverse.com/arvados.git/...@
h2. Run test suite
<pre>
cd ~/arvados/services/keepstore
go test git.curoverse.com/arvados.git/services/keepstore
</pre>
The @go test@ command will print a few dozen lines of logging output. If the tests succeeded, it will print PASS followed by a summary of the packages which passed testing, e.g.: You should see something like this:
<pre>
PASS
ok _/home/you/arvados/services/keepstore 1.023s git.curoverse.com/arvados.git/services/keepstore 0.015s
</pre>