{"id":18644121,"url":"https://github.com/indix/vasuki","last_synced_at":"2025-04-11T12:31:00.055Z","repository":{"id":140451288,"uuid":"52212928","full_name":"indix/vasuki","owner":"indix","description":"Scale GoCD Agents on demand with Docker","archived":false,"fork":false,"pushed_at":"2018-04-15T07:20:07.000Z","size":46,"stargazers_count":13,"open_issues_count":7,"forks_count":3,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-03-25T13:39:24.475Z","etag":null,"topics":[],"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/indix.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-02-21T15:28:19.000Z","updated_at":"2022-05-06T17:12:38.000Z","dependencies_parsed_at":null,"dependency_job_id":"02320df5-9032-41e3-a6e8-65860a74f204","html_url":"https://github.com/indix/vasuki","commit_stats":null,"previous_names":["ashwanthkumar/vasuki"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indix%2Fvasuki","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indix%2Fvasuki/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indix%2Fvasuki/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indix%2Fvasuki/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/indix","download_url":"https://codeload.github.com/indix/vasuki/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248401936,"owners_count":21097328,"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":[],"created_at":"2024-11-07T06:10:07.560Z","updated_at":"2025-04-11T12:31:00.047Z","avatar_url":"https://github.com/indix.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://snap-ci.com/indix/vasuki/branch/master/build_image)](https://snap-ci.com/indix/vasuki/branch/master)\n# Vasuki\n\nVasuki is a [GoCD](http://go.cd/) agent autoscaler. Currently it uses docker to bring up agents on demand and scale them back down.\n\nYou just have to launch a Vasuki instance for an environment and resources with a docker image. It would periodically poll the GoCD Server for any active jobs waiting in Queue with these constraints. If found, it would bring up agents (docker containers) injecting the necessary environment and resource information. Once found idle, it would kill the container and remove the agent from the server.\n\nYou can run as many Vasuki instances in a machine for various environments / resources.\n\n## Features\n- Auto scale GoCD environments with resources automatically on demand\n- Completely stateless, preferred deployment is to start it as a deamon and put it behind a monit like process watch.\n\n## Usage\n```bash\n$ vasuki \\\n  --server-host localhost \\\n  --server-port 8080 \\\n  --server-username admin \\\n  --server-password badger \\\n  --agent-auto-register-key \"123456ABCDEFG\" \\\n  --agent-env FT \\\n  --agent-resources FT \\\n  --agent-resources chrome \\\n  --agent-resources selenium\n```\n\n## Command line parameters\n```\n$ vasuki --help\nScale GoCD Agents on demand\n\nUsage:\n  vasuki [flags]\n\nFlags:\n      --agent-auto-register-key string   AutoRegisterKey for the agent to register to the GoCD Server (default \"123456ABCDEFG\")\n      --agent-env value                  List of environments for the go-agent (default [])\n      --agent-max-count int              Maximum number of agents managed by this Vasuki instance (default 1)\n      --agent-resources value            List of resources for the go-agent (default [])\n      --docker-endpoint string           Docker endpoint to connect to (default \"unix:///var/run/docker.sock\")\n      --docker-env                       Flag to pick up docker settings from Env. Useful when working with boot2docker / docker-machine\n      --docker-image string              Docker image used for spinning up the agent (default \"ashwanthkumar/gocd-agent\")\n      --server-host string               Go Server Domain / IP Address (default \"localhost\")\n      --server-password string           Password of the User to connect to Go Server\n      --server-poll-interval duration    Poll interval for new scheduled jobs (default 30s)\n      --server-port int                  Go Server Port (default 8153)\n      --server-username string           Username to connect to Go Server\n      --verbose                          Enable verbose logging\n```\n\n## Building\n\nDependencies are managed with [glide](https://github.com/Masterminds/glide).\n\n- [Install](https://github.com/Masterminds/glide#install) glide.\n\n- The vendor support in Go 1.5 is opt-in. To enable it you need to set the environment variable:\n\n```\nλ export GO15VENDOREXPERIMENT=1\n```\n\n- Clone this repository inside your `${GOPATH}/src`.\n\n- Install the dependencies.\n\n```\nλ glide install\n```\n\n- Building is managed with `make`. To build for all targets, run:\n\n```\nλ make\n```\n\n## How does Vasuki work?\n1. Query for [active](https://api.go.cd/current/#get-all-agents) + [queued](https://api.go.cd/current/#get-scheduled-jobs) builds. This is Demand.\n2. Query for all active agents + list of containers managed by the executor implementation. We then take a union of both. This is Supply.\n3. If Demand \u003e Supply, do scale up using the executor implementation\n4. If Demand \u003c Supply, do scale down using the executor implementation\n\n## Known Issue\nWhen scaling down, there might be a job which is stuck because it got assigned to an agent but Vasuki had just deleted that agent. This is because Vasuki doesn't get the latest status from [Agents Endpoint](https://api.go.cd/current/#get-all-agents) even after the agent is assigned a job. More details can be found on this [GoCD Dev mail list](https://groups.google.com/d/msg/go-cd-dev/tWmV0Rw9sJM/cz_qe4LcAQAJ) message.\n\n**Solution** - Decrease the value of `cruise.reschedule.hung.builds.interval` property in GoCD server. This enables faster detection of hung jobs and reschedules them. Start your GoCD server with the following environment variable `GO_SERVER_SYSTEM_PROPERTIES=\"-Dcruise.reschedule.hung.builds.interval=60000\"` (60 seconds).\n\n`cruise.reschedule.hung.builds.interval` by default is [5 minutes](https://github.com/gocd/gocd/blob/master/server/properties/src/cruise.properties#L26). Preferred value is 60 seconds.\n\n## FAQs\n### Why my tasks take long to start now?\nVasuki polls your GoCD server to find active jobs in queue matching these resources. Hence it's a factor of `--server-poll-interval` flag that you pass. Remember, if you choose a very low value, it'll create unnecessarily load on the server instance.\n\n### For multiple environments and resources should I launch multiple Vasuki instances?\nYes and No. A single Vasuki can manage multiple environments and resources, but currently only 1 docker image per instance. So if you've 2 environments (say FT and UAT) and both are identical with respect to Go Agent, then yes a single Vasuki instance would be fine. Else you might want to launch a separate vasuki instance for each environment.\n\n## License\nhttp://www.apache.org/licenses/LICENSE-2.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Findix%2Fvasuki","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Findix%2Fvasuki","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Findix%2Fvasuki/lists"}