{"id":13511656,"url":"https://github.com/fvbock/endless","last_synced_at":"2026-01-12T15:29:34.910Z","repository":{"id":29132198,"uuid":"32662124","full_name":"fvbock/endless","owner":"fvbock","description":"Zero downtime restarts for go servers (Drop in replacement for http.ListenAndServe)","archived":false,"fork":false,"pushed_at":"2021-11-27T08:54:05.000Z","size":48,"stargazers_count":4138,"open_issues_count":35,"forks_count":346,"subscribers_count":83,"default_branch":"master","last_synced_at":"2025-08-13T15:01:14.813Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/fvbock.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":"2015-03-22T04:42:51.000Z","updated_at":"2025-08-13T07:15:43.000Z","dependencies_parsed_at":"2022-07-12T13:33:45.040Z","dependency_job_id":null,"html_url":"https://github.com/fvbock/endless","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/fvbock/endless","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fvbock%2Fendless","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fvbock%2Fendless/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fvbock%2Fendless/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fvbock%2Fendless/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fvbock","download_url":"https://codeload.github.com/fvbock/endless/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fvbock%2Fendless/sbom","scorecard":{"id":415087,"data":{"date":"2025-08-11","repo":{"name":"github.com/fvbock/endless","commit":"447134032cb6a86814f570257390a379982dfc61"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.4,"checks":[{"name":"Code-Review","score":3,"reason":"Found 8/22 approved changesets -- score normalized to 3","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 17 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-18T23:37:18.996Z","repository_id":29132198,"created_at":"2025-08-18T23:37:18.996Z","updated_at":"2025-08-18T23:37:18.996Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28340804,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T12:22:26.515Z","status":"ssl_error","status_checked_at":"2026-01-12T12:22:10.856Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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-01T03:01:04.101Z","updated_at":"2026-01-12T15:29:34.893Z","avatar_url":"https://github.com/fvbock.png","language":"Go","readme":"# endless\n\nZero downtime restarts for golang HTTP and HTTPS servers. (for golang 1.3+)\n\n[![GoDoc](https://godoc.org/github.com/fvbock/endless?status.svg)](https://godoc.org/github.com/fvbock/endless)\n\n## Inspiration \u0026 Credits\n\nWell... it's what you want right - no need to hook in and out on a loadbalancer or something - just compile, SIGHUP, start new one, finish old requests etc.\n\nThere is https://github.com/rcrowley/goagain and i looked at https://fitstar.github.io/falcore/hot_restart.html which looked easier to do, but still some assembly required. I wanted something that's ideally as simple as\n\n    err := endless.ListenAndServe(\"localhost:4242\", mux)\n\nI found the excellent post [Graceful Restart in Golang](http://grisha.org/blog/2014/06/03/graceful-restart-in-golang/) by [Grisha Trubetskoy](https://github.com/grisha) and took his code as a start. So a lot of credit to Grisha!\n\n\n## Features\n\n- Drop-in replacement for `http.ListenAndServe` and `http.ListenAndServeTLS`\n- Signal hooks to execute your own code before or after the listened to signals (SIGHUP, SIGUSR1, SIGUSR2, SIGINT, SIGTERM, SIGTSTP)\n- You can start multiple servers from one binary and endless will take care of the different sockets/ports assignments when restarting\n\n\n## Default Timeouts \u0026 MaxHeaderBytes\n\nThere are three variables exported by the package that control the values set for `DefaultReadTimeOut`, `DefaultWriteTimeOut`, and `MaxHeaderBytes` on the inner [`http.Server`](https://golang.org/pkg/net/http/#Server):\n\n\tDefaultReadTimeOut    time.Duration\n\tDefaultWriteTimeOut   time.Duration\n\tDefaultMaxHeaderBytes int\n\nThe endless default behaviour is to use the same defaults defined in `net/http`.\n\nThese have impact on endless by potentially not letting the parent process die until all connections are handled/finished.\n\n\n### Hammer Time\n\nTo deal with hanging requests on the parent after restarting endless will *hammer* the parent 60 seconds after receiving the shutdown signal from the forked child process. When hammered still running requests get terminated. This behaviour can be controlled by another exported variable:\n\n    DefaultHammerTime time.Duration\n\nThe default is 60 seconds. When set to `-1` `hammerTime()` is not invoked automatically. You can then hammer the parent manually by sending `SIGUSR2`. This will only hammer the parent if it is already in shutdown mode. So unless the process had received a `SIGTERM`, `SIGSTOP`, or `SIGINT` (manually or by forking) before `SIGUSR2` will be ignored.\n\nIf you had hanging requests and the server got hammered you will see a log message like this:\n\n    2015/04/04 13:04:10 [STOP - Hammer Time] Forcefully shutting down parent\n\n\n## Examples \u0026 Documentation\n\n    import \"github.com/fvbock/endless\"\n\nand then replacing `http.ListenAndServe` with `endless.ListenAndServe` or `http.ListenAndServeTLS` with `endless.ListenAndServeTLS`\n\n\terr := endless.ListenAndServe(\"localhost:4242\", handler)\n\nAfter starting your server you can make some changes, build, and send `SIGHUP` to the running process and it will finish handling any outstanding requests and serve all new incoming ones with the new binary.\n\nMore examples are in [here](https://github.com/fvbock/endless/tree/master/examples)\n\nThere is also [GoDoc Documentation](https://godoc.org/github.com/fvbock/endless)\n\n\n## Signals\n\nThe endless server will listen for the following signals: `syscall.SIGHUP`, `syscall.SIGUSR1`, `syscall.SIGUSR2`, `syscall.SIGINT`, `syscall.SIGTERM`, and `syscall.SIGTSTP`:\n\n`SIGHUP` will trigger a fork/restart\n\n`syscall.SIGINT` and `syscall.SIGTERM` will trigger a shutdown of the server (it will finish running requests)\n\n`SIGUSR2` will trigger [hammerTime](https://github.com/fvbock/endless#hammer-time)\n\n`SIGUSR1` and `SIGTSTP` are listened for but do not trigger anything in the endless server itself. (probably useless - might get rid of those two)\n\nYou can hook your own functions to be called *pre* or *post* signal handling - eg. pre fork or pre shutdown. More about that in the [hook example](https://github.com/fvbock/endless/tree/master/examples#hooking-into-the-signal-handling).\n\n\n## Limitation: No changing of ports\n\nCurrently you cannot restart a server on a different port than the previous version was running on.\n\n## PID file\n\nIf you want to save actual pid file, you can change the `BeforeBegin` hook like this:\n\n\tserver := endless.NewServer(\"localhost:4242\", handler)\n\tserver.BeforeBegin = func(add string) {\n\t\tlog.Printf(\"Actual pid is %d\", syscall.Getpid())\n\t\t// save it somehow\n\t}\n\terr := server.ListenAndServe()\n\n\n## TODOs\n\n- tests\n- documentation\n- less ugly wrapping of the tls.listener\n","funding_links":[],"categories":["Go"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffvbock%2Fendless","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffvbock%2Fendless","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffvbock%2Fendless/lists"}