Go-Chassis is a microservice framework for rapid development of microservices in Go
-
go chassis is designed as a protocol-independent framework, any protocol is able to integrate with go chassis and leverage same function like load balancing, circuit breaker,rate limiting, routing management, those function resilient your service
-
go chassis makes service observable by bringing open tracing and prometheus to it.
-
go chassis is flexible, many different modules can be replaced by other implementation, like registry, metrics, handler chain, config server etc
-
With many build-in function like route management, circuit breaker, load balancing, monitoring etc, your don't need to investigate, implement and integrate many solutions yourself.
-
go chassis supports Istio control panel, go chassis can bring better performance to go program, you can use Istio configurations to control go chassis.
-
https://github.com/huaweicloud/spring-cloud-huawei integrate with servicecomb, go chassis can work together with spring cloud.
- Pluggable registrator and discovery service: Support Service center, istio pilot, kubernetes and file based registry, fit both client side discovery and server side discovery pattern
- Pluggable Protocol: You can custom your own protocol, by default support http and grpc, go chassis define standardized model to makes all request of different protocol lerverage same features
- Multiple server management: you can separate API by protocols and ports
- Handler Chain: Able to add your own code during service calling for client and server side
- rich middlewares: based on handler chain, supply circuit breaker, rate limiting, monitoring, auth features. see
- Route management: Able to route to different service based on weight and match rule to achieve Canary Release easily
- Client side Load balancing: Able to custom strategy
- Pluggable Cipher: Able to custom your own cipher for AKSK and TLS certs
- Metrics: Able to expose Prometheus metric API automatically and custom metrics reporter
- Tracing:Use opentracing-go as standard library, easy to integrate tracing system
- Logger: You can custom your own writer to sink log, by default support file and stdout
- Hot reconfiguraion: Powered by go-archaius, configurations can be reload in runtime, like load balancing, circuit breaker, rate limiting, developer is also able to develop a service which has hot-reconfiguration feature easily. see
- Fault Injection: In consumer side, you can inject faults to bring chaos testing into your system
- API gateway and service mesh solution: powered by servicecomb-mesher.
- Open API 2.0 native support go chassis will automatically generate Open API 2.0 doc and register it to service center. you can manage all the API docs in one place
You can check plugins to see more features
1.Generate go mod
go mod init
2.Add go chassis
GO111MODULE=on go get github.com/go-chassis/go-chassis
if you are facing network issue
export GOPROXY=https://goproxy.io
3.Write your first http micro service
You can see more documentations in here, this online doc is for latest version of go chassis, if you want to see your version's doc, follow here to generate it in local
You can check examples here
NOTICE: Now examples is migrating to here
Go-Chassis supports 3 types of communication protocol.
- Rest - REST is an approach that leverages the HTTP protocol for communication.
- Highway - This is a RPC communication protocol, it was deprecated.
- grpc - native grpc protocol, go chassis bring circuit breaker, route management etc to grpc.
Add -tags debug
into go build arguments before debugging, if your go version is go1.10 onward.
example:
go build -tags debug -o server -gcflags "all=-N -l" server.go
Chassis customized debug
tag to resolve dlv debug issue:
https://github.com/derekparker/delve/issues/865
this part introduce some eco systems that go chassis can run with
With ServiceComb service center as registry, go chassis supply more features like contract management and multiple service registry, highly recommended. that will not prevent you from using kubernetes or Istio, Because service center can aggregate heterogeneous registry and give you a unified service registry entry point.
go chassis has k8s registry and Istio registry plugins, and support Istio traffic management you can use spring cloud or Envoy with go chassis under same service discovery service.
- apache/servicecomb-kie: A distributed configuration management service, go chassis and mesher integrate with it, so that user can manage service configurations by this service.
- apache/servicecomb-mesher: A service mesh able to co-work with go chassis, it is able to run as a API gateway also.
- KubeEdge: Kubernetes Native Edge Computing Framework (project under CNCF) https://kubeedge.io
To register your self, go to go-chassis#592
-
Install go 1.12+
-
Clone the project
git clone git@github.com:go-chassis/go-chassis.git
- Download vendors
cd go-chassis
export GO111MODULE=on
go mod download
#optional
export GO111MODULE=on
go mod vendor
NOTICE:if you do not use mod, We can not ensure you the compatibility. however you can still maintain your own vendor, which means you have to solve compiling issue your own.
- Install service-center
For more information about go chassis, read github wiki page