goreload

package module
v0.0.0-...-ceb63a6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 27, 2015 License: GPL-2.0 Imports: 11 Imported by: 0

README

#goreload

Zero-downtime restarts in Go

The goreload support zero-downtime restarts in go applications that provide HTTP and/or TCP service.

Installation

go get github.com/lostdragon/goreload

Usage

Send HUP to a process using goreload and it will restart without downtime.

kill -HUP ${pid}

Send QUIT to a process using goreload and it will graceful shutdown.

kill -QUIT ${pid}
Signal Function
TERM, INT Quick shutdown
QUIT Graceful shutdown
KILL Halts a stubborn process
HUP Graceful restart

Refer

https://github.com/rcrowley/goagain

http://grisha.org/blog/2014/06/03/graceful-restart-in-golang/

https://github.com/mindreframer/golang-stuff/blob/master/github.com/astaxie/beego/reload.go

Documentation

Index

Constants

View Source
const (
	Graceful = "graceful"
)

Variables

This section is empty.

Functions

func HTTPService

func HTTPService(laddr string, handler http.Handler)

HTTP service

func IsErrClosing

func IsErrClosing(err error) bool

Test whether an error is equivalent to net.errClosing as returned by Accept during a graceful exit.

func ListenAndServe

func ListenAndServe(laddr string, handler http.Handler)

HTTP service

func Serve

func Serve(laddr string, handler func(net.Conn))

socket service

func SingleHTTPService

func SingleHTTPService(laddr string, handler http.Handler)

single HTTP service

func SingleTCPService

func SingleTCPService(laddr string, handler func(net.Conn))

single socket service

func TCPService

func TCPService(laddr string, handler func(net.Conn))

TCP service

func Wait

func Wait()

wait signal and restart service, then close listener, finally wait

Types

type Conn

type Conn struct {
	net.Conn
	// contains filtered or unexported fields
}

Allows for us to notice when the connection is closed.

func (*Conn) Close

func (c *Conn) Close() error

Directories

Path Synopsis
example

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL