Skip to content

gracegrpc is used to wrap a grpc server that can be gracefully restarted & terminated.

License

Notifications You must be signed in to change notification settings

0x5010/gracegrpc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gracegrpc is used to wrap a grpc server that can be gracefully terminated & restarted.

LICENSE Build Status Go Report Card Godoc

Installation

go get github.com/0x5010/gracegrpc

Usage

Wrap grpc server and start server:

s := grpc.NewServer()
pb.RegisterDeployServer(s, &server{})
reflection.Register(s)
gr, err := gracegrpc.New(s, "tcp", addr, pidPath, nil)
if err != nil {
	log.Fatalf("failed to new gracegrpc: %v", err)
}
if err := gr.Serve(); err != nil {
	log.Fatalf("failed to serve: %v", err)
}

Custom logger

import log "github.com/sirupsen/logrus"

...
gr, err := gracegrpc.New(s, "tcp", addr, pidPath, log.StandardLogger())
...

In a terminal trigger a graceful server restart (using the pid from your output):

kill -USR2 pid

Run with supervisor

command = /path/to/pidproxy.py /path/to/pidPath /path/to/server

kill -USR2 {pidproxy.py pid}

About

gracegrpc is used to wrap a grpc server that can be gracefully restarted & terminated.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published