• With issues:
  • Use the search tool before opening a new issue.
  • Please provide source code and commit sha if you found a bug.
  • Review existing issues and provide feedback or react to them.

Description

For Example, I edit nginx config file ,and exec ‘nginx -s reload’. I can graceful restart the nginx. Any way to graceful restart the gin http and https servers like nginx for production?

How to reproduce

package main

import (
    "github.com/gin-gonic/gin"
)

func main() {
    g := gin.Default()
    g.GET("/hello/:name", func(c *gin.Context) {
        c.String(200, "Hello %s", c.Param("name"))
    })
    g.Run(":9000")
}

Expectations

$ curl http://localhost:8201/hello/world
Hello world

Actual result

$ curl -i http://localhost:8201/hello/world
<YOUR RESULT>

Environment

  • go version:
  • gin version (or commit ref):
  • operating system:

Comment From: snowdream

https://github.com/cosmtrek/air

Note: This tool has nothing to do with hot-deploy for production.

Comment From: cedric-appdirect

I have made a PR https://github.com/gin-contrib/graceful/pull/2 that add support for Gin. You should be able to do what you want by monitoring the file you want on your system, then use Stop(), modify your service setup as you want and then call Start() on it again.

I haven't received any feedback on my PR yet, so would appreciate anyone looking at it.