{"id":24997949,"url":"https://github.com/flowerinthenight/hedge-cb","last_synced_at":"2026-05-07T18:47:50.664Z","repository":{"id":275519824,"uuid":"926322822","full_name":"flowerinthenight/hedge-cb","owner":"flowerinthenight","description":"A cluster membership library built on spindle-cb and aws/clock-bound.","archived":false,"fork":false,"pushed_at":"2025-11-26T05:09:29.000Z","size":1573,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-29T06:42:28.241Z","etag":null,"topics":["aws","cluster","distributed-locking","distributed-systems","golang","memberlist"],"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/flowerinthenight.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,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-02-03T03:15:54.000Z","updated_at":"2025-11-26T05:09:33.000Z","dependencies_parsed_at":"2025-02-03T04:21:39.314Z","dependency_job_id":"1f1739a2-bbaf-4445-8c41-bed0608c86bc","html_url":"https://github.com/flowerinthenight/hedge-cb","commit_stats":null,"previous_names":["flowerinthenight/hedge-cb"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/flowerinthenight/hedge-cb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flowerinthenight%2Fhedge-cb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flowerinthenight%2Fhedge-cb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flowerinthenight%2Fhedge-cb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flowerinthenight%2Fhedge-cb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flowerinthenight","download_url":"https://codeload.github.com/flowerinthenight/hedge-cb/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flowerinthenight%2Fhedge-cb/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32751757,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-07T02:14:30.463Z","status":"ssl_error","status_checked_at":"2026-05-07T02:14:29.405Z","response_time":62,"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":["aws","cluster","distributed-locking","distributed-systems","golang","memberlist"],"created_at":"2025-02-04T17:26:45.427Z","updated_at":"2026-05-07T18:47:50.659Z","avatar_url":"https://github.com/flowerinthenight.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![main](https://github.com/flowerinthenight/hedge-cb/actions/workflows/main.yml/badge.svg)](https://github.com/flowerinthenight/hedge-cb/actions/workflows/main.yml)\n[![Go Reference](https://pkg.go.dev/badge/github.com/flowerinthenight/hedge-cb.svg)](https://pkg.go.dev/github.com/flowerinthenight/hedge-cb)\n\n\u003e [!IMPORTANT]  \n\u003e This library is still using the `main-2.0` branch of the [ClockBound daemon](https://github.com/aws/clock-bound).\n\n## hedge-cb\n\nAn AWS-native, cluster membership [Go](https://go.dev/) library. It is built on [spindle-cb](https://github.com/flowerinthenight/spindle-cb), a distributed locking library built on [aws/clock-bound](https://github.com/aws/clock-bound) and PostgreSQL. It is a port (subset only) of [hedge](https://github.com/flowerinthenight/hedge). Ported features include:\n\n* Tracking of member nodes - good for clusters with sizes that can change dynamically overtime, such as [AWS Autoscaling Groups](https://docs.aws.amazon.com/autoscaling/ec2/userguide/auto-scaling-groups.html), and [Kubernetes Deployments](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/);\n* Leader election - the cluster elects and maintains a single leader node at all times;\n* List of members - get a list of all member nodes at any time;\n* [Streaming] Send - any member node can send messages to the leader at any time;\n* [Streaming] Broadcast - any member node can broadcast messages to all nodes at any time.\n\n## Requirements\n\n* A PostgreSQL database - a requirement of [spindle-cb](https://github.com/flowerinthenight/spindle-cb).\n* The [ClockBound daemon](https://github.com/aws/clock-bound) - a requirement of [spindle-cb](https://github.com/flowerinthenight/spindle-cb).\n* All nodes within a cluster should be able to contact each other via TCP (host:port).\n* Each hedge-cb's instance id should be set using the node's host:port. The host part can be inferred internally as well.\n\n## Running the sample\n\nA sample cloud-init [startup script](./startup-aws-asg.sh) is provided for spinning up an [Auto Scaling Group](https://docs.aws.amazon.com/autoscaling/ec2/userguide/auto-scaling-groups.html) with the ClockBound daemon already setup and running. You need to update the `ExecStart` section first with a working PostgreSQL connection value. Note that this is NOT recommended though. You should use something like IAM Role + Secrets Manager, for instance.\n\n```sh\n# Create a launch template. ImageId here is Amazon Linux, default VPC.\n# You can remove the \"KeyName\" line if SSH access is not needed.\n# (Added newlines for readability. Might not run when copied as is.)\n$ aws ec2 create-launch-template \\\n  --launch-template-name hedge-lt \\\n  --version-description version1 \\\n  --launch-template-data '\n  {\n    \"UserData\":\"'\"$(cat startup-aws-asg.sh | base64 -w 0)\"'\",\n    \"ImageId\":\"ami-0fe289b44779ce58a\",\n    \"InstanceType\":\"t3.medium\",\n    \"KeyName\":\"keyName\"\n  }'\n\n# Create the single-zone ASG; update {target-zone} with actual value:\n$ aws autoscaling create-auto-scaling-group \\\n  --auto-scaling-group-name hedge-asg \\\n  --launch-template LaunchTemplateName=spindle-lt,Version='1' \\\n  --min-size 3 \\\n  --max-size 3 \\\n  --tags Key=Name,Value=hedge-asg \\\n  --availability-zones {target-zone}\n\n# or a multi-zone ASG; update {subnet(?)} with actual value(s):\n$ aws autoscaling create-auto-scaling-group \\\n  --auto-scaling-group-name hedge-asg \\\n  --launch-template LaunchTemplateName=spindle-lt,Version='1' \\\n  --min-size 3 \\\n  --max-size 3 \\\n  --tags Key=Name,Value=hedge-asg \\\n  --vpc-zone-identifier \"{subnet1,subnet2,subnet3}\"\n\n# You can now SSH to the instance(s). Note that it might take some time\n# before ClockBound is running due to the need to build it in Rust. You\n# can wait for the `clockbound` process, or tail the startup script output,\n# like so:\n$ tail -f /var/log/cloud-init-output.log\n\n# Tail the service logs:\n$ journalctl -f -u hedge\n\n# Test the Send API (send message to current leader):\n$ curl -v localhost:9090/send -d \"hello-leader\"\n\n# Test the Broadcast API (send message to all nodes):\n$ curl -v localhost:9090/broadcast -d \"hello-all\"\n```\n\n\u003cp align=\"left\"\u003e\n  \u003cimg src=\"./assets/hedge-cb.png\" title=\"hedge\"\u003e\n\u003c/p\u003e\n\n## License\n\nThis library is licensed under the [Apache 2.0 License](./LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflowerinthenight%2Fhedge-cb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflowerinthenight%2Fhedge-cb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflowerinthenight%2Fhedge-cb/lists"}