Project

General

Profile

Hacking prerequisites » History » Version 13

Joshua Randall, 09/11/2015 02:00 PM
adds note about git config push.default matching (although this should probably be fixed in the tests themselves)

1 1 Tom Clegg
{{>toc}}
2
3
h1. Hacking prerequisites
4
5
The Arvados test suite can run in a Docker container, a VM, or your workstation -- provided a few prerequisites are satisfied.
6
7
h2. Host options
8
9
h3. Starting on your workstation
10
11
If your workstation is a debian wheezy or jessie system -- and you don't mind installing a bunch of packages on your workstation, some of them without apt -- the easiest way to get running is to run tests on bare metal. Skip to "Dependencies".
12
13
Other linux distributions should work too with some modifications, but it's probably easier to use a VM.
14
15
h3. Starting on a VM
16
17
Another option is to create a virtual machine using something like Xen or VirtualBox, and run debian jessie on it. The instructions below assume you have just a few basic requirements:
18
* SSH server
19
* sudo (@apt-get install sudo@)
20
* A user account with sudo privileges
21
22
h3. Starting in a docker container
23
24
This can get you started quickly, but (unlike the above options) you'll need to remember to use something like @docker commit@ to save your state before shutting down your container.
25
26
See http://docker.io for more about installing docker. On debian it looks something like this.
27
28
<pre>
29
echo 'deb http://http.debian.net/debian jessie-backports main' | sudo tee -a /etc/apt/sources.list.d/jessie-backports.list
30
sudo apt-get install docker.io
31
sudo adduser $USER docker
32
# {log out & log back in}
33
groups
34
# {should include "docker"}
35
</pre>
36
37
Start up a new container with jessie, make a new user and log in as that user:
38
39
<pre>
40 12 Joshua Randall
docker run -it --privileged debian:jessie bash
41 1 Tom Clegg
apt-get update
42
apt-get install sudo
43
adduser me
44
adduser me sudo
45
sudo -u me -i
46
</pre>
47 12 Joshua Randall
48
The &quot;--privileged&quot; is required in order for /dev/fuse to be accessible (without it, no tests that require FUSE will work). 
49 1 Tom Clegg
50
h2. Install dev environment
51
52 3 Tom Clegg
<pre>
53 8 Joshua Randall
sudo apt-get install bison build-essential fuse gettext git gitolite3 graphviz \
54 7 Bryan Cosca
    iceweasel libattr1-dev libfuse-dev libcrypt-ssleay-perl libjson-perl libcurl3 libcurl3-gnutls \
55 1 Tom Clegg
    libcurl4-openssl-dev libpcre3-dev libpq-dev libpython2.7-dev \
56 8 Joshua Randall
    libreadline-dev libssl-dev libxslt1.1 linkchecker lsof nginx perl-modules \
57 10 Joshua Randall
    postgresql python python-epydoc pkg-config sudo virtualenv \
58 2 Tom Clegg
    wget xvfb zlib1g-dev
59
60 1 Tom Clegg
# ruby 2.1:
61 6 Tom Clegg
sudo apt-get install ruby2.1 ruby2.1-dev || \
62 1 Tom Clegg
(
63
 set -e
64
 mkdir -p ~/src
65
 cd ~/src
66
 wget http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.6.tar.gz
67
 tar xzf ruby-2.1.6.tar.gz
68
 cd ruby-2.1.6
69
 ./configure --disable-install-doc
70
 make
71
 sudo make install
72
 sudo gem install bundler
73
)
74
75
# go >= 1.3
76
sudo apt-get install golang=2:1.3.3-1 || \
77
(
78
 set -e
79
 wget https://storage.googleapis.com/golang/go1.4.2.linux-amd64.tar.gz
80
 sudo tar -C /usr/local -xzf go1.4.2.linux-amd64.tar.gz
81
 cd /usr/local/bin
82
 sudo ln -s ../go/bin/* .
83
)
84
85
# phantomjs 1.9.8
86
(
87
 set -e
88
 PJS=phantomjs-1.9.8-linux-x86_64
89
 wget -P /tmp https://bitbucket.org/ariya/phantomjs/downloads/$PJS.tar.bz2
90
 sudo tar -C /usr/local -xjf /tmp/$PJS.tar.bz2
91
 sudo ln -s ../$PJS/bin/phantomjs /usr/local/bin/
92
)
93
</pre>
94
95
h2. Get the arvados source tree and test scripts
96
97
<pre>
98
cd
99
git clone https://github.com/curoverse/arvados.git
100
git clone https://github.com/curoverse/arvados-dev.git
101
</pre>
102
103
...or, if you're a committer with your public key on our git server:
104
105
<pre>
106
cd
107
git clone git@git.curoverse.com:arvados.git
108
git clone git@git.curoverse.com:arvados-dev.git
109
</pre>
110
111 5 Tom Clegg
h2. Start Postgres
112
113
_If you're running in a docker container_ you'll need to start Postgres manually:
114
115
<pre>
116
sudo /etc/init.d/postgresql start
117
</pre>
118
119 1 Tom Clegg
(If you're on a regular workstation/server/VM, startup scripts have already taken care of that for you.)
120 9 Joshua Randall
121 11 Joshua Randall
h2. Start X11
122
123
In order for the apps/workbench tests to function, firefox needs to have an X11 server (or it will fail to start). If you are on a workstation with a "real" X server, that should work. If not, Xvfb is an X server that renders to a virtual framebuffer so that selenium/firefox tests can run in headless mode. Also make sure that the DISPLAY environment variable is set accordingly.
124
125
<pre>
126
Xvfb :0.0
127
export DISPLAY=":0.0"
128
</pre>
129
130 9 Joshua Randall
h2. Setup groups
131
132
Make sure the fuse and docker groups exist (create them if necessary) and that the user who will run the tests is a member of them. 
133 5 Tom Clegg
134 13 Joshua Randall
h2. Configure git
135
136
If you are on a system with a newer git, you must set the 'push.default' behavior to 'matching'. If this is set to 'simple' (the new default), the arv-git-httpd tests will fail. 
137
<pre>
138
git config --global push.default matching
139
</pre>
140
141 1 Tom Clegg
h2. Create a Postgres user
142
143 5 Tom Clegg
Create an "arvados" user with "create database" privileges. The test suite will create and drop the arvados_test database as needed.
144 1 Tom Clegg
145
<pre>
146
newpw=`tr -cd a-zA-Z </dev/urandom |head -c32`
147
sudo -u postgres psql -c "create user arvados with createdb encrypted password '$newpw'"
148 7 Bryan Cosca
cp -i ~/arvados/services/api/config/database.yml{.sample,} # {.example,}
149 1 Tom Clegg
newpw="$newpw" perl -pi~ -e 's/xxxxxxxx/$ENV{newpw}/' ~/arvados/services/api/config/database.yml
150
</pre>
151
152
h2. Run tests
153
154
<pre>
155
time ~/arvados-dev/jenkins/run-tests.sh WORKSPACE=~/arvados
156
</pre>
157
158
During development, you'll probably want something more like this. It leaves its temp dirs in place after running tests, which allows you to save time with @--skip-install@ or @--only-install sdk/ruby@ and so on.
159
160
<pre>
161
time ~/arvados-dev/jenkins/run-tests.sh WORKSPACE=~/arvados \
162
 VENVDIR=~/.cache/arvados-venv \
163
 VENV3DIR=~/.cache/arvados-venv3 \
164
 GOPATH=~/.cache/arvados-gopath \
165
 GEMHOME=~/.cache/arvados-gemhome
166
</pre>