# Copyright (C) The Arvados Authors. All rights reserved. # # SPDX-License-Identifier: Apache-2.0 # # install-test-env.yml - Ansible playbook to set up a host to run Arvados tests # # After you run this playbook on a host, you should be able to clone the # Arvados git repository and run `build/run-tests.sh`. # As of April 2025 this has been tested to work on Debian 12. # # In order to use this playbook, you must write an Arvados `config.yml` with # PostgreSQL connection details for the `zzzzz` cluster. # `files/default-test-config.yml` has the default credentials used by tests. # You can copy that file and edit `dbname`, `user`, and `password` to taste. # Pass the path of your file to `ansible-playbook` with # `-e arvados_config_file=config.yml`. - name: Load Arvados configuration hosts: all tasks: - name: Load Arvados configuration file delegate_to: localhost ansible.builtin.include_vars: name: arvados_config file: "{{ arvados_config_file }}" - name: Load Arvados cluster configuration ansible.builtin.set_fact: arvados_cluster: "{{ arvados_config.Clusters.zzzzz }}" failed_when: arvados_cluster is undefined - hosts: all vars: arvados_dev_user: "{{ ansible_user_id }}" arvados_nodejs_version: "14.21.3" arvados_nodejs_destdir: "/opt/node-v{{ arvados_nodejs_version }}-linux-x64" tasks: - name: Bootstrap packages required for Ansible become: yes ansible.builtin.raw: "apt-get -o DPkg::Lock::Timeout=300 -qy {{ item }}" loop: - update - install acl gnupg python3-apt python3-debian xz-utils - name: Install all required development packages become: yes ansible.builtin.apt: name: # Common build and test tools - bison - ca-certificates - curl - diffutils - g++ - git - jq - libnss-systemd - make - nginx - postgresql-client - python3-dev - python3-venv - ruby - ruby-dev # Common libraries - libcurl4-openssl-dev - libssl-dev # build/run-tests.sh - bsdextrautils - net-tools # build/run-build-packages*.sh - createrepo-c - dpkg-dev # doc - linkchecker # lib/controller - rsync # lib/pam - libpam-dev # sdk/java-v2 - default-jdk-headless - gradle # sdk/R - libfontconfig1-dev - libfreetype6-dev - libfribidi-dev - libharfbuzz-dev - libjpeg-dev - libpng-dev - libtiff5-dev - libxml2-dev - r-base - r-cran-testthat # services/api - libnsl2 - libpq-dev - libyaml-dev - locales - procps - shared-mime-info - zlib1g-dev # services/fuse - fuse - libfuse-dev # services/keep-web - cadaver - mime-support # services/workbench2 # - firefox-esr - libasound2 - libgbm-dev - libgtk-3-0 - libgtk2.0-0 - libnotify-dev - libnss3 - libxss1 - libxtst6 - xauth - xvfb - ansible.builtin.include_role: name: arvados_go - ansible.builtin.include_role: name: arvados_compute vars: arvados_compute_packages: [] arvados_compute_docker: true arvados_compute_singularity: true # RailsAPI tests depend on the en_US.UTF-8 locale. # It must be generated before starting the PostgreSQL server. - name: Configure en_US.UTF-8 locale become: yes ansible.builtin.lineinfile: path: /etc/locale.gen regexp: "^[# ]*en_US.UTF-8 +UTF-8 *$" line: en_US.UTF-8 UTF-8 register: locale_gen - name: Run locale-gen when: locale_gen.changed become: yes ansible.builtin.command: cmd: locale-gen - ansible.builtin.include_role: name: arvados_postgresql vars: arvados_postgresql_config: {} arvados_postgresql_hba_sources: - "127.0.0.1/24" - "::1/128" # Workbench build dependencies - name: Install Node.js become: yes ansible.builtin.unarchive: src: "https://nodejs.org/dist/v{{ arvados_nodejs_version }}/node-v{{ arvados_nodejs_version }}-linux-x64.tar.xz" dest: "{{ arvados_nodejs_destdir|dirname }}" remote_src: yes creates: "{{ (arvados_nodejs_destdir, 'bin/node')|path_join }}" - name: Install yarn become: yes ansible.builtin.command: cmd: npm install -g yarn creates: "{{ (arvados_nodejs_destdir, 'bin/yarn')|path_join }}" environment: PATH: "{{ (arvados_nodejs_destdir, 'bin')|path_join }}:{{ ansible_env.PATH }}" - name: Add Node commands to PATH become: yes ansible.builtin.file: state: link src: "{{ (arvados_nodejs_destdir, 'bin', item)|path_join }}" dest: "{{ ('/usr/local/bin', item)|path_join }}" loop: - node - npm - yarn - yarnpkg # Configuration to run Workbench - name: Check fs.inotify.max_user_watches sysctl value ansible.builtin.command: cmd: /sbin/sysctl --values fs.inotify.max_user_watches register: max_user_watches_value - name: Increase fs.inotify.max_user_watches vars: max_user_watches_wanted: 524288 when: "max_user_watches_value.stdout|int < max_user_watches_wanted" become: yes ansible.builtin.command: argv: - sysctl - "fs.inotify.max_user_watches={{ max_user_watches_wanted }}" register: max_user_watches_set - name: Set fs.inotify.max_user_watches permanently when: max_user_watches_set.changed become: yes ansible.builtin.copy: content: | ### This file is managed by Ansible # React sets many inotify watchers and needs the limit increased. {{ max_user_watches_set.stdout }} dest: /etc/sysctl.d/arvados-workbench.conf owner: root group: root mode: 0644 - ansible.builtin.include_role: name: arvados_database vars: arvados_database_login_host: "" # Let the test user drop and recreate the database wholesale arvados_database_role_attr_flags: CREATEDB - name: Set up Arvados development user become: yes ansible.builtin.user: name: "{{ arvados_dev_user }}" groups: - docker append: yes register: dev_user - name: Set up .config/arvados become: yes become_user: "{{ arvados_dev_user }}" ansible.builtin.file: path: "{{ (dev_user.home, item)|path_join }}" state: directory loop: - .config - .config/arvados - name: Write arvados/config.yml for testing become: yes become_user: "{{ arvados_dev_user }}" ansible.builtin.copy: src: "{{ arvados_config_file }}" dest: "{{ (dev_user.home, '.config/arvados/config.yml')|path_join }}" mode: 0600 - name: Add Arvados test configuration to profile.d become: yes ansible.builtin.copy: content: | if [ -z "${CONFIGSRC:-}" ] && [ -e ~/.config/arvados/config.yml ]; then export CONFIGSRC="$HOME/.config/arvados" fi dest: /etc/profile.d/arvados-test.sh