{"id":32172435,"url":"https://github.com/quiqupltd/libelection","last_synced_at":"2026-02-19T08:03:08.150Z","repository":{"id":57516074,"uuid":"121274951","full_name":"quiqupltd/libelection","owner":"quiqupltd","description":"Library to perform leader election in a cluster of containerized Elixir nodes","archived":false,"fork":false,"pushed_at":"2023-08-23T05:07:39.000Z","size":62,"stargazers_count":12,"open_issues_count":3,"forks_count":2,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-11-22T00:27:02.348Z","etag":null,"topics":["elixir","kubernetes"],"latest_commit_sha":null,"homepage":null,"language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/quiqupltd.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}},"created_at":"2018-02-12T16:57:50.000Z","updated_at":"2025-07-10T15:57:26.000Z","dependencies_parsed_at":"2022-08-28T16:50:15.835Z","dependency_job_id":null,"html_url":"https://github.com/quiqupltd/libelection","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/quiqupltd/libelection","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quiqupltd%2Flibelection","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quiqupltd%2Flibelection/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quiqupltd%2Flibelection/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quiqupltd%2Flibelection/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/quiqupltd","download_url":"https://codeload.github.com/quiqupltd/libelection/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quiqupltd%2Flibelection/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29608152,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-19T06:47:36.664Z","status":"ssl_error","status_checked_at":"2026-02-19T06:45:47.551Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":["elixir","kubernetes"],"created_at":"2025-10-21T18:37:04.704Z","updated_at":"2026-02-19T08:03:08.144Z","avatar_url":"https://github.com/quiqupltd.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\u003cimg src=\"design/logo.png\" alt=\"libelection\" height=\"300px\"\u003e\u003c/p\u003e\n\n\n# Libelection\n\n[![Build Status](https://travis-ci.org/quiqupltd/libelection.svg?branch=master)](https://travis-ci.org/quiqupltd/libelection)\n[![Package Version](https://img.shields.io/hexpm/v/libelection.svg)](https://hex.pm/packages/libelection)\n[![Coverage](https://coveralls.io/repos/github/quiqupltd/libelection/badge.svg?branch=master)](https://coveralls.io/repos/github/quiqupltd/libelection)\n[![Inline docs](https://inch-ci.org/github/quiqupltd/libelection.svg?branch=master)](https://inch-ci.org/github/quiqupltd/libelection)\n\nLibrary to perform leader election in a cluster of containerized Elixir nodes.\n\n## Installation\n\n```elixir\ndef deps do\n  [{:libelection, \"~\u003e 1.1.0\"}]\nend\n```\n\n## Usage\n\n```elixir\n\nif Election.leader? do\n  # Code path executed only by the leader node\nelse\n  # Code path executed by followers\nend\n```\n\n## How it works\n\nPolls the API of the configured container orchestration platform to determine the oldest node of the cluster.\n\nTo configure the polling interval use:\n\n```elixir\nconfig :libelection, :polling_interval, 2_000 # 2 seconds\n```\n\nTo configure the function which lists the node of the cluster use:\n\n```elixir\nconfig :libelection, :list_nodes, {module, function, args}\n# it can also be a function reference\nconfig :libelection, :list_nodes, \u0026SomeModule.some_function/1\n```\n\nConfigure the logger\n```elixir\nconfig :libelection, :logger, %{level: :debug} # Default\n```\n\n*Note:* The configuration also supports [confex](https://hex.pm/packages/confex) style configurations.\n\n## Election Strategies\n\n### Rancher\n\nThe [`create_index`](http://rancher.com/docs/rancher/v1.2/en/rancher-services/metadata-service/#container) identifier is used to pick the leader.\n\n```elixir\nconfig :libelection,\n  strategy: Election.Strategy.Rancher,\n  rancher_node_basename: \"some-app\"\n```\n\n### Kubernetes\n\nThe [`resourceVersion`](https://kubernetes.io/docs/reference/generated/federation/v1/definitions/) identifier\nis used to pick the leader.\n\n```elixir\nconfig :libelection,\n  strategy: Election.Strategy.Kubernetes,\n  kubernetes_selector: \"app=some-app\",\n  kubernetes_node_basename: \"some-app\"\n```\n\n## Documentation\n\n* [exdoc](https://hexdocs.pm/libelection/)\n* wiki (coming soon)\n\n## License\n\n[GPLv3](https://github.com/quiqupltd/libelection/blob/master/LICENSE.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquiqupltd%2Flibelection","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fquiqupltd%2Flibelection","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquiqupltd%2Flibelection/lists"}