{"id":25044970,"url":"https://github.com/sectorlabs/heroku-rectifier","last_synced_at":"2025-08-02T05:39:22.598Z","repository":{"id":40430706,"uuid":"152400052","full_name":"SectorLabs/heroku-rectifier","owner":"SectorLabs","description":"Autoscale Heroku dynos based on RabbitMQ queue lengths","archived":false,"fork":false,"pushed_at":"2024-10-08T17:55:32.000Z","size":94,"stargazers_count":5,"open_issues_count":2,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-21T02:07:47.252Z","etag":null,"topics":["autoscaler","flask","heroku","rabbitmq","redis"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SectorLabs.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}},"created_at":"2018-10-10T09:46:02.000Z","updated_at":"2024-10-08T17:54:45.000Z","dependencies_parsed_at":"2025-04-14T02:00:42.883Z","dependency_job_id":"7eb7b820-ca21-4e7c-ba8f-cd08812e189a","html_url":"https://github.com/SectorLabs/heroku-rectifier","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/SectorLabs/heroku-rectifier","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SectorLabs%2Fheroku-rectifier","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SectorLabs%2Fheroku-rectifier/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SectorLabs%2Fheroku-rectifier/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SectorLabs%2Fheroku-rectifier/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SectorLabs","download_url":"https://codeload.github.com/SectorLabs/heroku-rectifier/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SectorLabs%2Fheroku-rectifier/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268339416,"owners_count":24234545,"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-08-02T02:00:12.353Z","response_time":74,"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":["autoscaler","flask","heroku","rabbitmq","redis"],"created_at":"2025-02-06T05:20:06.572Z","updated_at":"2025-08-02T05:39:22.515Z","avatar_url":"https://github.com/SectorLabs.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"![](static/favicon.ico)\n\n[![CircleCI](https://circleci.com/gh/SectorLabs/heroku-rectifier/tree/master.svg?style=svg)](https://circleci.com/gh/SectorLabs/heroku-rectifier/tree/master)\n\n**heroku-rectifier** is a simple autoscaler built for Heroku.\nIt inspects your queues and the traffic they have, and blindly scales the consumers of the queues accordingly.\nAt the moment, **heroku-rectifier** only knows how to inspect RabbitMQ queues.\n\nIt *doesn't* take into consideration things like your DB load, so if you're worried about that, this might not be for you.\n\nAlso, you need to host **heroku-rectifier** yourself. If you're using Heroku, this is really easy, as a Procfile is provided.\n\n## Configuration\n\nYou have to configure heroku-rectifier for it to actually do something.\nThe configuration is composed of two parts:\n\n### Queues Configuration\n\nThis is made through a Flask endpoint ('/').\n\nHow often and how heroku-rectifier should update consumers, based on the queues stats, is configured\nthrough a JSON file, editable at this endpoint.\n\nRectifier can watch as many queues as needed. An example of configuration looks like this:\n\n```json\n{\n    \"app_name\": {\n        \"queue_name\": {\n            \"intervals\": [0, 100, 1000],\n            \"workers\": [1, 2, 3],\n            \"cooldown\": 30,\n            \"consumers_formation_name\": \"dyno_formation_name\"\n        }\n    }\n}\n```\n\nYou specify the queues needed to be watched through the `queues` attribute.\nEvery queue **has** to have the following attributes set accordingly:\n\n##### Intervals and workers\n\nTogether, these two attributes tell rectify how many workers should be used for certain intervals.\nRectify looks at the number of messages in every queue (let's call it `messageCount`), and based on this\nconfiguration, decides on the number of workers it should scale to.\n\nTake the above example:\n\n```json\n{\n    \"intervals\": [0, 100, 1000],\n    \"workers\": [1, 2, 3]\n}\n```\n\nIf `0 \u003c= messageCount \u003c 100`, Rectify will scale to 1 worker.\n\nIf `100 \u003c= messageCount \u003c 1000`, Rectify will scale to 2 workers.\n\nIf `1000 \u003c= messageCount`, Rectify will scale to 3 workers.\n\nIf the number of the consumers already match the number needed to be scaled to,\nno extra `scale` call will be made.\n\nThere are a couple of constraints for these attributes (if they're not respected, the configuration\nwill not be used):\n\n* the `intervals` array should be sorted.\n* the `intervals` array should start with 0\n* all entries in the `intervals` array should be positive\n* all entries in the `workers` array should be positive\n* the length of the `intervals` array should match the length of the `workers` array.\n\n##### Cooldown\n\nThe `cooldown` attribute (which should be a positive integer, expressing seconds), tells Rectifier how much\nit should wait between succesive scales.\n\nAfter one scale operation has been made, nothing else will be done until this cooldown\nexpires.\n\n##### The consumers formation name\n\nThis is the key used for identifying a dyno formation on Heroku.\n\n### Environment Variables\n\n#### Redis\n\n\u003e REDIS_URL\n\nThe URL to be used for Redis storage of the configuration and the update times.\nThis is automatically provided by Heroku if you provide the app with Heroku Redis.\n    \n#### Flask\n\n\u003e SECRET_KEY\n\nThe secret key used by flask\n\n\u003e HOST (optional)\n\nThe host Flask should use\n\n\u003e PORT (optional)\n\nthe port flask should use\n\n\u003e BASIC_AUTH_USER\n\nThe user name to be used for basic auth.\n\n\u003e BASIC_AUTH_PASSWORD\n\nThe password to be used for basic auth.\n\n#### Heroku\n\n\u003e HEROKU_API_KEY\n\nThe API key rectifier should use for accesing heroku.\n\n#### Rectifier\n\n\u003e TIME_BETWEEN_REQUESTS\n\nHow often should Rectifier request RabbitMQ for stats.\n\n\u003e RABBIT_MQ_SECURE\n\nWhether it should use `https` for rabbit MQ http calls.\n\n\u003e DRY_RUN\n\nIf true, the rectifier won't _actually_ scale.\n\n## License\nMIT License\n\nCopyright (c) 2018 Sector Labs\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsectorlabs%2Fheroku-rectifier","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsectorlabs%2Fheroku-rectifier","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsectorlabs%2Fheroku-rectifier/lists"}