Caliper Admin

Running a Caliper SDK server locally on your machine will require the following:

  1. Installing required software (Python, Q2 Caliper SDK, etc)

  2. Configuring that software, via a combination of environment variables and configuration files, to point at your Online environment.

To aid in this, we have created a helper script called caliper_admin. This guide covers installing and running that script.

Setup

  1. Prerequisite if using Windows (if not, continue to step 2):

    • Enable the Windows Subsystem for Linux (WSL) (https://docs.microsoft.com/en-us/windows/wsl/install) The official Microsoft docs on this are very good. If you are running into issues with startup, root password reset, etc., these docs will likely have better troubleshooting tips than we can provide.

    • Continue with the next steps from within the WSL environment

    • We recommend moving to your home directory before getting started (cd ~)

    Note

    This process is tested only against the default (Ubuntu) distribution. Running another distribution is possible, but may require you to perform extra troubleshooting.

  2. Use the Q2-provided Caliper administration script

    curl https://q2sdk-utilities.s3.amazonaws.com/caliper_admin -o caliper_admin
    chmod +x caliper_admin
    sudo mv caliper_admin /usr/local/bin
    

See the video below for a visual introduction to using the caliper_admin script:

Usage

The above steps should have caliper_admin installed in your PATH. To get started, type:

$ caliper_admin

This will present you with a list of options that differ slightly based on whether you are on Mac or Linux/WSL. Common workflows are:

Always Available

Switch Stack

The stack name requested should match what you’ve been provided in the q2developer.com dashboard. Generates a file in ~/.antilles/sdk_env_vars.sh to point at appropriate resources. This file will be optionally added to your shell’s default startup script (.bashrc/.zshrc) and will therefore run automatically each time you open your shell. To switch to a new stack, re-run this script and type in a new stack name.

Start New Project

Works with existing git repositories and starting new ones. Existing git repos will follow the normal rules, i.e. you need permissions and can use ssh or https.

Rebuild Python

Need a new Python version on your system? We got you covered. This is implicitly called by some of the other commands.

Rebuild Virtual Environment

A few reasons to run this:

  • You updated your Caliper SDK version to something that requires a new Python version

  • You’ve gotten yourself into a weird state and need to start fresh (while preserving your files)

Start memcached

Downloads our caching service, “memcached”, and runs it locally for testing of caching.

Switch Internal/External

Inside or outside Q2’s network stack, urls will differ.

Update This Script

This runs automatically when the script starts (once/24 hours) to keep this tool up to date, and is also possible to run manually.

Linux/WSL Only

Express (All in one)
  • Installs System Dependencies

  • Sets Development Stack

  • Starts a Project

Install System Dependencies

Using apt, install system-level packages such as git/gcc as well as the frontend packages nvm and yarn

Add Cert

Only relevant in WSL. In some cases, your IT/networking team may have an extra certificate added to your host machine’s chain. If you export it from Windows and put it somewhere your WSL instance can find, this command will add it to the certificate chain in WSL.

Configure for Q2 VPN (Internal)

Q2’s VPN interacts strangely with WSL. To configure your machine correctly, ensure you run WSL as Administrator, then this command will take care of the details.

Mac Only

Install Frontend Dependencies

Install npm/yarn

Gotchas For Internal Q2 Folks

  • For reasons we have not yet been able to determine, the Q2 VPN settings sometimes need to be reestablished. If you find that you are unable to hit any websites from inside your WSL instance, try restarting the WSL itself:

    #From powershell (not inside wsl)
    $ wsl -t Ubuntu