CLI

micro cli

The micro cli is a command line interface for the micro toolkit micro.

Getting Started

Install

  1. go get github.com/micro/micro

Interactive Mode

To use the cli as an interactive prompt

  1. micro cli

Remove micro from the below commands when in interactive mode

Example Usage

List Services

  1. micro list services

Get Service

  1. micro get service go.micro.srv.example

Output

  1. go.micro.srv.example
  2. go.micro.srv.example-fccbb6fb-0301-11e5-9f1f-68a86d0d36b6 [::] 62421

Call Service

  1. micro call go.micro.srv.example Example.Call '{"name": "John"}'

Output

  1. {
  2. "msg": "go.micro.srv.example-fccbb6fb-0301-11e5-9f1f-68a86d0d36b6: Hello John"
  3. }

Service Health

  1. micro health go.micro.srv.example

Output

  1. node address:port status
  2. go.micro.srv.example-fccbb6fb-0301-11e5-9f1f-68a86d0d36b6 [::]:62421 ok

Register/Deregister

  1. micro register service '{"name": "foo", "version": "bar", "nodes": [{"id": "foo-1", "address": "127.0.0.1", "port": 8080}]}'
  1. micro deregister service '{"name": "foo", "version": "bar", "nodes": [{"id": "foo-1", "address": "127.0.0.1", "port": 8080}]}'

Proxy Remote Env

Proxy remote environments using the micro proxy

When developing against remote environments you may not have direct access to service discovery which makes it difficult to use the CLI. The micro proxy provides a http proxy for such scenarios.

Run the proxy in your remote environment

  1. micro proxy

Set the env var MICRO_PROXY_ADDRESS so the cli knows to use the proxy

  1. MICRO_PROXY_ADDRESS=staging.micro.mu:8081 micro list services

Usage

  1. NAME:
  2. micro - A cloud-native toolkit
  3. USAGE:
  4. micro [global options] command [command options] [arguments...]
  5. VERSION:
  6. 0.8.0
  7. COMMANDS:
  8. api Run the micro API
  9. bot Run the micro bot
  10. registry Query registry
  11. call Call a service or function
  12. query Deprecated: Use call instead
  13. stream Create a service or function stream
  14. health Query the health of a service
  15. stats Query the stats of a service
  16. list List items in registry
  17. register Register an item in the registry
  18. deregister Deregister an item in the registry
  19. get Get item from registry
  20. proxy Run the micro proxy
  21. new Create a new micro service by specifying a directory path relative to your $GOPATH
  22. web Run the micro web app