Skip to content

muoncore/muon-cli

Repository files navigation

Master Build

Stable

Snapshots

Status

muon cli

NPM

Muon CLI

installs a command line tool to interact with Muon systems

Getting Started

The CLI is currently hardcoded to include the AMQP transport/ discovery

sudo npm install -g muon-cli@next
export MUON_URL=<your muon trasnport url, eg: amqp://muon:microservices@localhost:5672>
muon discover

And, if you’ve got the MUON_URL variable set correctly to a RabbitMQ hosting a muon instance, you should see something like this:

user@machine ~ $ export MUON_URL=amqp://muon:microservices@localhost:5672
user@machine ~ $ muon discover     [ or muon d ]
OK: muon cli connected: amqp://muon:microservices@localhost:5672
┌──────────────────────────────┬──────────────────────────────┬──────────────────────────────┐
│ SERVICE NAME                 │ TAGS                         │ CONTENT/TYPE                 │
├──────────────────────────────┼──────────────────────────────┼──────────────────────────────┤
│ muon-dev-tools               │ node,muon-dev-tools          │ application/json             │
├──────────────────────────────┼──────────────────────────────┼──────────────────────────────┤
│ muon-cli-99040de5-f948-48f3… │ node,muon-cli-99040de5-f948… │ application/json             │
└──────────────────────────────┴──────────────────────────────┴──────────────────────────────┘
user@machine ~ $

Muon RPC from the cli

As provided by the RPC Stack

first, run the muon-node examples service. To do this, checkout the muon-node github project:

git clone https://github.com/microserviceux/muon-node.git
cd muon-node
./examples/run-dev-tools-server.sh

Now run some rpc commands against the examples service:

muon rpc rpc://muon-dev-tools/echo "I LOVE muon"
OK: muon cli connected: amqp://muon:microservices@localhost:5672
┌────────────┬──────────────────────────────┬────────────────────────────────────────────────────────────┐
│ STATUS     │ CONTENT/TYPE                 │ BODY                                                       │
├────────────┼──────────────────────────────┼────────────────────────────────────────────────────────────┤
│ 200        │ application/json             │ I LOVE muon                                                │
└────────────┴──────────────────────────────┴────────────────────────────────────────────────────────────┘
user@machine ~ $
muon rpc rpc://muon-dev-tools/ping "ping"
OK: muon cli connected: amqp://muon:microservices@localhost:5672
┌────────────┬──────────────────────────────┬────────────────────────────────────────────────────────────┐
│ STATUS     │ CONTENT/TYPE                 │ BODY                                                       │
├────────────┼──────────────────────────────┼────────────────────────────────────────────────────────────┤
│ 200        │ application/json             │ pong                                                       │
└────────────┴──────────────────────────────┴────────────────────────────────────────────────────────────┘
muon rpc rpc://muon-dev-tools/uuid
OK: muon cli connected: amqp://muon:microservices@localhost:5672
┌────────────┬──────────────────────────────┬────────────────────────────────────────────────────────────┐
│ STATUS     │ CONTENT/TYPE                 │ BODY                                                       │
├────────────┼──────────────────────────────┼────────────────────────────────────────────────────────────┤
│ 200        │ application/json             │ 1233a532-6216-481b-816b-7fab09802072                       │
└────────────┴──────────────────────────────┴────────────────────────────────────────────────────────────┘
muon rpc rpc://muon-dev-tools/random
OK: muon cli connected: amqp://muon:microservices@localhost:5672
┌────────────┬──────────────────────────────┬────────────────────────────────────────────────────────────┐
│ STATUS     │ CONTENT/TYPE                 │ BODY                                                       │
├────────────┼──────────────────────────────┼────────────────────────────────────────────────────────────┤
│ 200        │ application/json             │ 61249                                                      │
└────────────┴──────────────────────────────┴────────────────────────────────────────────────────────────┘

Introspection

Introspection is a feature in Muon Core. It enables you to connect to a remote service and query its capabilities int erms of the protocol stacks available, the endpoints they provide and the schemas you can use to interact with them.

If you have an instance of photon connected to your muon transport, you can query the photon service like so:

muon i photon
OK: muon cli connected: amqp://tfadmin:techfutu13@msg.cistechfutures.net
{ serviceName: 'photon',
  protocols:
   [ { protocolScheme: 'rpc',
       protocolName: 'Request/ Response Protocol',
       description: 'Make a single request, get a single response',
       operations: [Object] },
     { protocolScheme: 'introspect',
       protocolName: 'Introspection Protocol',
       description: 'Provides the ability to introspect services to derive their capabilities. Built into most Muon implementations',
       operations: [] },
     { protocolScheme: 'reactive-stream',
       protocolName: 'Reactive Streaming',
       description: 'Provides the semantics of the Reactive Stream API over a muon event protocol',
       operations: [Object] },
     { protocolScheme: 'event',
       protocolName: 'Event Sink Protocol',
       description: 'Provides a discoverable sink for events to flow into without needing explicit service endpoints',
       operations: [] } ] }

License

All code is Copyright (c) Muon Core Ltd 2017.

Muon is Free Software, licensed under the terms of the LGPLv3 license as included in LICENSE

Muon has a commercial-friendly license allowing private forks and closed modifications of all projects, alongside enterprise support and extended support for enterprise technologies and patterns.

This will enable you to use Muon in any situation where your legal team will not accept a Free Software license.

Please see http://muoncore.io/pro/ for more detail. You can find the commercial license terms in COMM-LICENSE.