The Command Line Interface (CLI) can be used by administrators to carryout a host of actions (e.g., add a tenant, add a network partition, and more).

Follow the instructions below to configure the CLI tool:

If you have not started Stratos already, make sure to first start Stratos before carrying out these instructions. For more information, see the Quick Installation Guide.

  1. Download the CLI binary distribution (apache-stratos-cli-version-SNAPSHOT.zip) and unzip it.

    This can be done using any of the following methods:

    • Method 1 - Download the Stratos CLI binary distribution from Apache Download Mirrors and unzip it. 

    • Methods 2 - Obtain the Stratos CLI binary distribution from the following directory in the Stratos source distribution and unzip it.
      <STRATOS_SOURCE_HOME>/products/stratos-cli/distribution/target/

      The CLI binary distribution will only be available in the Stratos source distribution after Stratos is built from the source.

  2. Export the host and port of Stratos Manager (SM) as environment variables before using the CLI tool.
    • On Mac OS X you need to add the following to your .bash_profile file
.
    • On Linux you need to add the following to your .bashrc file.

      export STRATOS_URL=https://<STRATOS-MANAGER-IP>:<PORT>

      For example:

      export STRATOS_URL=https://localhost:9443
  3. Ensure that your Java home and Java path  environmental variables have been set in your .bash_profile (on Mac) or .bashrc (on Linux) file.

  4. Navigate to the  apache-stratos-cli-version-SNAPSHOT/bin/  directory.

    cd apache-stratos-cli-<VERSION>-SNAPSHOT/bin
  5. Add execute permissions to the script.

    chmod +x ./stratos.sh
  6. Optionally, you can export your username and password as environment variables.

    If you only export your username, you will be prompted to enter your password.

    export STRATOS_USERNAME=<username>
    export STRATOS_PASSWORD=<password>
  7. Log into the CLI tool using the following command:

    CommandScenario
    ./stratos.sh -u admin -p admin
    If you have not exported your username and password.
    ./stratos.sh -p admin
    If you have only exported your username.
    ./stratos.sh
    If you have exported your username and password or if you wish to be prompted for your username and password later.

    For more information on how to use the CLI tool, see the CLI Tool Guide.

  • No labels