Project

General

Profile

Hacking prerequisites » History » Version 54

Tom Clegg, 03/28/2019 07:06 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 54 Tom Clegg
If your workstation is a debian stretch 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 54 Tom Clegg
Another option is to create a virtual machine using something like Xen or VirtualBox, and run debian stretch on it. The instructions below assume you have just a few basic requirements:
18 1 Tom Clegg
* 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 54 Tom Clegg
sudo apt-get install docker-ce
30 1 Tom Clegg
sudo adduser $USER docker
31
# {log out & log back in}
32
groups
33
# {should include "docker"}
34
</pre>
35
36 53 Tom Clegg
Start up a new container with debian 9 (stretch), make a new user and log in as that user:
37 1 Tom Clegg
38
<pre>
39 53 Tom Clegg
docker run -it --privileged debian:9 bash
40 1 Tom Clegg
apt-get update
41 34 Tom Clegg
apt-get -y install sudo
42 1 Tom Clegg
adduser me
43 33 Tom Clegg
adduser me sudo
44 1 Tom Clegg
sudo -u me -i
45
</pre>
46 12 Joshua Randall
47 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).
48 1 Tom Clegg
49
h2. Install dev environment
50
51 3 Tom Clegg
<pre>
52 37 Tom Clegg
# only on debian 9 (stretch), to permit ruby 2.3 compilation (see https://github.com/rbenv/ruby-build/wiki#openssl-usrincludeopensslasn1_mach102-error-error-this-file-is-obsolete-please-update-your-software):
53 36 Tom Clegg
sudo apt-get install --no-install-recommends libssl1.0-dev
54
55 45 Tom Clegg
# other systems:
56
sudo apt-get install --no-install-recommends libssl-dev
57
58
# all systems:
59
60 38 Tom Clegg
sudo apt-get install --no-install-recommends \
61 22 Tom Clegg
    bison build-essential cadaver fuse gettext git gitolite3 graphviz \
62
    iceweasel libattr1-dev libfuse-dev libcrypt-ssleay-perl libjson-perl \
63 52 Tom Clegg
    libcrypt-ssleay-perl libcurl3 libcurl3-gnutls libcurl4-openssl-dev curl \
64 1 Tom Clegg
    libjson-perl libpcre3-dev libpq-dev libpython2.7-dev libreadline-dev \
65 45 Tom Clegg
    libxslt1.1 libwww-perl linkchecker lsof nginx perl-modules \
66 10 Joshua Randall
    postgresql python python-epydoc pkg-config sudo virtualenv \
67 43 Tom Clegg
    wget xvfb zlib1g-dev libgnutls28-dev python3-dev \
68 51 Tom Clegg
    r-base r-cran-testthat libxml2-dev pandoc cython bsdmainutils
69 2 Tom Clegg
70 32 Tom Clegg
# ruby 2.3
71 1 Tom Clegg
(
72
 set -e
73
 mkdir -p ~/src
74
 cd ~/src
75 50 Tom Clegg
 wget http://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.8.tar.gz
76
 tar xzf ruby-2.3.8.tar.gz
77
 cd ruby-2.3.8
78 1 Tom Clegg
 ./configure --disable-install-doc
79
 make
80
 sudo make install
81
 sudo gem install bundler
82
)
83
84 49 Tom Clegg
# go >= 1.10
85
sudo apt-get install golang-1.10 || \
86 1 Tom Clegg
(
87
 set -e
88 49 Tom Clegg
 wget https://storage.googleapis.com/golang/go1.12.1.linux-amd64.tar.gz
89
 sudo tar -C /usr/local -xzf go1.12.1.linux-amd64.tar.gz
90 1 Tom Clegg
 cd /usr/local/bin
91
 sudo ln -s ../go/bin/* .
92
)
93
94
# phantomjs 1.9.8
95
(
96
 set -e
97
 PJS=phantomjs-1.9.8-linux-x86_64
98
 wget -P /tmp https://bitbucket.org/ariya/phantomjs/downloads/$PJS.tar.bz2
99
 sudo tar -C /usr/local -xjf /tmp/$PJS.tar.bz2
100
 sudo ln -s ../$PJS/bin/phantomjs /usr/local/bin/
101
)
102 43 Tom Clegg
103 48 Tom Clegg
# geckodriver
104
(
105
 set -e
106 50 Tom Clegg
 GD=v0.24.0
107 48 Tom Clegg
 wget -P /tmp https://github.com/mozilla/geckodriver/releases/download/$GD/geckodriver-$GD-linux64.tar.gz
108
 sudo tar -C /usr/local/bin -xzf /tmp/geckodriver-$GD-linux64.tar.gz geckodriver
109
)
110
111 43 Tom Clegg
# npm
112
(
113
 set -e
114
 wget -O- https://nodejs.org/dist/v6.11.2/node-v6.11.2-linux-x64.tar.xz | sudo tar -C /usr/local -xJf -
115 1 Tom Clegg
 sudo ln -s ../node-v6.11.2-linux-x64/bin/{node,npm} /usr/local/bin/
116 43 Tom Clegg
)
117 45 Tom Clegg
</pre>
118 1 Tom Clegg
119 20 Tom Clegg
Note: For ubuntu, virtualenv is python-virtualenv
120 18 Bryan Cosca
121 1 Tom Clegg
h2. Get the arvados source tree and test scripts
122
123
<pre>
124
cd
125
git clone https://github.com/curoverse/arvados.git
126
</pre>
127
128
...or, if you're a committer with your public key on our git server:
129
130
<pre>
131
cd
132
git clone git@git.curoverse.com:arvados.git
133
</pre>
134
135 5 Tom Clegg
h2. Start Postgres
136
137
_If you're running in a docker container_ you'll need to start Postgres manually:
138
139
<pre>
140
sudo /etc/init.d/postgresql start
141
</pre>
142
143 1 Tom Clegg
(If you're on a regular workstation/server/VM, startup scripts have already taken care of that for you.)
144 9 Joshua Randall
145 47 Tom Clegg
h2. Ensure entropy
146 11 Joshua Randall
147 47 Tom Clegg
If you're running in a VM, you might run out of entropy, which will make some tests run very slowly. The easiest solution is to install haveged.
148 11 Joshua Randall
149 29 Tom Morris
<pre>
150 47 Tom Clegg
sudo apt-get install haveged
151 11 Joshua Randall
</pre>
152
153 9 Joshua Randall
h2. Setup groups
154
155 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.
156 13 Joshua Randall
157 1 Tom Clegg
h2. Create a Postgres user
158
159 5 Tom Clegg
Create an "arvados" user with "create database" privileges. The test suite will create and drop the arvados_test database as needed.
160 1 Tom Clegg
161
<pre>
162
newpw=`tr -cd a-zA-Z </dev/urandom |head -c32`
163
sudo -u postgres psql -c "create user arvados with createdb encrypted password '$newpw'"
164 16 Tom Clegg
cp -i ~/arvados/services/api/config/database.yml{.example,}
165 1 Tom Clegg
newpw="$newpw" perl -pi~ -e 's/xxxxxxxx/$ENV{newpw}/' ~/arvados/services/api/config/database.yml
166
</pre>
167
168
h2. Run tests
169
170
<pre>
171 24 Ward Vandewege
time ~/arvados/build/run-tests.sh WORKSPACE=~/arvados
172 1 Tom Clegg
</pre>
173
174 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.
175 1 Tom Clegg
176
<pre>
177 23 Tom Clegg
mkdir -p ~/.cache/arvados-build
178 24 Ward Vandewege
time ~/arvados/build/run-tests.sh WORKSPACE=~/arvados --temp ~/.cache/arvados-build
179 1 Tom Clegg
</pre>