Hacking prerequisites » History » Version 82
Brett Smith, 01/28/2025 07:38 PM
update Ansible playbook path
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 | 70 | Ward Vandewege | If your workstation is a debian buster 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 | 71 | Ward Vandewege | Another option is to create a virtual machine using something like Xen or VirtualBox, and run debian buster 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 | 55 | Peter Amstutz | _[[Arvbox]] provides a preinstalled Docker-based dev environment. The following instructions are for creating a dev environment inside Docker from scratch._ |
25 | |||
26 | 1 | Tom Clegg | 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. |
27 | |||
28 | See http://docker.io for more about installing docker. On debian it looks something like this. |
||
29 | |||
30 | <pre> |
||
31 | 54 | Tom Clegg | sudo apt-get install docker-ce |
32 | 1 | Tom Clegg | sudo adduser $USER docker |
33 | # {log out & log back in} |
||
34 | groups |
||
35 | # {should include "docker"} |
||
36 | </pre> |
||
37 | |||
38 | 69 | Ward Vandewege | Start up a new container with debian 10 (buster), make a new user and log in as that user: |
39 | 1 | Tom Clegg | |
40 | <pre> |
||
41 | 69 | Ward Vandewege | docker run -it --privileged debian:10 bash |
42 | 1 | Tom Clegg | apt-get update |
43 | 34 | Tom Clegg | apt-get -y install sudo |
44 | 1 | Tom Clegg | adduser me |
45 | 33 | Tom Clegg | adduser me sudo |
46 | 1 | Tom Clegg | sudo -u me -i |
47 | </pre> |
||
48 | 12 | Joshua Randall | |
49 | 15 | Tom Clegg | The "--privileged" 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 | 78 | Brett Smith | h3. With Ansible |
54 | |||
55 | This is a prototype still in development, but initial development was done in January 2025 and it can automate much of the process for you. |
||
56 | |||
57 | h4. Install Ansible |
||
58 | |||
59 | The simplest thing to do is @pip install@ Ansible inside a virtualenv: |
||
60 | |||
61 | <pre><code class="shell">sudo apt install python3-venv |
||
62 | python3 -m venv ~/arvados-ansible |
||
63 | ~/arvados-ansible/bin/pip install "ansible~=8.7" |
||
64 | </code></pre> |
||
65 | |||
66 | If that works, you're done and you can go on to the next section. For background: |
||
67 | |||
68 | * 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. |
||
69 | |||
70 | * 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. |
||
71 | |||
72 | h4. Write an Arvados database configuration |
||
73 | |||
74 | 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: |
||
75 | |||
76 | <pre><code class="yaml">Clusters: |
||
77 | zzzzz: |
||
78 | PostgreSQL: |
||
79 | Connection: |
||
80 | user: arvados |
||
81 | password: GoodPasswordHere |
||
82 | dbname: arvados_development |
||
83 | host: localhost |
||
84 | port: "5432" |
||
85 | </code></pre> |
||
86 | |||
87 | 79 | 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. |
88 | |||
89 | The playbook will always install the @postgresql@ server package. If you already have this installed and have configured it to listen somewhere other than the default, you may update @host@ and @port@ to reflect that. Note that @port@ is a string containing digits. |
||
90 | |||
91 | 78 | Brett Smith | h4. Write an Ansible inventory |
92 | 1 | Tom Clegg | |
93 | 81 | 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: |
94 | 78 | Brett Smith | |
95 | 1 | Tom Clegg | <pre><code class="ini">[arvados-test] |
96 | 81 | Brett Smith | # This is the list of host(s) where we're installing the test environment. |
97 | # The line below installs on the same system running Ansible. |
||
98 | # If you want to manage remote hosts, you can write your own host list: |
||
99 | # <https://docs.ansible.com/ansible/latest/getting_started/get_started_inventory.html> |
||
100 | 1 | Tom Clegg | localhost ansible_connection=local |
101 | 80 | Brett Smith | |
102 | [arvados-test:vars] |
||
103 | # The path to the Arvados cluster configuration you wrote in the previous section. |
||
104 | arvados_config_file={{ lookup('env', 'HOME') }}/arvados-ansible/zzzzz.yml |
||
105 | |||
106 | # The primary user doing Arvados development and tests. |
||
107 | # This user will be added to the `docker` group. |
||
108 | # It defaults to the name of the user running `ansible-playbook`. |
||
109 | # If you want to configure a different user, set that here: |
||
110 | 78 | Brett Smith | #arvados_dev_user=USERNAME |
111 | </code></pre> |
||
112 | |||
113 | h4. Run the playbook |
||
114 | |||
115 | 1 | Tom Clegg | The basic command to run the playbook is: |
116 | |||
117 | 82 | Brett Smith | <pre><code class="sh">cd arvados/tools/ansible |
118 | 80 | Brett Smith | ~/arvados-ansible/bin/ansible-playbook -i ~/arvados-ansible/inventory.ini -K install-test-env.yml</code></pre> |
119 | 78 | Brett Smith | |
120 | 80 | 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, you'll need to customize your @PATH@ environment variable so the Arvados versions are found first when you're doing Arvados work. |
121 | 78 | Brett Smith | |
122 | h3. Manually |
||
123 | 76 | Brett Smith | |
124 | Start with Debian 10+ and run the following commands as root. |
||
125 | 36 | Tom Clegg | |
126 | 67 | Tom Clegg | Note that the last command here ("arvados-server install -type test") installs additional debian packages 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! |
127 | 1 | Tom Clegg | |
128 | 72 | Ward Vandewege | <pre> |
129 | 75 | Tom Clegg | apt update |
130 | apt install wget ca-certificates |
||
131 | wget https://apt.arvados.org/bullseye/pool/main/a/arvados-server/arvados-server_2.4.3-1_amd64.deb |
||
132 | dpkg -i arvados-server_2.4.3-1_amd64.deb |
||
133 | arvados-server install -type test |
||
134 | 74 | Ward Vandewege | </pre> |
135 | 73 | Ward Vandewege | |
136 | 77 | Tom Clegg | Alternatively, install Go ≥ 1.20 (see https://golang.org) and git, and run arvados-server from source. |
137 | 73 | Ward Vandewege | |
138 | 1 | Tom Clegg | <pre> |
139 | 77 | Tom Clegg | wget -O- https://go.dev/dl/go1.22.1.linux-amd64.tar.gz | tar -C /usr/local -xzf - |
140 | ln -s /usr/local/go/bin/* /usr/local/bin/ |
||
141 | |||
142 | apt install git build-essential libpam-dev |
||
143 | |||
144 | 1 | Tom Clegg | cd |
145 | git clone https://git.arvados.org/arvados.git |
||
146 | 68 | Ward Vandewege | cd arvados |
147 | 67 | Tom Clegg | go mod download |
148 | 77 | Tom Clegg | go run ./cmd/arvados-server install -type test |
149 | 1 | Tom Clegg | </pre> |
150 | |||
151 | h2. Start Postgres |
||
152 | |||
153 | _If you're running in a docker container_ you'll need to start Postgres manually: |
||
154 | 9 | Joshua Randall | |
155 | 47 | Tom Clegg | <pre> |
156 | 11 | Joshua Randall | sudo /etc/init.d/postgresql start |
157 | 60 | Peter Amstutz | </pre> |
158 | |||
159 | (If you're on a regular workstation/server/VM, startup scripts have already taken care of that for you.) |
||
160 | |||
161 | h2. Setup groups |
||
162 | |||
163 | 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. |
||
164 | 1 | Tom Clegg | |
165 | h2. Run tests |
||
166 | |||
167 | <pre> |
||
168 | 67 | Tom Clegg | time ~/arvados/build/run-tests.sh WORKSPACE=~/arvados |
169 | 1 | Tom Clegg | </pre> |
170 | |||
171 | 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. |
172 | 1 | Tom Clegg | |
173 | <pre> |
||
174 | 23 | Tom Clegg | mkdir -p ~/.cache/arvados-build |
175 | 67 | Tom Clegg | time ~/arvados/build/run-tests.sh WORKSPACE=~/arvados --temp ~/.cache/arvados-build |
176 | 1 | Tom Clegg | </pre> |