Project

General

Profile

Hacking prerequisites » History » Version 84

Brett Smith, 02/13/2025 04:23 PM
fix header levels

1 1 Tom Clegg
{{>toc}}
2
3
h1. Hacking prerequisites
4
5 83 Brett Smith
This page describes how to install all the software necessary to develop Arvados and run tests.
6 1 Tom Clegg
7
h2. Host options
8
9 83 Brett Smith
You must have a system running a supported distribution. That system can be installed directly on hardware; running on a cloud instance; or in a virtual machine.
10 1 Tom Clegg
11 83 Brett Smith
h3. Supported distributions
12 1 Tom Clegg
13 83 Brett Smith
As of February 2025/Arvados 3.0, these instructions and the entire test suite are known to work on Debian 11 "bullseye." They mostly work on Debian 12 "bookworm," but a small handful of tests fail because they haven't been adapted to newer software yet.
14 1 Tom Clegg
15 83 Brett Smith
You may try to run these instructions and tests on Ubuntu 20.04 "focal"/22.04 "jammy"/24.04 "noble," but they have not been tested and you are likely to hit some bugs throughout.
16 1 Tom Clegg
17 83 Brett Smith
These instructions are not suitable for any Red Hat-based distribution and many tests would fail on them.
18 1 Tom Clegg
19 83 Brett Smith
h3. Base configuration
20 1 Tom Clegg
21 83 Brett Smith
On your development system, you should have a user account with full permission to use sudo.
22 1 Tom Clegg
23 83 Brett Smith
You can run the Ansible playbook to install your development system on a different system. To do this, you must have permission to SSH into your user account from the system running Ansible (the "control node") to the development system you're installing (the "target node").
24 69 Ward Vandewege
25 83 Brett Smith
h3. Virtual machine requirements
26 1 Tom Clegg
27 83 Brett Smith
If you run your development system in a virtual machine, it needs some permissions. Many environments will allow these operations by default, but they could be limited by your virtual machine setup.
28 1 Tom Clegg
29 83 Brett Smith
* It must be able to create and manage FUSE mounts (@/dev/fuse@)
30
* It must be able to create and run Docker containers
31
* It must be able to create and run Singularity containers—this requires creating and managing block loopback devices (@/dev/block-loop@)
32
* It must have the @fs.inotify.max_user_watches@ sysctl set to at least 524288. Our Ansible playbook will try to set this on the managed host, but if it is unable to do so, you may need to set it on the parent host instead.
33 78 Brett Smith
34 83 Brett Smith
h2. Install development environment with Ansible
35 78 Brett Smith
36 83 Brett Smith
h3. Install Ansible
37 78 Brett Smith
38
The simplest thing to do is @pip install@ Ansible inside a virtualenv:
39
40
<pre><code class="shell">sudo apt install python3-venv
41
python3 -m venv ~/arvados-ansible
42
~/arvados-ansible/bin/pip install "ansible~=8.7"
43 1 Tom Clegg
</code></pre>
44
45 83 Brett Smith
If that works, you're done and you can go on to the next section. There are "other installation options":https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html if you can't do this for some reason.
46 1 Tom Clegg
47 83 Brett Smith
For background, the Arvados Ansible playbooks are tested with Ansible 8, which we use for its Python version compatibility. Older versions are known not to work. You're welcome to try newer versions if you want to for any reason, but they haven't been tested.
48 78 Brett Smith
49 83 Brett Smith
h3. Write an Arvados database configuration
50 78 Brett Smith
51
Next, write an Arvados configuration file that defines how you want to set up the PostgreSQL database. Write a file @~/arvados-ansible/zzzzz.yml@ like this:
52 1 Tom Clegg
53
<pre><code class="yaml">Clusters:
54
  zzzzz:
55
    PostgreSQL:
56 78 Brett Smith
      Connection:
57
        user: arvados
58
        password: GoodPasswordHere
59 83 Brett Smith
        dbname: arvados_test
60 78 Brett Smith
        host: localhost
61 1 Tom Clegg
        port: "5432"
62 78 Brett Smith
</code></pre>
63 1 Tom Clegg
64 83 Brett Smith
The cluster ID *must* be @zzzzz@. You can change the @user@, @password@, and @dbname@ settings freely. Our Ansible playbook will configure PostgreSQL so your settings here work.
65 1 Tom Clegg
66 83 Brett Smith
The playbook will always install the @postgresql@ server package. It will *not* change any PostgreSQL configuration except to add @pg_hba.conf@ entries for this user. You should only change @host@ and @port@ if you need to use a PostgreSQL server that is already installed and running somewhere else.
67 1 Tom Clegg
68 84 Brett Smith
h3. Write an Ansible inventory
69 1 Tom Clegg
70 78 Brett Smith
An inventory file tells Ansible what host(s) to manage, how to connect to them, and what settings they use. Write an inventory file to @~/arvados-ansible/inventory.ini@ like this:
71 1 Tom Clegg
72
<pre><code class="ini">[arvados-test]
73
# This is the list of host(s) where we're installing the test environment.
74 78 Brett Smith
# The line below installs on the same system running Ansible.
75 1 Tom Clegg
# If you want to manage remote hosts, you can write your own host list:
76
# <https://docs.ansible.com/ansible/latest/getting_started/get_started_inventory.html>
77 78 Brett Smith
localhost ansible_connection=local
78 79 Brett Smith
79 1 Tom Clegg
[arvados-test:vars]
80 80 Brett Smith
# The path to the Arvados cluster configuration you wrote in the previous section.
81
arvados_config_file={{ lookup('env', 'HOME') }}/arvados-ansible/zzzzz.yml
82
83
# The primary user doing Arvados development and tests.
84 72 Ward Vandewege
# This user will be added to the `docker` group.
85 75 Tom Clegg
# It defaults to the name of the user running `ansible-playbook`.
86
# If you want to configure a different user, set that here:
87
#arvados_dev_user=USERNAME
88 83 Brett Smith
89
# The authentication mechanism to allow in `pg_hba.conf`.
90
# The default is `scram-sha-256`, which is the most secure method on the most
91
# recent versions of PostgreSQL.
92
# If your development system is running Debian 11, set this to `md5` here.
93
#arvados_postgresql_hba_method=md5
94 1 Tom Clegg
</code></pre>
95 77 Tom Clegg
96 84 Brett Smith
h3. Run the playbook
97 77 Tom Clegg
98 83 Brett Smith
The playbook is available from the @tools/ansible@ directory of the Arvados source tree. If you don't already have a checkout of the Arvados source, get it by running:
99
100
<pre><code class="sh">git clone https://git.arvados.org/arvados.git ~/arvados</code></pre>
101
102 68 Ward Vandewege
The basic command to run the playbook is:
103 67 Tom Clegg
104 77 Tom Clegg
<pre><code class="sh">cd arvados/tools/ansible
105 83 Brett Smith
~/arvados-ansible/bin/ansible-playbook -K -i ~/arvados-ansible/inventory.ini install-test-env.yml</code></pre>
106 1 Tom Clegg
107 83 Brett Smith
@ansible-playbook@ has many options to control how it runs that you can add if you like. Refer to "the @ansible-playbook@ documentation":https://docs.ansible.com/ansible/latest/cli/ansible-playbook.html for more information.
108 1 Tom Clegg
109 83 Brett Smith
After the playbook runs successfully, you should be able to run the Arvados tests from a source checkout on your development host. e.g.,
110 9 Joshua Randall
111 83 Brett Smith
<pre><code class="sh">cd arvados
112
WORKSPACE="$PWD" build/run-tests.sh --temp ~/arvados-test --interactive
113
</code></pre>
114 60 Peter Amstutz
115 83 Brett Smith
Refer to [[Running tests]] for details.
116 60 Peter Amstutz
117 84 Brett Smith
h3. Troubleshooting
118 60 Peter Amstutz
119 83 Brett Smith
The playbook writes your database configuration at @~/.config/arvados/config.yml@ and sets up a hook @/etc/profile.d/arvados-test.sh@ to set your @CONFIGSRC@ environment variable to that directory. If most tests fail with a database connection error, check that this variable is set:
120 1 Tom Clegg
121 83 Brett Smith
<pre>$ echo "${CONFIGSRC:-UNSET}"
122
/home/you/.config/arvados
123 1 Tom Clegg
</pre>
124 67 Tom Clegg
125 83 Brett Smith
If that reports @UNSET@, add a line to set @CONFIGSRC="$HOME/.config/arvados"@ to your shell configuration, or set it manually when you run @run-tests.sh@:
126 1 Tom Clegg
127 83 Brett Smith
<pre><code class="sh">WORKSPACE="$PWD" CONFIGSRC="$HOME/.config/arvados" build/run-tests.sh ...
128
</code></pre>
129 1 Tom Clegg
130 84 Brett Smith
h3. Notes
131 67 Tom Clegg
132 83 Brett Smith
The playbook will install symlinks for Go, Node, Singularity, and Yarn under @/usr/local/bin@. The actual tools are installed under @/opt@. If you need different versions of these tools for other work on this system, you'll need to customize your @PATH@ environment variable so the Arvados versions are found first when you're doing Arvados work.