github.com/Rakanixu/micro/web

A microservice toolkit


License
Apache-2.0
Install
go get github.com/Rakanixu/micro/web

Documentation

Micro License GoDoc Travis CI Roadmap Go Report Card

Micro is a microservice toolkit. It simplifies writing and running distributed systems.

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

Learn more about Micro in the introductory blog post https://blog.micro.mu/2016/03/20/micro.html.

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

Overview

The goal of Micro is to provide a toolkit for microservice development and management. At the core, micro is simple and accessible enough that anyone can easily get started writing microservices. As you scale to hundreds of services, micro will provide the fundamental tools required to manage a microservice environment.

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 - The Sidecar provides all the features of go-micro as a HTTP service. 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.

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.

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 (default discovery mechanism; checkout go-plugins to switch it out).

$ go get github.com/hashicorp/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 example app

$ go get github.com/micro/micro/examples/greeter/server
$ server
2016/06/20 03:03:39 Listening on [::]:62525
2016/06/20 03:03:39 Broker Listening on [::]:62526
2016/06/20 03:03:39 Registering node: go.micro.srv.greeter-34c55534-368b-11e6-b732-68a86d0d36b6

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 more on how to use the Micro CLI

The Ecosystem

The overarching project github.com/micro is a microservice ecosystem which consists of a number of tools and libraries. Each of which can either be used totally independently, plugged into your architecture or combined as a whole to provide a completely distributed systems platform.

It currently consists of the following.

Go Micro

Go-micro is a pluggable Go client framework for writing microservices. Go-micro can be used standalone and should be the starting point for writing applications.

Feature Description
Registry Service discovery
Client RPC Client
Codec Request/Response Encoding
Selector Load balancing
Server RPC Server
Broker Asynchronous Messaging
Transport Synchronous Messaging

Micro

Micro provides entry points into a running system with an API Gateway, Web UI, HTTP Sidecar and CLI. Micro can be used to manage the public facing aspect of your services and will normally run at the edge of your infrastructure.

Feature Description
API Gateway Lightweight gateway/proxy. Convert http requests to rpc
CLI Command line interface
Sidecar HTTP proxy for non Go-micro apps
Web UI/Proxy A visual way to view and query services
Bot A bot that sits inside Slack, HipChat, etc for ChatOps

Go Platform

Go-platform provides pluggable libraries for integrating with higher level requirements for microservices. It mainly integrates functionality for distributed systems.

Feature Description
auth authentication and authorisation for users and services
config dynamic configuration which is namespaced and versioned
db distributed database abstraction
discovery extends the go-micro registry to add heartbeating, etc
event platform event publication, subscription and aggregation
kv simply key value layered on memcached, etcd, consul
log structured logging to stdout, logstash, fluentd, pubsub
monitor add custom healthchecks measured with distributed systems in mind
metrics instrumentation and collation of counters
router global circuit breaking, load balancing, A/B testing
sync distributed locking, leadership election, etc
trace distributed tracing of request/response

Platform

Platform is a complete runtime for managing microservices at scale. Where Micro provides the core essentials, the platform goes a step further and addresses every requirement for large scale distributed system deployments.

Feature Description
Auth Authentication and authorization (Oauth2)
Config Dynamic configuration
DB Proxy RPC based database proxy
Discovery Service discovery read layer cache
Events Platform event aggregation
Monitoring Monitoring for Status, Stats and Healthchecks
Routing Global service load balancing
Tracing Distributed tracing

Go Plugins

Go Plugins provides plugins for go-micro and go-platform contributed by the community. Examples could include; circuit breakers, rate limiting. Registries built on top of Kubernetes, Zookeeper, etc. Transport using HTTP2, Zeromq, etc. Broker using Kafka, AWS SQS, etc.

Example plugins

Plugin Description
NATS Synchronous transport with the NATS message bus
Etcd Service discovery using etcd
BSON-RPC Request/Response encoding using bson-rpc

Example Services

Project Description
greeter A greeter service (includes Go, Ruby, Python examples)
geo-srv Geolocation tracking service using hailocab/go-geoindex
geo-api A HTTP API handler for geo location tracking and search
discovery-srv A discovery in the micro platform
geocode-srv A geocoding service using the Google Geocoding API
hailo-srv A service for the hailo taxi service developer api
monitor-srv A monitoring service for Micro services
place-srv A microservice to store and retrieve places (includes Google Place Search API)
slack-srv The slack bot API as a go-micro RPC service
trace-srv A distributed tracing microservice in the realm of dapper, zipkin, etc
twitter-srv A microservice for the twitter API
user-srv A microservice for user management and authentication

Community Contributions

Project Description
Micro Dashboard Dashboard for microservices toolchain micro

Sponsors

Roadmap

Roadmap

License

Apache 2.0

Contributing

  1. Join the Slack to discuss
  2. Look at existing coding style
  3. Submit PR
  4. ?
  5. Profit

We're looking for implementations equivalent to go-micro in different languages. Come join the Slack to discuss.