Skip to content

An ansible role that installs the Materials Cloud jupyter environment.

License

Notifications You must be signed in to change notification settings

marvel-nccr/ansible-role-aiidalab

Repository files navigation

CI Ansible Role Release

Ansible Role: marvel-nccr.aiidalab

An ansible role that installs the Materials Cloud AiiDA Lab components.

The AiiDA Lab server can be launched either by running the /usr/local/bin/aiida-aiidalab executable in the terminal, or double-clicking on the AiiDa Lab desktop short-cut (when installed on a non-headless VM).

This role is dependent on the marvel-nccr.aiida role, for installing the initial aiida and jupyter environments, and also nodejs should be installed independently.

Installation

ansible-galaxy install marvel-nccr.aiidalab

Role Variables

See defaults/main.yml

Example Playbook

- hosts: servers
  vars:
    aiida_venv: "${HOME}/.virtualenvs/aiida"
    aiida_venv_constraints: "${HOME}/.local/share/aiida/constraints.txt"
    aiida_jupyter_venv: "${HOME}/.virtualenvs/aiida"
  tasks:
  - name: Install nodejs 12.x
    include_role:
      name: geerlingguy.nodejs
    vars:
      nodejs_version: 12.x
      nodejs_install_npm_user: root
  - name: Install aiida
    include_role:
      name: marvel-nccr.aiida
  - name: Install AiiDA Lab
    include_role:
      name: marvel-nccr.aiidalab
    vars:
      aiidalab_aiida_venv: "{{ aiidalab_aiida_venv }}"
      aiidalab_aiida_venv_constraints: "{{ aiida_venv_constraints }}"
      aiidalab_jupyter_venv: "{{ aiida_jupyter_venv }}"

Note: When building a Docker container, the variable jupyter_ip: "0.0.0.0" should be set, for aiida-aiidalab to correctly expose the port.

Development and testing

This role uses Molecule and Docker for tests.

After installing Docker:

Clone the repository into a package named marvel-nccr.aiidalab (the folder must be named the same as the Ansible Galaxy name)

git clone https://github.com/marvel-nccr/ansible-role-aiidalab marvel-nccr.aiidalab
cd marvel-nccr.aiidalab

Then run:

pip install -r requirements.txt  # Installs molecule
molecule test  # runs tests

or use tox (see tox.ini):

pip install tox
tox

To manually test the created docker container, first run:

tox converge

This will run the ansible role, leaving the container running. The recommended way to interact with the container is then to use the VS Code Docker extension. Using this you can then attach a visual studio code instance:

VS Code Docker extension

Inside the container run aiida-jupyterlab or aiida-aiidalab, and you will be able to access the supplied URLs from your local browser.

When you are finished with the container, destroy the container with:

tox destroy

Code style

Code style is formatted and linted with pre-commit.

pip install pre-commit
pre-commit run -all

Deployment

Deployment to Ansible Galaxy is automated via GitHub Actions. Simply tag a release vX.Y.Z to initiate the CI and release workflow. Note, the release will only complete if the CI tests pass.

License

MIT

Contact

Please direct inquiries regarding Quantum Mobile and associated ansible roles to the AiiDA mailinglist.

About

An ansible role that installs the Materials Cloud jupyter environment.

Resources

License

Stars

Watchers

Forks

Packages

No packages published