1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: Apache-2.0
5 # install-test-env.yml - Ansible playbook to set up a host to run Arvados tests
7 # After you run this playbook on a host, you should be able to clone the
8 # Arvados git repository and run `build/run-tests.sh`.
9 # As of February 2025 this has been tested to work on Debian 11 and Debian 12.
10 # A few tests fail on Debian 12 because they haven't been adapted to newer
13 # In order to use this playbook, you must write an Arvados `config.yml` with
14 # PostgreSQL connection details for the `zzzzz` cluster.
15 # `files/default-test-config.yml` has the default credentials used by tests.
16 # You can copy that file and edit `dbname`, `user`, and `password` to taste.
17 # Pass the path of your file to `ansible-playbook` with
18 # `-e arvados_config_file=config.yml`.
20 - name: Load Arvados configuration
23 - name: Load Arvados configuration file
24 delegate_to: localhost
25 ansible.builtin.include_vars:
27 file: "{{ arvados_config_file }}"
28 - name: Load Arvados cluster configuration
29 ansible.builtin.set_fact:
30 arvados_cluster: "{{ arvados_config.Clusters.zzzzz }}"
31 failed_when: arvados_cluster is undefined
35 arvados_dev_user: "{{ ansible_user_id }}"
36 arvados_nodejs_version: "14.21.3"
37 arvados_nodejs_destdir: "/opt/node-v{{ arvados_nodejs_version }}-linux-x64"
40 - name: Bootstrap packages required for Ansible
42 ansible.builtin.raw: "apt-get -o DPkg::Lock::Timeout=300 -qy {{ item }}"
45 - install acl gnupg python3-apt python3-debian python3-psycopg2 xz-utils
46 - name: Install all required development packages
50 # Common build and test tools
67 - libcurl4-openssl-dev
72 # build/run-build-packages*.sh
82 - default-jdk-headless
108 # services/workbench2
109 # <https://docs.cypress.io/app/get-started/install-cypress#Linux-Prerequisites>
122 - ansible.builtin.include_role:
124 - ansible.builtin.include_role:
125 name: arvados_compute
127 arvados_compute_packages: []
128 arvados_compute_docker: true
129 arvados_compute_singularity: true
131 # RailsAPI tests depend on the en_US.UTF-8 locale.
132 # It must be generated before starting the PostgreSQL server.
133 - name: Configure en_US.UTF-8 locale
135 ansible.builtin.lineinfile:
136 path: /etc/locale.gen
137 regexp: "^[# ]*en_US.UTF-8 +UTF-8 *$"
138 line: en_US.UTF-8 UTF-8
140 - name: Run locale-gen
141 when: locale_gen.changed
143 ansible.builtin.command:
145 - ansible.builtin.include_role:
146 name: arvados_postgresql
148 arvados_postgresql_hba_users: "{{ arvados_cluster.PostgreSQL.Connection.user }}"
149 arvados_postgresql_hba_databases: "{{ arvados_cluster.PostgreSQL.Connection.dbname }}"
150 arvados_postgresql_hba_sources:
154 # Workbench build dependencies
155 - name: Install Node.js
157 ansible.builtin.unarchive:
158 src: "https://nodejs.org/dist/v{{ arvados_nodejs_version }}/node-v{{ arvados_nodejs_version }}-linux-x64.tar.xz"
159 dest: "{{ arvados_nodejs_destdir|dirname }}"
161 creates: "{{ (arvados_nodejs_destdir, 'bin/node')|path_join }}"
164 ansible.builtin.command:
165 cmd: npm install -g yarn
166 creates: "{{ (arvados_nodejs_destdir, 'bin/yarn')|path_join }}"
168 PATH: "{{ (arvados_nodejs_destdir, 'bin')|path_join }}:{{ ansible_env.PATH }}"
169 - name: Add Node commands to PATH
171 ansible.builtin.file:
173 src: "{{ (arvados_nodejs_destdir, 'bin', item)|path_join }}"
174 dest: "{{ ('/usr/local/bin', item)|path_join }}"
180 # Configuration to run Workbench
181 - name: Check fs.inotify.max_user_watches sysctl value
182 ansible.builtin.command:
183 cmd: /sbin/sysctl --values fs.inotify.max_user_watches
184 register: max_user_watches_value
185 - name: Increase fs.inotify.max_user_watches
187 max_user_watches_wanted: 524288
188 when: "max_user_watches_value.stdout|int < max_user_watches_wanted"
190 ansible.builtin.command:
193 - "fs.inotify.max_user_watches={{ max_user_watches_wanted }}"
194 register: max_user_watches_set
195 - name: Set fs.inotify.max_user_watches permanently
196 when: max_user_watches_set.changed
198 ansible.builtin.copy:
200 ### This file is managed by Ansible
201 # React sets many inotify watchers and needs the limit increased.
202 {{ max_user_watches_set.stdout }}
203 dest: /etc/sysctl.d/arvados-workbench.conf
208 - ansible.builtin.include_role:
209 name: arvados_database
211 arvados_database_name: "{{ arvados_cluster.PostgreSQL.Connection.dbname }}"
212 arvados_database_user_name: "{{ arvados_cluster.PostgreSQL.Connection.user }}"
213 arvados_database_user_password: "{{ arvados_cluster.PostgreSQL.Connection.password }}"
214 # Let the test user drop and recreate the database wholesale
215 arvados_database_role_attr_flags: CREATEDB
217 - name: Set up Arvados development user
219 ansible.builtin.user:
220 name: "{{ arvados_dev_user }}"
225 - name: Set up .config/arvados
227 become_user: "{{ arvados_dev_user }}"
228 ansible.builtin.file:
229 path: "{{ (dev_user.home, item)|path_join }}"
234 - name: Write arvados/config.yml for testing
236 become_user: "{{ arvados_dev_user }}"
237 ansible.builtin.copy:
238 src: "{{ arvados_config_file }}"
239 dest: "{{ (dev_user.home, '.config/arvados/config.yml')|path_join }}"
241 - name: Add Arvados test configuration to profile.d
243 ansible.builtin.copy:
245 if [ -z "${CONFIGSRC:-}" ] && [ -e ~/.config/arvados/config.yml ]; then
246 export CONFIGSRC="$HOME/.config/arvados"
248 dest: /etc/profile.d/arvados-test.sh