Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/micro/micro
API first development platform
https://github.com/micro/micro
go micro
Last synced: 24 days ago
JSON representation
API first development platform
- Host: GitHub
- URL: https://github.com/micro/micro
- Owner: micro
- License: apache-2.0
- Created: 2015-01-16T22:35:14.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2024-04-01T05:43:57.000Z (about 2 months ago)
- Last Synced: 2024-04-14T02:33:09.859Z (about 1 month ago)
- Topics: go, micro
- Language: Go
- Homepage: https://micro.dev
- Size: 20 MB
- Stars: 11,992
- Watchers: 319
- Forks: 1,039
- Open Issues: 42
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Lists
- awesome-go - micro - A distributed systems runtime for the cloud and beyond. (Distributed Systems / Search and Analytic Databases)
- awesome-microservices - Micro - A distributed systems runtime for the cloud and beyond. (Service Toolkits / Go)
- awesome-go - micro - A distributed systems runtime for the cloud and beyond. (Distributed Systems / Search and Analytic Databases)
- awesome-stars - micro/micro
- awesome-go-extra - micro - 01-16T22:35:14Z|2022-08-22T15:31:34Z| (Distributed Systems / Advanced Console UIs)
- awesome-go-cn - micro
- my-awesome-stars - micro
- awesome-go - micro - A distributed systems runtime for the cloud and beyond. (Distributed Systems / Search and Analytic Databases)
- awesome-stars - micro
- awesome-stars - micro
- awesome - micro/micro - A Go service development platform (Go)
- go-awesome - Micro - 微服务工具 (开源类库 / 微服务)
- awesome-go - micro - A distributed systems runtime for the cloud and beyond. Stars:`12.0K`. (Distributed Systems / Search and Analytic Databases)
- awesome-list - micro/micro - A Go service development platform (Go)
- awesome-stars - micro/micro - A Go service development platform (go)
- awesome - micro/micro - A Go service development platform (Go)
- go-collection - micro
- awesome-repositories - micro/micro - A Go service development platform (Go)
- awesome-go-cn - micro
- awesome-go - Micro - distributed cloud platform. 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. (Micro services frameworks)
- awesome-go - micro - A distributed systems runtime for the cloud and beyond. (Distributed Systems / Search and Analytic Databases)
- fucking-awesome-go - :octocat: micro - A pluggable microservice toolkit and distributed systems platform. :star: 2099 :fork_and_knife: 113 (Distributed Systems / Advanced Console UIs)
- awesome-go-projects - micro - A distributed systems runtime for the cloud and beyond. (Distributed Systems / Standard CLI)
- awesome-go - micro - A distributed systems runtime for the cloud and beyond. (Distributed Systems / Advanced Console UIs)
- awesome-stars - micro
- awesome-go - micro - Pluggable microservice toolkit and distributed systems platform. (Distributed Systems / Advanced Console UIs)
- awesome-go - micro - | - | - | (Distributed Systems / Advanced Console UIs)
- awesome-stars - micro/micro - A Go service development platform (Go)
- awesome-go - micro - A pluggable microservice toolkit and distributed systems platform. (Distributed Systems / Advanced Console UIs)
- awesome-stars - micro/micro - A Go service development platform (Go)
- awesome-go-with-framework - micro - Pluggable microservice toolkit and distributed systems platform. (Distributed Systems / Advanced Console UIs)
- awesome-stars - micro/micro - A Go service development platform (Go)
- awesome-go - micro - A distributed systems runtime for the cloud and beyond. (Distributed Systems / Search and Analytic Databases)
- go-awesome-cn-star - micro
- my-awesome-stars - micro/micro - A Go service development platform (Go)
- awesome-go-cn - micro
- awesome-stars - micro
- awesome-microservices - Micro - A microservices toolchain in Go. (Service Toolkits / Go)
- awesome - micro - A microservice runtime environment (Go)
- awesome-stars - micro/micro - API first development platform (Go)
- awesome-go - micro - Pluggable microservice toolkit and distributed systems platform. (Distributed Systems / Advanced Console UIs)
- awesome-stars - micro/micro - API first development platform (Go)
- awesome-go - micro - 可插拔微型服务工具包和分布式系统平台。 (<span id="分布式系统-distributed-systems">分布式系统 Distributed Systems</span> / <span id="高级控制台用户界面-advanced-console-uis">高级控制台用户界面 Advanced Console UIs</span>)
- awesome-go. - micro - Pluggable microservice toolkit and distributed systems platform. (Distributed Systems / Advanced Console UIs)
- awesome-go-cn - micro - 微服务工具套件和分布式系统平台 (分布式系统 / 高级控制台界面)
- awesome-star - micro/micro
- awesome-Char - micro - A distributed systems runtime for the cloud and beyond. (Distributed Systems / Advanced Console UIs)
- awesome-go-with-stars - micro - A distributed systems runtime for the cloud and beyond. (Distributed Systems / Search and Analytic Databases)
- awesome-projects - micro - A microservice runtime environment (Go)
- awesome-go - micro - A distributed systems runtime for the cloud and beyond. (Distributed Systems / Advanced Console UIs)
- awesome-stars - micro - A microservice toolkit for distributed systems development (Go)
- repo-1316-awesome-go-cn - micro
- awesome-stars - micro/micro - API first development platform (Go)
- repo-1211-awesome-go-cn - micro
- awesome-go - micro/micro
- awesome-reader - micro - Pluggable microservice toolkit and distributed systems platform. (Distributed Systems / Advanced Console UIs)
- awesome-go - micro - Pluggable microservice toolkit and distributed systems platform. (Distributed Systems / Advanced Console UIs)
- awesome-go-stars - micro(stars: 11989) - A distributed systems runtime for the cloud and beyond. (Distributed Systems / Search and Analytic Databases)
- Go-awesome - micro - A distributed systems runtime for the cloud and beyond. (Distributed Systems / Search and Analytic Databases)
- awesome-go - micro - A pluggable microservice toolkit and distributed systems platform. (Distributed Systems / Advanced Console UIs)
- fucking-awesome-microservices - Micro - A distributed systems runtime for the cloud and beyond. (Service Toolkits / Go)
- awesome-go-cn - micro
- awesome-from-stars - micro/micro
- awesome-go-zh - micro
- awesome-go-handwritten - micro - Pluggable microservice toolkit and distributed systems platform. (Distributed Systems / Advanced Console UIs)
- awesome-stars - micro - Micro is a platform for cloud native development (Go)
- awesome-go - micro - 微服務工具套件和分佈式系統平台 (分佈式系統 / 高級控制台界面)
- awesome-list-microservice - micro - native toolkit (rpc)
- go-awesome - Micro - Microservice tools (Open source library / Microservices)
- awesome-go2 - micro - Pluggable microservice toolkit and distributed systems platform. (Distributed Systems / Advanced Console UIs)
- awesome-go - micro - Pluggable microservice toolkit and distributed systems platform. (Distributed Systems / Advanced Console UIs)
- awesome-go - micro - A distributed systems runtime for the cloud and beyond. (Distributed Systems / Search and Analytic Databases)
- awesome-go - micro - Pluggable microservice toolkit and distributed systems platform. - :arrow_down:0 - :star:2352 (Distributed Systems / Advanced Console UIs)
- awesome-go - micro - A distributed systems runtime for the cloud and beyond. (Distributed Systems / Advanced Console UIs)
- awesome-go - micro - A pluggable microservice toolkit and distributed systems platform. (Distributed Systems / Advanced Console UIs)
- awesome-stars - micro - Micro is a microservices runtime for the Cloud (Go)
- go-awesome - Micro - 微服务工具 (开源类库 / 微服务)
- my-awesome-stars - micro/micro - API first development platform (Go)
- my-stars - micro/micro - A Go service development platform (Go)
- awesome-go-cn - micro
- awesome-stars - micro/micro - `★12025` A Go service development platform (Go)
- awesome-go - micro - A distributed systems runtime for the cloud and beyond. (Distributed Systems / Search and Analytic Databases)
- awesome-go - micro - A distributed systems runtime for the cloud and beyond. (Distributed Systems / Search and Analytic Databases)
- go-collection - micro
- awesome-stars - micro/micro - A Go service development platform (Go)
- awesome-stars - micro/micro - A Go service development platform (Go)
- awesome-go - micro - A cloud-native toolkit - ★ 5018 (Distributed Systems)
README
# Micro
Micro is an API first development platform. It addresses the core requirements for building services in the cloud by providing a set of APIs which act as the building blocks of any platform. Micro deals with the complexity of distributed systems and provides simpler programmable abstractions for developers to build on.
## Overview
## Architecture
Below are the core components that make up Micro
### Server
Micro is built as a microkernel architecture. It abstracts away the complexity of the underlying infrastructure by providing
a set of building block services composed as a single logical server for the end user to consume.The server consists of the following services
- **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 reload
- **Events** - Event streaming with ordered messaging, replay from offsets and persistent storage
- **Network** - service-to-service networking and control plane for all internal request traffic
- **Runtime** - Service lifecycle 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### API
The server embeds a HTTP API (on port 8080) which can be used to make requests as simple JSON.
The API automatically maps HTTP Paths and POST requests to internal RPC service names and endpoints.### Proxy
Additionally there's a gRPC proxy (on port 8081) which used to make requests via the CLI or externally.
The proxy is identity aware which means it can be used to gatekeep remote access to Micro running anywhere.### Framework
Micro comes with a built in Go framework for service based development.
The framework lets you write services without piecing together endless lines of boilerplate code.
Configured and initialised by default, import it and get started.### Command Line
The command line interface includes dynamic command mapping for all services running on the platform. It turns any service instantly into a CLI command along with flag parsing
for inputs. Includes support for environments, namespaces, creating and running services, status info and logs.### Remote Environments
Micro bakes in the concept of `Environments`. Run your server locally for development and in the cloud for production,
seamlessly switch between them using the CLI command `micro env set [environment]`.## Install
### From Source
```
make build
```### Prebuilt Binaries
#### Windows
```sh
powershell -Command "iwr -useb https://raw.githubusercontent.com/micro/micro/master/scripts/install.ps1 | iex"```
#### Linux```sh
wget -q https://raw.githubusercontent.com/micro/micro/master/scripts/install.sh -O - | /bin/bash
```#### MacOS
```sh
curl -fsSL https://raw.githubusercontent.com/micro/micro/master/scripts/install.sh | /bin/bash
```### Run the server
The server starts with a single command ready to use
```sh
micro server
```Now go to [localhost:8080](http://localhost:8080) and make sure the output is something like `{"version": "v3.10.1"}`.
## Usage
Set the environment e.g local
```
micro env set local
```### Login to Micro
Default username/password: `admin/micro`
```sh
$ micro login
Enter username: admin
Enter password:
Successfully logged in.
```See what's running:
```sh
$ micro services
auth
broker
config
events
network
registry
runtime
store
```### Create a Service
Generate a service using the template
```
micro new helloworld
```Output
```
Creating service helloworld.
├── main.go
├── handler
│ └── helloworld.go
├── proto
│ └── helloworld.proto
├── Makefile
├── README.md
├── .gitignore
└── go.moddownload protoc zip packages (protoc-$VERSION-$PLATFORM.zip) and install:
visit https://github.com/protocolbuffers/protobuf/releases
compile the proto file helloworld.proto:
cd helloworld
make init
go mod vendor
make proto
```### Making changes
Edit the protobuf definition in `proto/helloworld.proto` and run `make proto` to recompile
Go to `handler/helloworld.go` to make changes to the response handler
```go
type Helloworld struct{}func New() *Helloworld {
return &Helloworld{}
}func (h *Helloworld) Call(ctx context.Context, req *pb.Request, rsp *pb.Response) error {
rsp.Msg = "Hello " + req.Name
return nil
}
```### Run the service
Run from local dir
```
micro run .
```Or from a git url
```sh
micro run github.com/micro/services/helloworld
```### Check service status
```sh
$ micro status
NAME VERSION SOURCE STATUS BUILD UPDATED METADATA
helloworld latest github.com/micro/services/helloworld running n/a 4s ago owner=admin, group=micro
```### View service logs
```sh
$ micro logs helloworld
2020-10-06 17:52:21 file=service/service.go:195 level=info Starting [service] helloworld
2020-10-06 17:52:21 file=grpc/grpc.go:902 level=info Server [grpc] Listening on [::]:33975
2020-10-06 17:52:21 file=grpc/grpc.go:732 level=info Registry [service] Registering node: helloworld-67627b23-3336-4b92-a032-09d8d13ecf95
```### Call via CLI
```sh
$ micro helloworld call --name=Jane
{
"msg": "Hello Jane"
}
```### Call via API
```
curl "http://localhost:8080/helloworld/Call?name=John"
```### Call via RPC
An RPC client is used within a service and must be run by micro
```go
package mainimport (
"context"
"fmt"
"time""micro.dev/v4/service"
pb "github.com/micro/services/helloworld/proto"
)func callService(hw pb.HelloworldService) {
for {
// call an endpoint on the service
rsp, err := hw.Call(context.Background(), &pb.CallRequest{
Name: "John",
})
if err != nil {
fmt.Println("Error calling helloworld: ", err)
return
}// print the response
fmt.Println("Response: ", rsp.Message)time.Sleep(time.Second)
}
}func main() {
// create and initialise a new service
srv := service.New(
service.Name("caller"),
)// new helloworld client
hw := pb.NewHelloworldService("helloworld", srv.Client())
// run the client caller
go callService(hw)
// run the service
service.Run()
}
```Run it
```
micro run .
```### Call via Go
Get your user token
```
export TOKEN=`micro user token`
```Call helloworld
```go
package mainimport (
"fmt"
"os""github.com/micro/micro-go"
)type Request struct {
Name string `json:"name"`
}type Response struct {
Msg string `json:"msg"`
}func main() {
token := os.Getenv("TOKEN")
c := micro.NewClient(nil)// set your api token
c.SetToken(token)req := &Request{
Name: "John",
}
var rsp Responseif err := c.Call("helloworld", "Call", req, &rsp); err != nil {
fmt.Println(err)
return
}
fmt.Println(rsp)
}
```Run it
```
go run main.go
```### Call via JS
```js
const micro = require('micro-js-client');new micro.Client({ token: process.env.TOKEN })
.call('helloworld', 'Call', {"name": "Alice"})
.then((response) => {
console.log(response);
});
```## Get Started
For more see the [getting started](https://micro.dev/getting-started) guide.
## Dev Env
[1 click deploy](https://marketplace.digitalocean.com/apps/micro?refcode=1eb1b2aca272&action=deploy) a Micro Dev environment on a DigitalOcean Droplet