{"id":13526929,"url":"https://github.com/facebookarchive/grace","last_synced_at":"2025-04-01T08:30:39.669Z","repository":{"id":3496735,"uuid":"4553246","full_name":"facebookarchive/grace","owner":"facebookarchive","description":"Graceful restart \u0026 zero downtime deploy for Go servers.","archived":true,"fork":false,"pushed_at":"2019-02-13T01:07:15.000Z","size":84,"stargazers_count":4898,"open_issues_count":9,"forks_count":424,"subscribers_count":162,"default_branch":"master","last_synced_at":"2024-08-13T20:17:08.352Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://godoc.org/github.com/facebookgo/grace","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/facebookarchive.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-06-04T22:23:04.000Z","updated_at":"2024-08-09T18:08:13.000Z","dependencies_parsed_at":"2022-08-09T20:40:10.614Z","dependency_job_id":null,"html_url":"https://github.com/facebookarchive/grace","commit_stats":null,"previous_names":["parseplatform/go.grace","daaku/go.grace","facebookgo/grace"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/facebookarchive%2Fgrace","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/facebookarchive%2Fgrace/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/facebookarchive%2Fgrace/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/facebookarchive%2Fgrace/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/facebookarchive","download_url":"https://codeload.github.com/facebookarchive/grace/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246607098,"owners_count":20804515,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T06:01:37.722Z","updated_at":"2025-04-01T08:30:39.295Z","avatar_url":"https://github.com/facebookarchive.png","language":"Go","funding_links":[],"categories":["Go","Web"],"sub_categories":["Web Servers and Proxies"],"readme":"grace [![Build Status](https://secure.travis-ci.org/facebookgo/grace.png)](https://travis-ci.org/facebookgo/grace)\n=====\n\nPackage grace provides a library that makes it easy to build socket\nbased servers that can be gracefully terminated \u0026 restarted (that is,\nwithout dropping any connections).\n\nIt provides a convenient API for HTTP servers including support for TLS,\nespecially if you need to listen on multiple ports (for example a secondary\ninternal only admin server).  Additionally it is implemented using the same API\nas systemd providing [socket\nactivation](http://0pointer.de/blog/projects/socket-activation.html)\ncompatibility to also provide lazy activation of the server.\n\n\nUsage\n-----\n\nDemo HTTP Server with graceful termination and restart:\nhttps://github.com/facebookgo/grace/blob/master/gracedemo/demo.go\n\n1. Install the demo application\n\n        go get github.com/facebookgo/grace/gracedemo\n\n1. Start it in the first terminal\n\n        gracedemo\n\n   This will output something like:\n\n        2013/03/25 19:07:33 Serving [::]:48567, [::]:48568, [::]:48569 with pid 14642.\n\n1. In a second terminal start a slow HTTP request\n\n        curl 'http://localhost:48567/sleep/?duration=20s'\n\n1. In a third terminal trigger a graceful server restart (using the pid from your output):\n\n        kill -USR2 14642\n\n1. Trigger another shorter request that finishes before the earlier request:\n\n        curl 'http://localhost:48567/sleep/?duration=0s'\n\n\nIf done quickly enough, this shows the second quick request will be served by\nthe new process (as indicated by the PID) while the slow first request will be\nserved by the first server. It shows how the active connection was gracefully\nserved before the server was shutdown. It is also showing that at one point\nboth the new as well as the old server was running at the same time.\n\n\nDocumentation\n-------------\n\n`http.Server` graceful termination and restart:\nhttps://godoc.org/github.com/facebookgo/grace/gracehttp\n\n`net.Listener` graceful termination and restart:\nhttps://godoc.org/github.com/facebookgo/grace/gracenet\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffacebookarchive%2Fgrace","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffacebookarchive%2Fgrace","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffacebookarchive%2Fgrace/lists"}