Project

General

Profile

Hacking prerequisites » History » Version 33

Tom Clegg, 05/05/2017 08:56 PM

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 31 Ward Vandewege
If your workstation is a debian 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 1 Tom Clegg
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 33 Tom Clegg
apt-get -y install sudo fuse
43 1 Tom Clegg
adduser me
44
adduser me sudo
45 33 Tom Clegg
adduser me fuse
46 1 Tom Clegg
sudo -u me -i
47
</pre>
48 12 Joshua Randall
49 15 Tom Clegg
The &quot;--privileged&quot; is required in order for /dev/fuse to be accessible (without it, no tests that require FUSE will work).
50 1 Tom Clegg
51
h2. Install dev environment
52
53 3 Tom Clegg
<pre>
54 19 Tom Clegg
sudo apt-get install --no-install-recommends \
55
    bison build-essential fuse gettext git gitolite3 graphviz \
56 22 Tom Clegg
    iceweasel libattr1-dev libfuse-dev libcrypt-ssleay-perl libjson-perl \
57
    libcrypt-ssleay-perl libcurl3 libcurl3-gnutls libcurl4-openssl-dev \
58
    libjson-perl libpcre3-dev libpq-dev libpython2.7-dev libreadline-dev \
59
    libssl-dev libxslt1.1 libwww-perl linkchecker lsof nginx perl-modules \
60 10 Joshua Randall
    postgresql python python-epydoc pkg-config sudo virtualenv \
61 2 Tom Clegg
    wget xvfb zlib1g-dev
62
63 32 Tom Clegg
# ruby 2.3
64 1 Tom Clegg
(
65
 set -e
66
 mkdir -p ~/src
67
 cd ~/src
68 32 Tom Clegg
 wget http://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.3.tar.gz
69
 tar xzf ruby-2.3.3.tar.gz
70
 cd ruby-2.3.3
71 1 Tom Clegg
 ./configure --disable-install-doc
72
 make
73
 sudo make install
74
 sudo gem install bundler
75
)
76
77 30 Tom Clegg
# go >= 1.7
78
sudo apt-get install golang-1.7 || \
79 1 Tom Clegg
(
80
 set -e
81 32 Tom Clegg
 wget https://storage.googleapis.com/golang/go1.8.1.linux-amd64.tar.gz
82
 sudo tar -C /usr/local -xzf go1.8.1.linux-amd64.tar.gz
83 1 Tom Clegg
 cd /usr/local/bin
84
 sudo ln -s ../go/bin/* .
85
)
86
87
# phantomjs 1.9.8
88
(
89
 set -e
90
 PJS=phantomjs-1.9.8-linux-x86_64
91
 wget -P /tmp https://bitbucket.org/ariya/phantomjs/downloads/$PJS.tar.bz2
92
 sudo tar -C /usr/local -xjf /tmp/$PJS.tar.bz2
93
 sudo ln -s ../$PJS/bin/phantomjs /usr/local/bin/
94
)
95
</pre>
96
97 20 Tom Clegg
Note: For ubuntu, virtualenv is python-virtualenv
98 18 Bryan Cosca
99 1 Tom Clegg
h2. Get the arvados source tree and test scripts
100
101
<pre>
102
cd
103
git clone https://github.com/curoverse/arvados.git
104
</pre>
105
106
...or, if you're a committer with your public key on our git server:
107
108
<pre>
109
cd
110
git clone git@git.curoverse.com:arvados.git
111
</pre>
112
113 5 Tom Clegg
h2. Start Postgres
114
115
_If you're running in a docker container_ you'll need to start Postgres manually:
116
117
<pre>
118
sudo /etc/init.d/postgresql start
119
</pre>
120
121 1 Tom Clegg
(If you're on a regular workstation/server/VM, startup scripts have already taken care of that for you.)
122 9 Joshua Randall
123 11 Joshua Randall
h2. Start X11
124
125
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.
126
127
<pre>
128 29 Tom Morris
Xvfb :0.0 &
129 11 Joshua Randall
export DISPLAY=":0.0"
130
</pre>
131
132 9 Joshua Randall
h2. Setup groups
133
134 17 Tom Clegg
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.
135 13 Joshua Randall
136 1 Tom Clegg
h2. Create a Postgres user
137
138 5 Tom Clegg
Create an "arvados" user with "create database" privileges. The test suite will create and drop the arvados_test database as needed.
139 1 Tom Clegg
140
<pre>
141
newpw=`tr -cd a-zA-Z </dev/urandom |head -c32`
142
sudo -u postgres psql -c "create user arvados with createdb encrypted password '$newpw'"
143 16 Tom Clegg
cp -i ~/arvados/services/api/config/database.yml{.example,}
144 1 Tom Clegg
newpw="$newpw" perl -pi~ -e 's/xxxxxxxx/$ENV{newpw}/' ~/arvados/services/api/config/database.yml
145
</pre>
146
147
h2. Run tests
148
149
<pre>
150 24 Ward Vandewege
time ~/arvados/build/run-tests.sh WORKSPACE=~/arvados
151 1 Tom Clegg
</pre>
152
153 14 Tom Clegg
During development, you'll probably want something more like this. It reuses the given temp directory, which avoids a lot of repetitive downloading of dependencies, and allows you to save time with @--skip-install@ or @--only-install sdk/ruby@ and so on.
154 1 Tom Clegg
155
<pre>
156 23 Tom Clegg
mkdir -p ~/.cache/arvados-build
157 24 Ward Vandewege
time ~/arvados/build/run-tests.sh WORKSPACE=~/arvados --temp ~/.cache/arvados-build
158 1 Tom Clegg
</pre>