Alpaca Command Line Interface

Introduction

The Alpaca CLI is an optional client for the Alpaca Server that provides easy access to a number of useful provisioning tools. The CLI connects via HTTP to the server and works in tandem with the web interface to increase productivity.

Installation

Prerequisites

Process

  1. Download the Alpaca CLI tarball(.tar.gz) to the /opt directory on the server.
  2. Extract the archive.
    • cd /opt
    • tar xzvf /opt/alpaca-cli-<BW_VERSION>-<RELEASE_VERSION>-bin.tar.gz
  3. Create a symlink to the new alpaca directory.
    • ln -s /opt/alpaca-cli-<BW_VERSION>-<RELEASE_VERSION> /opt/alpaca-cli
  4. Create an alpaca user.
    • useradd -m alpaca
  5. Change the ownership of the /opt/alpaca-cli directory and all of its children.
    • chown -R alpaca:alpaca /opt/alpaca-cli/
  6. Copy the license file from the ECG portal ecg.license.txt into the config directory.
  7. Perform configuration according to Alpaca CLI configuration guide.
  8. Copy the alpaca-cli file into /etc/init.d.
  9. Run the following commands:
    1. chkconfig --add alpaca-cli
    2. chkconfig alpaca-cli on
  10. Launch service with service alpaca-cli start.

Configuration

Configurations can be modified in the application.yml file located in the config directory.

  • server-scheme - The scheme to use to connect to the alpaca server, i.e. http, https
  • server-address - The address of the alpaca server.
  • server-port - The port to use to connect to the alpaca server.
  • 'ssl-permissive' - Whether or not to be permissive with insecure SSL (such as self-signed certificates).
alpaca:
  cli:
    server-scheme: http
    server-address: localhost
    server-port: 8080
    ssl-permissive: true

Usage

Launch the Alpaca CLI from your terminal using ./alpaca-cli. Once Alpaca has launched, you will need to log in.

Logging In

An Alpaca User (configured in the Alpaca Web Interface) is required to log in to the CLI.

Once the application has started, use the login command to log in as an Alpaca User.

login [username] [password]

A successful login will return true and the CLI prompt.

Commands

Once logged in, the CLI command will become available.

Locations

Some CLI commands are accessible globally (from every location) others require that you be at a particular location to be able to run.

Global System Commands
    cd: Changes the current directory into the target location
    count: Retrieves count of objects at the current location.
    get: Retrieves the objects from the current location.
    login: Login to the Alpaca Server
    logout: Logout of the Alpaca Server
    web-socket-connect: Connects to the Alpaca WebSocket.
    web-socket-disconnect: Disconnects the Alpaca WebSocket.
    clear: Clear the shell screen.
    exit, quit: Exit the shell.
    help: Display help about available commands.
    script: Read and execute commands from a file.
    stacktrace: Display the full stacktrace of the last error.
Cluster
    import-service-provider: Imports a Service Provider to the Cluster
Service Provider
    export-service-provider: Exports a Service Provider
    import-group: Imports a Group into the Service Provider
    migrate-service-provider: Migrates a Service Provider
Group
   export-group: Exports a Group
   import-user: Imports a User into the Group
   migrate-group: Migrates a Group
User
   export-user: Exports a User
   migrate-user: Migrates a User

Help

The help command can be used anywhere in the application. Typing help will give you a list of all commands. Note that commands marked with an * are unavailable at your current location. Typing help <command> will provide you with detailed information about the specific command.

Example
Alpaca/:> help login


NAME
    login - Login to the Alpaca Server

SYNOPSYS
    login [--username] string  [--password] string  

OPTIONS
    --username  string

        [Mandatory]

    --password  string

        [Mandatory]