{"id":13823581,"url":"https://github.com/aerth/diamond","last_synced_at":"2025-07-08T18:30:38.211Z","repository":{"id":95082556,"uuid":"71611606","full_name":"aerth/diamond","owner":"aerth","description":"Runlevel 1, you stay unix socket. Runlevel 3, you listen tcp! Kicks old process on boot. Shuts down when kicked by new process. Could contribute to less downtime between app restarts and upgrades.","archived":false,"fork":false,"pushed_at":"2021-02-05T10:37:47.000Z","size":5878,"stargazers_count":23,"open_issues_count":1,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-08-04T09:01:29.657Z","etag":null,"topics":["administrator","kick","listeners","runlevel","runlevels","server","unix-socket","web-application"],"latest_commit_sha":null,"homepage":"https://aerth.github.io/diamond/","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/aerth.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-10-22T02:26:34.000Z","updated_at":"2024-03-26T22:58:28.000Z","dependencies_parsed_at":"2023-06-02T00:38:14.212Z","dependency_job_id":null,"html_url":"https://github.com/aerth/diamond","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aerth%2Fdiamond","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aerth%2Fdiamond/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aerth%2Fdiamond/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aerth%2Fdiamond/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aerth","download_url":"https://codeload.github.com/aerth/diamond/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225453340,"owners_count":17476706,"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":["administrator","kick","listeners","runlevel","runlevels","server","unix-socket","web-application"],"created_at":"2024-08-04T09:00:37.452Z","updated_at":"2024-11-20T01:30:39.468Z","avatar_url":"https://github.com/aerth.png","language":"Go","readme":"# DIAMOND ⋄\n\n### Runlevels for your web application\n\nDiamond provides a UNIX socket for administrators to gracefully shutdown an application, such as a web server.\n\nApart from only shutting down, the admin can change gears, triggering functions and killing/starting listeners.\n\nThe \"KICK\" feature allows upgrading a program with minimal downtime, kicking the old running process gracefully.\n\nIf diamond-admin doesn't run on your platform (bsd?) you can still use the client library!\n\n:zap: ```telinit 3```\n\n[![GoDoc](https://godoc.org/github.com/aerth/diamond/lib?status.svg)](https://godoc.org/github.com/aerth/diamond/lib)\n[![Build Status](https://travis-ci.org/aerth/diamond.svg?branch=master)](https://travis-ci.org/aerth/diamond)\n\n![Screenshot diamond-admin CUI](https://github.com/aerth/diamond/blob/master/docs/diamond-screenshot.png?raw=true)\n\n\n# Using diamond-admin\n\nYou can open admin interface by using no arguments:\n\n```\ndiamond-admin -s diamond.sock\n```\n\n### Start all listeners and http servers\n\n```\ndiamond-admin -s diamond.sock RUNLEVEL 3\n```\n\n### Stop all listeners, cut http connections\n\n```\ndiamond-admin -s diamond.sock RUNLEVEL 1\n```\n\n## Using the library\n\nDiamond requires a recent version of Go\n\n```\n\n// New creates a new admin socket and starts listening for commands\ns, err := diamond.New(\"/tmp/diamond.socket\")\nif err != nil {\n    log.Fatalln(err)\n}\n\n// Add variety of http handlers and their addr to listen on\n// They won't start listening right away, so they could be\n// occupied by other servers\ns.AddHTTPHandler(\":8080\", http.HandlerFunc(myHandler))\ns.AddHTTPHandler(\":8081\", http.HandlerFunc(handler2))\ns.AddHTTPHandler(\":8082\", handler3)\n\n// start in multiuser mode, serving http\n// without calling Runlevel(3) you must\n// connect via socket and issue the RUNLEVEL 3 command\ns.Runlevel(3) \n\n// serve forever\nlog.Fatalln(s.Wait())\n```\n\nSee the [examples](example)\n\nRead more:\n\n[aerth.github.io/diamond](https://aerth.github.io/diamond/)\n\n[github.com/aerth/diamond](https://github.com/aerth/diamond/)\n\n#### CAUTION\n\nAPI may change without notice! (it already has two times!)\n\n#### Contributing\n\nSubmit new issue or pull request\n\n### Old version\n\n```\nimport \"gopkg.in/aerth/diamond.v1\"\n```\n","funding_links":[],"categories":["Go"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faerth%2Fdiamond","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faerth%2Fdiamond","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faerth%2Fdiamond/lists"}