Coder Social home page Coder Social logo

micro's Introduction

Micro License GoDoc Travis CI 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 or ja-micro for Java. 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://micro.mu/blog/2016/03/20/micro.html or watch the talk from the Golang UK Conf 2016.

Follow us on Twitter at @MicroHQ or join us on Slack.

Overview

The goal of Micro is to simplify distributed systems development. Micro makes writing microservices accessible to everyone, and as you scale, 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.

  • Sidecar - A go-micro proxy. All the features of go-micro over HTTP.

  • API - An API Gateway. A single HTTP entry point. Dynamically routing HTTP requests to RPC services.

  • Web - A web UI for exploring. Plus a reverse proxy for web apps! Build your web apps as micro services.

  • CLI - A command line interface. Interact with your micro services.

  • Bot - A bot for slack and hipchat. CLI equivalent via messaging.

Docs

For more detailed information on the architecture, installation and use of the toolkit checkout the docs.

Getting Started

Writing a service

Learn how to write and run microservices using go-micro.

Read the getting started guide for more details.

Install Micro

go get -u github.com/micro/micro

Or via Docker

docker pull microhq/micro

Dependencies

Service discovery is the only dependency of the toolkit and go-micro. We use consul as the default.

Checkout go-plugins to swap out consul or any other plugins.

On Mac OS

brew install consul
consul agent -dev

For zero dependency service discovery use the built in multicast DNS plugin.

Pass --registry=mdns to the below commands e.g micro --registry=mdns list services

Example

Let's test out the CLI

Run a service

This is a greeter service written with go-micro. Make sure you're running service discovery.

go get github.com/micro/examples/greeter/srv && srv

List services

Each service registers with discovery so we should be able to find it.

micro list services

Output

consul
go.micro.srv.greeter

Get Service

Each service has a unique id, address and metadata.

micro get service go.micro.srv.greeter

Output

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

Make an RPC query via the CLI. The query is sent in json. We support json and protobuf out of the box.

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

Output

{
	"msg": "Hello John"
}

Look at the cli doc for more info.

Now let's test out the micro api

Run the api

Run the greeter API. An API service logically separates frontends from backends.

go get github.com/micro/examples/greeter/api && api

Run the micro api

The micro api is a single HTTP entry point which dynamically routes to rpc services.

micro api

Call via API

Replicating the CLI call as a HTTP call

curl http://localhost:8080/greeter/say/hello?name=John

Output

{"message":"Hello John"}

Look at the api doc for more info.

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

Learn more

To learn more read the following micro content

Community Contributions

Project Description
Micro Dashboard Dashboard for microservices toolchain micro
Ja-Micro A micro compatible java framework for microservices

Sponsors

Open source development of Micro is sponsored by Sixt

micro's People

Contributors

s8sg avatar gjrtimmer avatar arbarlow avatar burdiyan avatar margatroid avatar iheitlager avatar kevpie avatar mkozjak avatar rakanixu avatar rogerso avatar srounce avatar boyand avatar warrickcustomhomes avatar

Watchers

koalacxr avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.