# README
ZeroDT
Package ZeroDT
offers a zero downtime restart and a graceful shutdown for HTTP servers. Key features:
- supported both stateless and stateful servers
- compatible with
systemd's
socket activation - based on out-of-the-box
http.Server
- work with any number of servers
- not a framework
Example
The simplest way to use ZeroDT
is to pass your http.Server
to the zerodt.NewApp
function and call zerodt.ListenAndServe
for an object it returns:
package main
import (
"io"
"net/http"
"time"
"github.com/ssgreg/zerodt"
)
func hello(w http.ResponseWriter, r *http.Request) {
io.WriteString(w, "Hello world!")
}
func main() {
mux := http.NewServeMux()
mux.HandleFunc("/", hello)
a := zerodt.NewApp(&http.Server{Addr: ":8081", Handler: mux})
a.ListenAndServe()
}
Adopting your HTTP server to use as systemd's
service
Under construction
# Packages
No description provided by the author
# Functions
ListenSocket TODO.
NewApp returns a new App instance.
SetLogger allows to set a different logger that is compatible with StdLogger interface.
# Structs
App specifies functions to control passed HTTP servers.
StreamMessenger a simple messenger based on net.Conn.
# Interfaces
StdLogger is an interface for stdlib logger also compatible with logrus.