info

before-use

if use consul see https://www.consul.io/

go get -v github.com/golang/protobuf/{proto,protoc-gen-go}
go get -v github.com/micro/protoc-gen-micro
  • install micro cli

use release binaries

# Mac OS or Linux
curl -fsSL https://micro.mu/install.sh | /bin/bash

# Windows
powershell -Command "iwr -useb https://micro.mu/install.ps1 | iex"

run-project

get micro cli

use official images

get docker images micro/micro page is https://hub.docker.com/r/micro/micro

docker pull micro/micro

init code

  • install depends
make dep
  • this task will add base depends of this project at project vendor folder
lib version url
github.com/micro/go-micro v1.16.0 github.com/micro/go-micro
github.com/spf13/viper v1.5.0 github.com/spf13/viper

more version info see go.mod

update proto module

make protoUpdate

run Discovery

etcd

use different cli for run discovery

document

micro.mu/docs/framework

run Service Discovery

consul agent -dev
# or
consul agent -server -bootstrap-expect 1 -data-dir /tmp/consul
  • run web config UI
micro web

see at http://localhost:8082/ config at http://localhost:8082/client

run server

go run main.go

or use curl

curl -v 'http://localhost:8082/rpc' \
  -H "Content-Type:application/json" -H "Accept:application/json" \
  -d '{"service":"go.micro.restful.demo","method":"Version.Version","request":{"name":"my"}}' \
  -X POST