Project

General

Profile

Hacking Keep » History » Version 6

Tim Pierce, 08/28/2014 02:08 PM

1 1 Tom Clegg
h1. Hacking Keep
2
3
{{toc}}
4
5 6 Tim Pierce
These instructions describe how to build the Arvados Keep storage server and/or proxy on your local machine.
6 1 Tom Clegg
7 6 Tim Pierce
h2. Install Go
8 1 Tom Clegg
9 6 Tim Pierce
The Arvados Keep server and proxy are written 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.
10 1 Tom Clegg
11 6 Tim Pierce
The rest of these instructions assume that you have a working Go installation on your system, and that your @GOPATH@ environment variable is set appropriately.
12 5 Tom Clegg
13 6 Tim Pierce
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. 
14 1 Tom Clegg
15
<pre>
16 6 Tim Pierce
export GOPATH=~/gocode
17
mkdir -p $GOPATH
18 5 Tom Clegg
</pre>
19 1 Tom Clegg
20 6 Tim Pierce
h2. Get source code
21 1 Tom Clegg
22 6 Tim Pierce
Clone the Arvados git repository, if you have not already:
23 1 Tom Clegg
24
<pre>
25 6 Tim Pierce
cd
26
git clone git://git.curoverse.com/arvados.git
27 1 Tom Clegg
</pre>
28
29 6 Tim Pierce
*Note:* If you are an authorized committer, clone @git@git.curoverse.com:arvados.git@ instead so you may push directly to git.curoverse.com.
30
31 5 Tom Clegg
h2. Tell Go to use your local copy
32 1 Tom Clegg
33 6 Tim Pierce
This step ensures that your development environment uses your locally-modified code, instead of fetching the master branch from git.curoverse.com:
34 1 Tom Clegg
35
<pre>
36 5 Tom Clegg
mkdir -p $GOPATH/src/git.curoverse.com
37
ln -s ~/arvados $GOPATH/src/git.curoverse.com/arvados.git
38 1 Tom Clegg
</pre>
39
40 6 Tim Pierce
Reason: The Keepstore and Keepproxy packages import other Go packages from the Arvados source tree. These packages have names like:
41
42
 git.curoverse.com/arvados.git/sdk/go/keepclient
43
 git.curoverse.com/arvados.git/sdk/go/arvadosclient
44
45
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/...@
46
47 5 Tom Clegg
h2. Run test suite
48
49 4 Tom Clegg
<pre>
50 6 Tim Pierce
cd ~/arvados/services/keepstore
51
go test
52 5 Tom Clegg
</pre>
53 4 Tom Clegg
54 6 Tim Pierce
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.:
55 4 Tom Clegg
56
<pre>
57 6 Tim Pierce
PASS
58
ok  	_/home/you/arvados/services/keepstore	1.023s
59 1 Tom Clegg
</pre>