{"id":16641865,"url":"https://github.com/samthor/hangar","last_synced_at":"2026-04-29T05:31:10.461Z","repository":{"id":207316769,"uuid":"718947547","full_name":"samthor/hangar","owner":"samthor","description":"Local daemon for developing distributed Fly.io servers","archived":false,"fork":false,"pushed_at":"2023-12-31T01:11:12.000Z","size":37,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-05T16:56:10.614Z","etag":null,"topics":["flyio"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/samthor.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,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-11-15T05:43:39.000Z","updated_at":"2024-06-03T06:10:29.000Z","dependencies_parsed_at":"2023-12-31T01:43:48.111Z","dependency_job_id":null,"html_url":"https://github.com/samthor/hangar","commit_stats":null,"previous_names":["samthor/hangar"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/samthor/hangar","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samthor%2Fhangar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samthor%2Fhangar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samthor%2Fhangar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samthor%2Fhangar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/samthor","download_url":"https://codeload.github.com/samthor/hangar/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samthor%2Fhangar/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32412886,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T05:20:56.964Z","status":"ssl_error","status_checked_at":"2026-04-29T05:19:54.749Z","response_time":110,"last_error":"SSL_read: 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":["flyio"],"created_at":"2024-10-12T07:48:07.240Z","updated_at":"2026-04-29T05:31:10.444Z","avatar_url":"https://github.com/samthor.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"Hangar provides a local daemon for developing distributed Fly.io servers locally in Go.\n\n## Usage\n\nTo start the package at `./demo` in this repository, you can:\n\n```bash\n$ go get github.com/samthor/hangar/bin\n$ go run github.com/samthor/hangar/bin -p github.com/samthor/hangar/demo\n```\n\nThis starts a daemon with small number of machines all running in different 'regions'.\nIt performs basic load-balancing between them (with \"the user\" assumed to be in the 1st region), or respects [the `fly-prefer-region` header](https://fly.io/docs/reference/dynamic-request-routing/).\n\nYou can demonstrate having multiple jobs run with:\n\n```bash\n$ curl http://localhost:8080/info -H \"fly-prefer-region: ams\"\n$ curl http://localhost:8080/info -H \"fly-prefer-region: syd\"\n```\n\nThe code inside `./lib` helps provide a layer that hides local development vs. the real Fly deployed environment.\n(It also works without either, but just provides sensible single-node defaults.)\n\nYou can use it in your code like:\n\n```go\nimport (\n  hangar \"github.com/samthor/hangar/lib\"\n)\n\nfunc main() {\n  // find out about ourselves\n  self := hangar.Self()\n\n  // do something with other instances\n  others, err := hangar.Discover(context.Background())\n\n  // serve on the local $PORT\n  log.Fatal(http.ListenAndServe(hangar.ListenPort(), nil))\n}\n\n```\n\n### Mount\n\nUse `StoragePath()` with a mounted path as a no-op in prod, but to get a local path in dev created under your home directory (in \"~/.fly/hangar/\").\nThis doesn't quite match Fly's semantics.\n\n## Extensions/TODOs\n\nThis has no knowledge of process groups.\nIn production, actively only discovers instances in the same process group\u0026mdash;has no knowledge of them.\n\nThis currently runs Go packages, but really, it could run any command N times\u0026mdash;Hangar just sets `$PORT` and other environment variables.\n\nAssumes that the processes under control stop after some time (does not kill it when idle).\nRestarts on non-zero exit code (same as Fly).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamthor%2Fhangar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsamthor%2Fhangar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamthor%2Fhangar/lists"}