skip to navigation
skip to content

conductr-cli 1.1.0

A CLI client for Lightbend ConductR

Command Line Interface (CLI) for Lightbend ConductR

Installation

There are two types of installation:

  • “native” where we have pre-built a native package for Windows, Linux and OS X requiring no other dependencies; and
  • “python” where you must install Python 3 and use pip3 to install it.

Install natively

Lightbend hosts native images at bintray: https://bintray.com/lightbend/generic/conductr-cli. Download an archive that is suitable for your environment and then place the resultant package in a place accessible from your PATH. For example, on Unix, copy the contents of archive to your /usr/local/bin folder.

Install using Python

Install the conductr-cli with pip3. Depending on your OS the command is:

macOS

pip3 install conductr-cli

Linux

Install the conductr-cli package as you have installed other pip3 package. To install the package for all users, use:

sudo pip3 install conductr-cli

To install it only for the current user, use:

pip3 install --user conductr-cli

Windows

pip install conductr-cli

Upgrade using pip3

The conductr-cli can be updated by using the pip3 -U option:

macOS

pip3 install -U conductr-cli

Linux

Install the conductr-cli package as you have installed other pip3 package. To install the package for all users, use:

sudo pip3 install -U conductr-cli

To install it only for the current user, use:

pip3 install --user -U conductr-cli

Windows

pip install -U conductr-cli

Setup Bintray credentials

Bundles and ConductR images are hosted on Bintray. Please ensure that your Bintray credentials that have access to the Lightbend repositories are located at: .lightbend/commercial.credentials.

How to get a Bintray account that has access to the Lightbend repositories is described at: http://developers.lightbend.com/docs/reactive-platform/2.0/setup/setup-sbt.html

CLI Usage

sandbox

Execute sandbox with any of the supported sub-commands or options, e.g.

$ sandbox -h
usage: sandbox [-h] {version,run,stop} ...

To start a ConductR sandbox cluster with 3 nodes and the visualization feature run:

sandbox run <CONDUCTR_VERSION> --nr-of-instances 3 --feature visualization

Pick up the latest ConductR version from https://www.lightbend.com/product/conductr/developer

To stop this cluster run:

sandbox stop

conduct

Execute conduct with any of the supported sub-commands or options, e.g.

$ conduct -h
usage: conduct [-h]
              {version,info,service-names,acls,load,run,stop,unload,events,logs,setup-dcos}
              ...

Most sub-commands connect to a ConductR instance and therefore you have to specify its IP and port. This can be done in different ways. You can specify the IP via the --host option and the port via the --port option. Alternatively, you can set the environment variables CONDUCTR_HOST and CONDUCTR_PORT. Default values will be used if both are not set. The port defaults to 9005. By default, the IP address will be automatically resolved to the sandbox host IP.

Here’s an example for loading a bundle:

conduct load sbt-conductr-tester-1.0.0-e172570d3c0fb11f4f9dbb8de519df58dcb490799f525bab43757f291e1d104d.zip

Note that when specifying IPV6 addresses then you must surround them with square brackets e.g.:

conduct info --host [fe80:0000:0000:0000:0cb3:e2ff:fe74:902d]

To enable HTTP Basic Authentication, provide the following settings file in the ~/.conductr/settings.conf.

conductr {
  auth {
    enabled  = true
    username = "steve"
    password = "letmein"
  }
  server_ssl_verification_file = "/home/user/validate-server.pem"
}
When the switch enabled is set to true, HTTP Basic Authentication is enabled. Set to false to disable.
Set the username and password accordingly. The server_ssl_verification_file points to an absolute path of the file used to validate the SSL cert of the server.

If HTTP Basic Authentication is enabled then the CLI will send HTTP requests using HTTPS instead of HTTP.

shazar

The shazar command can be used:

  • for packaging a directory that has a structure of a bundle to a bundle archive;
  • for packaging a bundle’s configuration to a bundle archive;

In both cases the source files are zipped and a SHA256 digest of the archive is appended to the bundle archive file name.

For pointers on command usage run shazar -h.

Developers

> Note that we presently package the dcos library as source. When https://github.com/dcos/dcos-cli/pull/823 becomes available then we should remove this directory and depend on it directly.

For macOS, you should ensure firstly that you have the latest Xcode command line tools installed:

xcode-select --install

Now, install the latest python3 version on your system, on macOS use:

brew install python3

The tests executing the tests in multiple python versions. For all OS environments, pyenv is used to support multiple installations of python during testing. On macOS, use brew to install pyenv:

brew install pyenv

Installation instructions for other OS can be found at https://github.com/yyuu/pyenv. With pyenv installed you can do things like pyenv local 3.4.3 or pyenv local system. Don’t forget to update your login profile to setup pyenv (the doc describes how).

After pyenv has been installed, add python 3.4. On macOS use:

CFLAGS="-I$(brew --prefix openssl)/include" \
LDFLAGS="-L$(brew --prefix openssl)/lib" \
pyenv install -v 3.4.5
pyenv install -v 3.5.2

For others OS this is easier:

pyenv install -v 3.4.5
pyenv install -v 3.5.2

Make sure to install the tox module for multi-environment testing:

pip3 install tox

Afterwards, install the necessary dependencies for each environment, ensure that the .tox is not present and to set the python versions for conductr-cli:

pip3 install .
rm -rf .tox
pyenv local system 3.4.5 3.5.2

Running

If you want to run conduct or sandbox locally, i.e. without installation, cd into the project directory and execute:

pip3 install -e .
conduct
sandbox

Tests

Execute the following command to run unit tests for the current version of python3:

python3 -m unittest

Execute the following command to run all defined tests:

tox

Python Compatibility

ConductR CLI supports Python 3.4 and above.

When using standard or third-party libraries, always ensure the implementation is compatible with Python 3.4.

When browsing the latest Python 3 documentation or arriving to a documentation page from a search result, be sure to check the Python version of the documentation page.

When using a method, check if there’s a mention of whether it has been introduced after Python 3.4.

Releasing

CLI releases to the pip3 repository can be performed completely from the GitHub project page. Follow these steps to cut a release:

  1. Edit conductr_cli/__init__.py file to contain the version to be released.
  2. Create a new release on the Github releases page.

After CI build is finished for the tagged commit, new version will automatically be deployed to PyPi repository.

Native

Ensure correct system requirement is used for each target platform.

For MacOS: - OSX version 10.11: native executables built on 10.11 will be compatible with 10.12, but the reverse is not true. - Python version 3.5.

For Linux: - Ubuntu version 14.04.5 LTS. - Python version 3.4.

For Windows: - Windows 7 - Python version 3.5.

Pyinstaller version 3.2.1 or above is required. Please visit http://www.pyinstaller.org/ to obtain instructions on how to install it.

Ensure the native executables are built from tagged release commit.

To build native packages follow the form:

pyinstaller --onefile conductr_cli/conduct.py
pyinstaller --onefile conductr_cli/shazar.py
pyinstaller --hidden-import psutil --onefile conductr_cli/sandbox.py

This will result in standalone images for your current environment being created in a dist folder.

Ensure correct versions are built.

./dist/sandbox version
./dist/conduct version

For MacOS and Linux, perform sanity check by running:

./dist/sandbox run 2.0.0 -f visualization
./dist/conduct info
./dist/shazar -h

For Windows, perform the following since the sandbox command is not supported:

./dist/conduct info --host [host of some running ConductR]
./dist/shazar -h
 
File Type Py Version Uploaded on Size
conductr-cli-1.1.0.tar.gz (md5) Source 2017-03-21 163KB