{"id":21153570,"url":"https://github.com/massimostanzione/distributed-election","last_synced_at":"2026-05-18T00:06:38.057Z","repository":{"id":62759669,"uuid":"552524765","full_name":"massimostanzione/distributed-election","owner":"massimostanzione","description":"Distributed election algorithms. Project for the exam \"Sistemi Distribuiti e Cloud Computing\".","archived":false,"fork":false,"pushed_at":"2022-12-13T13:36:56.000Z","size":40417,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-14T15:13:02.922Z","etag":null,"topics":["client-server","distributed-election","distributed-systems","docker-compose"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/massimostanzione.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-10-16T19:35:02.000Z","updated_at":"2023-12-01T00:13:07.000Z","dependencies_parsed_at":"2023-01-28T12:25:26.162Z","dependency_job_id":null,"html_url":"https://github.com/massimostanzione/distributed-election","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":"massimostanzione/repo-template","purl":"pkg:github/massimostanzione/distributed-election","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/massimostanzione%2Fdistributed-election","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/massimostanzione%2Fdistributed-election/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/massimostanzione%2Fdistributed-election/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/massimostanzione%2Fdistributed-election/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/massimostanzione","download_url":"https://codeload.github.com/massimostanzione/distributed-election/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/massimostanzione%2Fdistributed-election/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267928987,"owners_count":24167432,"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","status":"online","status_checked_at":"2025-07-30T02:00:09.044Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["client-server","distributed-election","distributed-systems","docker-compose"],"created_at":"2024-11-20T10:57:37.163Z","updated_at":"2026-05-18T00:06:32.452Z","avatar_url":"https://github.com/massimostanzione.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# distributed-election\nDistributed election algorithms. Project for the exam \"Sistemi Distribuiti e Cloud Computing\". \n\n## Overview\nThis application, made in the context of the \"*Sistemi distribuiti e Cloud Computing*\" (9 CFU = 9 ETCS) course, followed at *University of Rome Tor Vergata*, aims to implement two *distributed election* algorithms, i.e.:\n- H. Garcia-Molina's *bully* algorithm (1982)\n- G. N. Fredrickson and N. A. Lynch algorithm, based on a ring topology (1987)\n\nThe project's functionalities are managed by some **nodes**, that elect a coordinator between them, and a **service registry**, that manages the node's network addresses.\n\nFurther information about this project are available into the [`docs`](https://github.com/massimostanzione/distributed-election/tree/main/docs) folder.\n\n## Quickstart\nYou can either launch a [local run](#local-run) or see the [deployment](#deployment) in action.\n\n### Local Run\nSome *ready-to-use* scripts are available into the [`examples`](https://github.com/massimostanzione/distributed-election/tree/main/examples) folder. Follow these instructions to run them:\n\n0. Install Go by following [these instructions](https://go.dev/doc/install), then install gRPC and protocol-buffer if you don't have it in your machine:\n```\ngo install google.golang.org/protobuf/cmd/protoc-gen-go@latest\ngo install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest\n\ncurl -LO https://github.com/protocolbuffers/protobuf/releases/download/v3.15.8/protoc-3.15.8-linux-x86_64.zip\nunzip protoc-3.15.8-linux-x86_64.zip -d $HOME/.local\nexport PATH=\"$PATH:$HOME/.local/bin\"\n```\n\n1. Download the repository and apply privileges:\n```\ngit clone https://github.com/massimostanzione/distributed-election\nsudo chmod -R 770 distributed-election\ncd distributed-election\n```\n2. Build the binaries for *nodes* and *service registry*:\n```\ncd scripts\n./setup.sh\n```\n*(Please run `./teardown.sh` if something goes wrong.)*\n\n3. Just launch the algorithm you want:\n```\ncd ../examples\n\n# to run a bully algorithm demo:\n./bully.sh\n\n# to run a Fredrickson-Lynch algorithm demo:\n./fredricksonlynch.sh\n```\n... then just follow the instructions and enjoy!\n\n### Deployment\n**Notice:** to execute this you have to have an active *Amazon EC2* instance.\n```\ncd ../deployments/ansible\n\n# use vim, nano, or whatever you prefer\nvim hosts.ini\n```\n\nSubstitute the following items:\n- Replace `HOST-IP-ADDRESS` with your *Amazon EC2* instance outbound IP address;\n- Replace `AMAZON_EC2_USERNAME` with your *Amazon EC2* instance username (default: `ec2-user`);\n- Replace `PATH/TO/KEYS.pem` with your `.pem` file containing the private key you use to access your *Amazon EC2* instance.\n\nNow just deploy:\n```\n# install ansible, if you don't have it in your machine:\npython3 -m pip install --user ansible\n\n# start the deployment\nansible-playbook -v -i hosts.ini deploy.yaml\n```\n*(if it is not your first Ansible run, the flag `--flush-cache` may be useful)*\n\nNow, to see what is running, connect to your *Amazon EC2* instance:\n\n```\nssh -i \"PATH/TO/KEYS.pem\" AMAZON_EC2_USERNAME@HOST-IP-ADDRESS\n\n# Verify if containers are up and running\n# ***NOTICE:*** Containers can take several (about 3, empirically) minutes before\n# being made up and running! Be patient...\ndocker ps\n\n# Inspect logs for all the containers\ncd distributed-election/deployments\ndocker container logs\n\n# or, to see log just for one container, take its name from 'docker ps' and run, from any position:\ndocker container logs CONTAINER_NAME\n```\n\n## Keep it calm\nIf you already enjoyed the [quickstart](#quickstart), you can now launch a more *reasoned* execution:\n\nAssuming you already followed the [setup](#setup) section, move to the `distributed-election` folder and run:\n```\ncd bin\n```\nhere you can find the executable `node` and `serviceregistry`. You can run them in separate terminal windows or place them into different nodes of a network and just run with\n```\n./node\n```\nor\n```\n./serviceregistry\n```\n\nPlease take a look at the `--help` flag to see all the possible customization (further more of them, with the whole set of parameters that can be set, can be found into the [`configs`](https://github.com/massimostanzione/distributed-election/tree/main/configs) folder.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmassimostanzione%2Fdistributed-election","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmassimostanzione%2Fdistributed-election","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmassimostanzione%2Fdistributed-election/lists"}