morpheus cli

CLI Utility for Interfacing with the Morpheus API

14
5
Ruby

Morpheus CLI

This library is a Ruby gem that provides a command line interface for interacting with the Morpheus Data appliance. The features provided include provisioning clusters, hosts, and containers, deploying and monitoring applications, automating tasks, and much more.

Installation

Install it using rubygems

gem install morpheus-cli

Or add this line to your application’s Gemfile:

gem 'morpheus-cli'

And then execute:

bundle install

Usage

morpheus command

This gem installs the morpheus binary for running commands in your terminal shell.

morpheus remote add
morpheus instances list

ruby code

If you are interested in interfacing with the Morpheus appliance in ruby directly, you can use Morpheus::APIClient or Morpheus::Terminal.

For more detailed usage information, visit the Morpheus CLI Wiki.

Development

New API interfaces get added under the library directory: lib/morpheus/api/.
New CLI commands get added under the library directory: lib/morpheus/cli/commands/.

While developing, you can quickly reload your code changes in a morpheus shell while developing:

bundle exec morpheus shell —debug

Then to reload changes without restarting the morpheus shell (and the ruby process), use:

reload

Don’t forget to add unit tests for your new commands under the directory: test/.

Testing

To run the CLI unit tests, first create a test_config.yaml and then run rake test.

Prepare Test Environment

Create a test_config.yaml like this:

touch test_config.yaml

Enter your test environment url and credentials in test_config.yaml like so:

url: 'http://localhost:8080'
username: testrunner
password: 'SecretPassword123$' 

Run Tests

rake test