GithubHelp home page GithubHelp logo

doytsujin / micro Goto Github PK

View Code? Open in Web Editor NEW

This project forked from micro/micro

0.0 1.0 0.0 15.54 MB

Micro is a platform for cloud native development

Home Page: https://micro.mu

License: Other

Go 64.20% Dockerfile 0.07% Shell 0.48% Makefile 0.14% PowerShell 0.09% JavaScript 31.47% Python 3.55%

micro's Introduction

Micro License Go Report Card

Overview

Micro addresses the key requirements for building services in the cloud. It leverages the microservices architecture pattern and provides a set of services which act as the building blocks of a platform. Micro deals with the complexity of distributed systems and provides simpler programmable abstractions to build on.

Contents

  • Introduction - A high level introduction to Micro
  • Getting Started - The helloworld quickstart guide
  • Upgrade Guide - Update your go-micro project to use micro v3.
  • Architecture - Describes the architecture, design and tradeoffs
  • Reference - In-depth reference for Micro CLI and services
  • Resources - External resources and contributions
  • Roadmap - Stuff on our agenda over the long haul
  • Users - Developers and companies using Micro in production
  • FAQ - Frequently asked questions
  • Blog - For the latest from us

Features

Below are the core components that make up Micro.

Server

Micro is built as a microservices architecture and abstracts away the complexity of the underlying infrastructure. We compose this as a single logical server to the user but decompose that into the various building block primitives that can be plugged into any underlying system.

The server is composed of the following services.

  • API - HTTP Gateway which dynamically maps http/json requests to RPC using path based resolution
  • Auth - Authentication and authorization out of the box using jwt tokens and rule based access control.
  • Broker - Ephemeral pubsub messaging for asynchronous communication and distributing notifications
  • Config - Dynamic configuration and secrets management for service level config without the need to restart
  • Events - Event streaming with ordered messaging, replay from offsets and persistent storage
  • Network - Inter-service networking, isolation and routing plane for all internal request traffic
  • Proxy - An identity aware proxy used for remote access and any external grpc request traffic
  • Runtime - Service lifecyle and process management with support for source to running auto build
  • Registry - Centralised service discovery and API endpoint explorer with feature rich metadata
  • Store - Key-Value storage with TTL expiry and persistent crud to keep microservices stateless

Framework

Micro additionaly now contains the incredibly popular Go Micro framework built in for service development. The Go framework makes it drop dead simple to write your services without having to piece together lines and lines of boilerplate. Auto configured and initialised by default, just import and get started quickly.

Command Line

Micro brings not only a rich architectural model but a command line experience tailored for that need. The command line interface includes dynamic command mapping for all services running on the platform. Turns any service instantly into a CLI command along with flag parsing for inputs. Includes support for multiple environments and namespaces, automatic refreshing of auth credentials, creating and running services, status info and log streaming, plus much, much more.

Environments

Finally Micro bakes in the concept of Environments and multi-tenancy through Namespaces. Run your server locally for development and in the cloud for staging and production, seamlessly switch between them using the CLI commands micro env set [environment] and micro user set [namespace].

Install

From Source

go get github.com/micro/micro/v3

Using Docker

# install
docker pull micro/micro

# run it
docker run -p 8080-8081:8080-8081/tcp micro/micro server

Helm Chart

helm repo add micro https://micro.github.io/helm
helm install micro micro/micro

Release binaries

# MacOS
curl -fsSL https://raw.githubusercontent.com/micro/micro/master/scripts/install.sh | /bin/bash

# Linux
wget -q  https://raw.githubusercontent.com/micro/micro/master/scripts/install.sh -O - | /bin/bash

# Windows
powershell -Command "iwr -useb https://raw.githubusercontent.com/micro/micro/master/scripts/install.ps1 | iex"

Getting Started

Run the server locally

micro server

Set the environment to local (127.0.0.1:8081)

micro env set local

Login to the server

# user: admin pass: micro
micro login

Create a service

# generate a service (follow instructions in output)
micro new helloworld

# run the service
micro run helloworld

# check the status
micro status

# list running services
micro services

# call the service
micro helloworld --name=Alice

# curl via the api
curl -d '{"name": "Alice"}' http://localhost:8080/helloworld

Example Service

Micro includes a Go framework for writing services wrapping gRPC for the core IDL and transport.

Define services in proto:

syntax = "proto3";

package helloworld;

service Helloworld {
	rpc Call(Request) returns (Response) {}
}

message Request {
	string name = 1;
}

message Response {
	string msg = 1;
}

Write them using Go:

package main

import (
	"context"
  
	"github.com/micro/micro/v3/service"
	"github.com/micro/micro/v3/service/logger"
	pb "github.com/micro/services/helloworld/proto"
)

type Helloworld struct{}

// Call is a single request handler called via client.Call or the generated client code
func (h *Helloworld) Call(ctx context.Context, req *pb.Request, rsp *pb.Response) error {
	logger.Info("Received Helloworld.Call request")
	rsp.Msg = "Hello " + req.Name
	return nil
}

func main() {
	// Create service
	srv := service.New(
		service.Name("helloworld"),
	)

	// Register Handler
	srv.Handle(new(Helloworld))

	// Run the service
	if err := srv.Run(); err != nil {
		logger.Fatal(err)
	}
}

Call with the client:

import (
	"context"
  
	"github.com/micro/micro/v3/service/client"
	pb "github.com/micro/services/helloworld/proto"
)

// create a new helloworld service client
helloworld := pb.NewHelloworldService("helloworld", client.DefaultClient) 

// call the endpoint Helloworld.Call
rsp, err := helloworld.Call(context.Background(), &pb.Request{Name: "Alice"})

Usage

See the docs for detailed information on the architecture, installation and use of the platform.

License

See LICENSE which makes use of Polyform Shield.

Hosting

For the hosted Micro Platform aka M3O see m3o.com.

Community

Join us in the Discussions or follow on Twitter for updates.

micro's People

Contributors

asim avatar ben-toogood avatar crufter avatar milosgajdos avatar domwong avatar printfcoder avatar vtolstov avatar github-actions[bot] avatar chrusty avatar crazybber avatar jiyeyuran avatar mgrachev avatar arbarlow avatar s8sg avatar wlun001 avatar xmlking avatar lambdar avatar hb-chen avatar three-zhang avatar clanstyles avatar alimy avatar jiusanzhou avatar refs avatar gjrtimmer avatar wuyumin avatar tboerger avatar rakanixu avatar rtmorgan avatar rogerso avatar srounce avatar

Watchers

 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.