Hacking prerequisites » History » Revision 67
Revision 66 (Peter Amstutz, 03/13/2020 02:36 PM) → Revision 67/77 (Tom Clegg, 04/07/2020 08:52 PM)
{{>toc}} h1. Hacking prerequisites The Arvados test suite can run in a Docker container, a VM, or your workstation -- provided a few prerequisites are satisfied. h2. Host options h3. Starting on your workstation 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". Other linux distributions should work too with some modifications, but it's probably easier to use a VM. h3. Starting on a VM 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: * SSH server * sudo (@apt-get install sudo@) * A user account with sudo privileges h3. Starting in a docker container _[[Arvbox]] provides a preinstalled Docker-based dev environment. The following instructions are for creating a dev environment inside Docker from scratch._ 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. See http://docker.io for more about installing docker. On debian it looks something like this. <pre> sudo apt-get install docker-ce sudo adduser $USER docker # {log out & log back in} groups # {should include "docker"} </pre> Start up a new container with debian 9 (stretch), make a new user and log in as that user: <pre> docker run -it --privileged debian:9 bash apt-get update apt-get -y install sudo adduser me adduser me sudo sudo -u me -i </pre> The "--privileged" is required in order for /dev/fuse to be accessible (without it, no tests that require FUSE will work). h2. Install dev environment Run the following commands as root. Note that the last command here ("arvados-server install -type test") installs additional <pre> # only on debian packages 9 (stretch), to your system, along with additional software in /var/lib/arvados/ (such as suitable versions of Ruby and Go) that do not interfere with system packages. It also creates a postgresql database user named "arvados" with an insecure password. Don't expose this postgresql server to the internet or to untrusted users! 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): sudo apt-get install --no-install-recommends libssl1.0-dev <pre> # other systems: sudo apt-get install --no-install-recommends libssl-dev # all systems: sudo apt-get install --no-install-recommends \ bison build-essential ca-certificates cadaver fuse gettext git golang gitolite3 graphviz \ iceweasel libattr1-dev libfuse-dev libcrypt-ssleay-perl libjson-perl \ libcrypt-ssleay-perl libcurl3 libcurl3-gnutls libcurl4-openssl-dev curl \ libjson-perl libpcre3-dev libpq-dev libpython2.7-dev libreadline-dev \ libxslt1.1 libwww-perl linkchecker lsof net-tools nginx perl-modules \ postgresql postgresql-contrib python python-epydoc pkg-config sudo virtualenv \ wget xvfb zlib1g-dev libgnutls28-dev python3-dev libpam-dev \ r-base r-cran-testthat libxml2-dev pandoc cython bsdmainutils # ruby 2.5 ( set -e mkdir -p ~/src cd git clone https://git.arvados.org/arvados.git ~/src wget https://cache.ruby-lang.org/pub/ruby/2.5/ruby-2.5.7.tar.gz tar xzf ruby-2.5.7.tar.gz cd arvados ruby-2.5.7 ./configure --disable-install-doc make sudo make install sudo gem install bundler ) # go mod download >= 1.13 go sudo apt-get install golang-1.13 || \ ~/go/bin/arvados-server install -type ( set -e wget https://storage.googleapis.com/golang/go1.13.6.linux-amd64.tar.gz sudo tar -C /usr/local -xzf go1.13.6.linux-amd64.tar.gz cd /usr/local/bin sudo ln -s ../go/bin/* . ) # phantomjs 1.9.8 ( set -e PJS=phantomjs-1.9.8-linux-x86_64 wget -P /tmp https://bitbucket.org/ariya/phantomjs/downloads/$PJS.tar.bz2 sudo tar -C /usr/local -xjf /tmp/$PJS.tar.bz2 sudo ln -s ../$PJS/bin/phantomjs /usr/local/bin/ ) # geckodriver ( set -e GD=v0.24.0 wget -P /tmp https://github.com/mozilla/geckodriver/releases/download/$GD/geckodriver-$GD-linux64.tar.gz sudo tar -C /usr/local/bin -xzf /tmp/geckodriver-$GD-linux64.tar.gz geckodriver ) # NodeJS v8.15.1 ( set -e wget -O- https://nodejs.org/dist/v8.15.1/node-v8.15.1-linux-x64.tar.xz | sudo tar -C /usr/local -xJf - sudo ln -s ../node-v8.15.1-linux-x64/bin/{node,npm} /usr/local/bin/ ) </pre> Note: For ubuntu, virtualenv is python-virtualenv h2. Get the arvados source tree and test scripts <pre> cd git clone https://github.com/curoverse/arvados.git </pre> ...or, if you're a committer with your public key on our git server: <pre> cd git clone git@git.curoverse.com:arvados.git </pre> h2. Start Postgres _If you're running in a docker container_ you'll need to start Postgres manually: <pre> sudo /etc/init.d/postgresql start </pre> (If you're on a regular workstation/server/VM, startup scripts have already taken care of that for you.) h2. Ensure entropy 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. <pre> sudo apt-get install haveged </pre> h2. Setup groups 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. h2. Create a Postgres user Create an "arvados" user with "create database" privileges. The test suite will create and drop the arvados_test database as needed. <pre> newpw=`tr -cd a-zA-Z </dev/urandom |head -c32` sudo -u postgres psql -c "create user arvados with superuser encrypted password '$newpw'" mkdir ~/arvados-test-config cat > ~/arvados-test-config/config.yml <<EOF Clusters: zzzzz: PostgreSQL: Connection: client_encoding: utf8 dbname: arvados_test host: localhost password: $newpw user: arvados EOF </pre> h2. Run tests <pre> time ~/arvados/build/run-tests.sh WORKSPACE=~/arvados CONFIGSRC=~/arvados-test-config </pre> 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. <pre> mkdir -p ~/.cache/arvados-build time ~/arvados/build/run-tests.sh WORKSPACE=~/arvados CONFIGSRC=~/arvados-test-config --temp ~/.cache/arvados-build </pre>