micro

command module
v0.0.0-...-1d706ad Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 4, 2017 License: Apache-2.0 Imports: 10 Imported by: 0

README

Micro License GoDoc Travis CI Roadmap Go Report Card

Micro is a microservice toolkit. Its purpose is to simplify distributed systems development.

Check out go-micro if you want to start writing services in Go now. Examples of how to use micro with other languages can be found in examples/sidecar.

Learn more about Micro in the introductory blog post https://blog.micro.mu/2016/03/20/micro.html or watch the talk from the Golang UK Conf 2016.

Follow us on Twitter at @MicroHQ, join the Slack community here or check out the Mailing List.

Overview

The goal of Micro is to simplify distributed systems development. At the core micro should be accessible enough to anyone who wants to get started writing microservices. As you scale to hundreds of services, micro will provide the necessary tooling to manage a microservice environment.

The toolkit is composed of the following components:

Go Micro - A pluggable RPC framework for writing microservices in Go. It provides libraries for service discovery, client side load balancing, encoding, synchronous and asynchronous communication.

API - An API Gateway that serves HTTP and routes requests to appropriate micro services. It acts as a single entry point and can either be used as a reverse proxy or translate HTTP requests to RPC.

Web - A web dashboard and reverse proxy for micro web applications. We believe that web apps should be built as microservices and therefore treated as a first class citizen in a microservice world. It behaves much the like the API reverse proxy but also includes support for web sockets.

Sidecar - A language agnostic RPC proxy which provides all the features of go-micro as a HTTP endpoints. While we love Go and believe it's a great language to build microservices, you may also want to use other languages, so the Sidecar provides a way to integrate your other apps into the Micro world. It can be used as a standalone way to build fault tolerant microservices.

CLI - A straight forward command line interface to interact with your micro services. It also allows you to leverage the Sidecar as a proxy where you may not want to directly connect to the service registry.

Bot A Hubot style bot that sits inside your microservices platform and can be interacted with via Slack, HipChat, XMPP, etc. It provides the features of the CLI via messaging. Additional commands can be added to automate common ops tasks.

Read the docs for more details.

Getting Started

Writing a service

Learn how to write and run a microservice using go-micro.

Read the Getting Started guide or the blog post on Writing microservices with Go-Micro.

Install Micro
go get github.com/micro/micro

Or via Docker

docker pull microhq/micro
Quick start

We need service discovery, so let's spin up Consul (the default); checkout go-plugins to swap it out).

Install consul

brew install consul

Run consul

consul agent -dev -advertise=127.0.0.1

Alternatively we can use multicast DNS with the built in MDNS registry for a zero dependency configuration. Just pass --registry=mdns to the below commands e.g. server --registry=mdns or micro --registry=mdns list services.

Run the greeter service

go run examples/greeter/server/main.go

List services

$ micro list services
consul
go.micro.srv.greeter

Get Service

$ micro get service go.micro.srv.greeter
service  go.micro.srv.greeter

version 1.0.0

Id	Address	Port	Metadata
go.micro.srv.greeter-34c55534-368b-11e6-b732-68a86d0d36b6	192.168.1.66	62525	server=rpc,registry=consul,transport=http,broker=http

Endpoint: Say.Hello
Metadata: stream=false

Request: {
	name string
}

Response: {
	msg string
}

Query service

$ micro query go.micro.srv.greeter Say.Hello '{"name": "John"}'
{
	"msg": "Hello John"
}

Read the docs to learn more.

Build with plugins

If you want to integrate plugins simply link them in a separate file and rebuild

Create a plugins.go file

import (
	// etcd v3 registry
	_ "github.com/micro/go-plugins/registry/etcdv3"
	// nats transport
	_ "github.com/micro/go-plugins/transport/nats"
	// kafka broker
	_ "github.com/micro/go-plugins/broker/kafka"

Build binary

// For local use
go build -i -o micro ./main.go ./plugins.go

// For docker image
CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags '-w' -i -o micro ./main.go ./plugins.go

Flag usage of plugins

micro --registry=etcdv3 --transport=nats --broker=kafka

Community Contributions

Project Description
Micro Dashboard Dashboard for microservices toolchain micro

Sponsors

Open source development of Micro is sponsored by Sixt

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
api
Package api is an API Gateway
Package api is an API Gateway
proto
Package go_micro_api is a generated protocol buffer package.
Package go_micro_api is a generated protocol buffer package.
bot
Package bot is a Hubot style bot that sits a microservice environment
Package bot is a Hubot style bot that sits a microservice environment
command
Package command is an interface for defining bot commands
Package command is an interface for defining bot commands
input
Package input is an interface for bot inputs
Package input is an interface for bot inputs
Package car is a language agnostic rpc proxy
Package car is a language agnostic rpc proxy
Package cli is a command line interface
Package cli is a command line interface
examples
booking/api/hotel/proto
Package hotel is a generated protocol buffer package.
Package hotel is a generated protocol buffer package.
booking/srv/auth/proto
Package auth is a generated protocol buffer package.
Package auth is a generated protocol buffer package.
booking/srv/geo/proto
Package geo is a generated protocol buffer package.
Package geo is a generated protocol buffer package.
booking/srv/profile/proto
Package profile is a generated protocol buffer package.
Package profile is a generated protocol buffer package.
booking/srv/rate/proto
Package rate is a generated protocol buffer package.
Package rate is a generated protocol buffer package.
greeter/api/rpc/proto/hello
Package go_micro_api_greeter is a generated protocol buffer package.
Package go_micro_api_greeter is a generated protocol buffer package.
greeter/server/proto/hello
Package go_micro_srv_greeter is a generated protocol buffer package.
Package go_micro_srv_greeter is a generated protocol buffer package.
sidecar/go
+build main1
+build main1
template/api/proto/example
Package go_micro_api_template is a generated protocol buffer package.
Package go_micro_api_template is a generated protocol buffer package.
template/srv/proto/example
Package go_micro_srv_template is a generated protocol buffer package.
Package go_micro_srv_template is a generated protocol buffer package.
internal
Package new generates micro service templates
Package new generates micro service templates
Package web is a web dashboard and reverse proxy for micro web apps
Package web is a web dashboard and reverse proxy for micro web apps

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL