ory/graceful

A best practice http server set up that supports graceful shutdown

Go

208

100 commits

updated Sep 30, 2026

See the code

README

graceful

Build Status Coverage Status Docs: GoDoc

Join the chat at https://slack.ory.sh/

Best practice http server configurations and helpers for Go 1.8's http graceful shutdown feature. Currently supports best practice configurations by:

Usage

To install this library, do:

go get github.com/ory/graceful

Running Cloudflare Config with Graceful Shutdown

package main

import (
    "net/http"
    "log"

    "github.com/ory/graceful"
)

func main() {
    server := graceful.WithDefaults(&http.Server{
        Addr: ":54932",
        // Handler: someHandler,
    })

    log.Println("main: Starting the server")
    if err := graceful.Graceful(server.ListenAndServe, server.Shutdown); err != nil {
        log.Fatalln("main: Failed to gracefully shutdown")
    }
    log.Println("main: Server was shutdown gracefully")
}

ory/graceful

A best practice http server set up that supports graceful shutdown

Go

208

100 commits

updated Sep 30, 2026

See the code

README

graceful

Build Status Coverage Status Docs: GoDoc

Join the chat at https://slack.ory.sh/

Best practice http server configurations and helpers for Go 1.8's http graceful shutdown feature. Currently supports best practice configurations by:

Usage

To install this library, do:

go get github.com/ory/graceful

Running Cloudflare Config with Graceful Shutdown

package main

import (
    "net/http"
    "log"

    "github.com/ory/graceful"
)

func main() {
    server := graceful.WithDefaults(&http.Server{
        Addr: ":54932",
        // Handler: someHandler,
    })

    log.Println("main: Starting the server")
    if err := graceful.Graceful(server.ListenAndServe, server.Shutdown); err != nil {
        log.Fatalln("main: Failed to gracefully shutdown")
    }
    log.Println("main: Server was shutdown gracefully")
}

Project health

Overall

4.9/10

Maintained

3/10

Code review

0/10
OpenSSF Scorecard

Latest release

v0.2.0 · Oct 22, 2025

Releases this year

1

Significant stargazers

Vladimir Krivosheev

408 followers · starred Aug 2021

Deniz Onur Duzgun

48 followers · starred Feb 2024

Bradley Wilson-Hunt

26 followers · starred Aug 2019

Alexandru Mărășteanu

88 followers · starred Oct 2020