Set up

Overview

This tutorial explains how to install and set up the Blue Brain Nexus CLI to connect to a Blue Brain Nexus deployment.

Note

Let’s get started.

Install the CLI

Since the CLI is written in python, you may want to create a virtual environment for a clean set up. To do so, Conda can be used. If you don’t have it installed follow the instructions here.

conda create -n nexus-cli python=3.5
conda activate nexus-cli
pip install git+https://github.com/BlueBrain/nexus-cli

Connect to a Nexus deployment

Configure the CLI to point to a specific Blue Brain Nexus deployment

To ease the usage of the CLI, we will create a profile named ‘tutorial’ storing locally various configurations such as the Nexus deployment url.

Command
nexus profiles create tutorial https://sandbox.bluebrainnexus.io/v1 && nexus profiles select tutorial && nexus profiles list
Full source at GitHub
Output
Profile created.
Selected profile: tutorial
+------------+----------+--------------------------------------+-------+
| Profile    | Selected | URL                                  | Token |
+------------+----------+--------------------------------------+-------+
| tutorial   |   Yes    | https://sandbox.bluebrainnexus.io/v1 |  None |
+------------+----------+--------------------------------------+-------+
Full source at GitHub

Login

A bearer token is needed to authenticate to Nexus. For the purpose of this tutorial, you’ll login using your github account.

The following command will open (after pressing enter button) a browser window from where you can login using your github account.

Command
nexus auth login
Full source at GitHub
Output
A browser window will now open, please login, copy your token and use the auth set-token command to store it in the CLI
Press ENTER to continue...
Full source at GitHub

From the opened web page, click on the login button on the right corner and follow the instructions.

login-ui

At the end you’ll see a token button on the right corner. Click on it to copy the token.

login-ui

The token can now be added to the tutorial profile. In the output of the following command you should see that the token column has now an expiry date.

Command
nexus auth set-token $TOKEN && nexus profiles list
Full source at GitHub
Output
+--------------+----------+-------------------------------------+-----------------------------+
| Profile      | Selected | URL                                 |            Token            |
+--------------+----------+-------------------------------------+-----------------------------+
| tutorial     |   Yes    | https://sandbox.bluebrainnexus.io/v1         | Expiry: YYYY-MM-DD HH:mm:s |
+--------------+----------+-------------------------------------+-----------------------------+
Full source at GitHub

That’s it!

Clone the tutorial github project

cd ~
git clone https://github.com/BlueBrain/nexus-bbp-domains.git
cd ~/nexus-bbp-domains
git checkout docs
cd src/main/paradox/docs/bbptutorial