{"id":21401617,"url":"https://github.com/stardogventures/deploybot","last_synced_at":"2026-04-29T23:03:49.104Z","repository":{"id":87253968,"uuid":"88654702","full_name":"stardogventures/deploybot","owner":"stardogventures","description":"Slack deploybot for Jenkins with support for EC2 autoscaling","archived":false,"fork":false,"pushed_at":"2017-04-18T20:16:31.000Z","size":18,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-23T03:15:28.700Z","etag":null,"topics":["autoscaling","aws","deploy","ec2","jenkins","route53","slack","slackbot"],"latest_commit_sha":null,"homepage":null,"language":"Python","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/stardogventures.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}},"created_at":"2017-04-18T17:57:33.000Z","updated_at":"2017-12-07T23:25:38.000Z","dependencies_parsed_at":"2023-06-18T13:39:50.378Z","dependency_job_id":null,"html_url":"https://github.com/stardogventures/deploybot","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stardogventures%2Fdeploybot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stardogventures%2Fdeploybot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stardogventures%2Fdeploybot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stardogventures%2Fdeploybot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stardogventures","download_url":"https://codeload.github.com/stardogventures/deploybot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243893901,"owners_count":20364919,"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":["autoscaling","aws","deploy","ec2","jenkins","route53","slack","slackbot"],"created_at":"2024-11-22T15:28:38.795Z","updated_at":"2025-10-30T08:51:50.424Z","avatar_url":"https://github.com/stardogventures.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# deploybot\nSlack deploybot for Jenkins with support for EC2 autoscaling\n\nby Ian White and Stardog Ventures\n\nThis bot was originally based on example bot code published by Adrien Chauve of Serenytics at https://tech-blog.serenytics.com/deploy-your-saas-with-a-slack-bot-f6d1fc764658\n\n## Overview\n\nThis Slack bot can deploy with a simple `deploybot deploy \u003cmodule\u003e` command in Slack. It runs parameterized Jenkins jobs, which are configurable.\n\nThe author normally sets this up to run some Ansible playbooks and has Jenkins report progress into the Slack channel, but you can hook it into whatever you want.\n\n### Autoscaling\n\nYou can optionally use this bot with EC2 autoscaling to automatically configure and deploy to newly launched instances.\n\nThe bot can be configured to listen for EC2 autoscaling notifications via an SNS-to-SQS queue. It will announce all autoscaling actions in the channel. When it detects that a new instance has launched, it will run a deploy to the new instance. It assumes that the deploy type is named the same as the autoscaling group.\n\nOptionally, the bot can be configured to add A records with the new instance's private IP into a Route 53 zone, to give your EC2 instances friendly names. The new instance will automatically be assigned the name `\u003cgroupname\u003e-\u003cnumber\u003e`. For example, a newly launched server in the `api` autoscaling group might receive the name `api-5`.\n\n## Usage\n\nRun the bot with:\n\n```\nnohup python deploybot.py \u0026\n```\n\nWhen the deploy bot is running, you can issue deploys in your Slack channel with:\n\n```\ndeploybot deploy \u003cmodule\u003e \u003ctarget\u003e \u003cbranch\u003e\n```\n\nFor example, to deploy the API to production, you might:\n\n```\ndeploybot deploy api prod\n```\n\n## Dependencies\n\nEnsure that you have the following libraries pip installed:\n\n```\npip install boto3 slackclient requests\n```\n\n## Configuration\n\nThe bot relies on a .yml config file. By default it expects the file to be named `deploybot.yml` and living in the same folder, but you can pass the path as a command-line argument.\n\nSee the [example YML](deploybot.yml.example) file for example configuration, and fill in with your own values.\n\n## Jenkins Setup\n\nInstall the `Build Token Root Plugin`: https://wiki.jenkins-ci.org/display/JENKINS/Build+Token+Root+Plugin\n\nFor each of the jobs that you want the bot to run, check the `Trigger builds remotely` box and fill in an Authentication Token. Then put that token as `jenkins_token` in the config file.\n\nSet up your jobs or jobs as parameterized builds with the following parameters:\n  - `target` - should describe the environment, group, or individual server hostname you wish to deploy to. Default value is `prod`\n  - `branch` - should be the branch name you intend to deploy. Default value is `master`\n  - `username` - should be the Slack username of the person who is deploying. Default value is `deploybot`\n\nEach type of deploy you want to support should be represented in the YML file in the jenkins_deploys setting. For example:\n\n```\njenkins_deploys:\n  api:\n    job: deploy\n    params:\n      playbook: api\n  ui:\n    job: deploy-ui\n    params:\n      playbook: ui\n      anotherParam: here\n```\n\nThe above represents two different deployable modules, `api` and `ui`. `api` will run the `deploy` jenkins job, while `ui` will run the `deploy-ui` jenkins job. Each module will pass in an additional `playbook` parameter in addition to the standard `target/branch/username` params.\n\nYou will also want to specify the URL to your Jenkins instance in `jenkins_url`.\n\n## Slack Setup\n\nAdd a Slack bot here: https://slack.com/apps/A0F7YS25R-bots\n\nYou will need the token and bot name, enter these in the YML file as `slack_user` and `slack_token`. Specify the channel name in `slack_channel`.\n\n## AWS Setup (only if you are using autoscaling)\n\nYour instance or profile will need the following IAM policy (you can adjust the Resource wildcards to fit your specific needs):\n\n```json\n{\n    \"Version\": \"2012-10-17\",\n    \"Statement\": [\n        {\n            \"Effect\": \"Allow\",\n            \"Action\": [\n                \"sqs:DeleteMessage\",\n                \"sqs:ReceiveMessage\"\n            ],\n            \"Resource\": [\n                \"*\"\n            ]\n        },\n        {\n            \"Effect\": \"Allow\",\n            \"Action\": [\n                \"ec2:CreateTags\",\n                \"ec2:DescribeInstances\"\n            ],\n            \"Resource\": [\n                \"*\"\n            ]\n        },\n        {\n            \"Effect\": \"Allow\",\n            \"Action\": [\n                \"route53:ChangeResourceRecordSets\",\n                \"route53:ListHostedZonesByName\",\n                \"route53:ListResourceRecordSets\"\n            ],\n            \"Resource\": [\n                \"*\"\n            ]\n        }\n    ]\n}\n```\n\nConfigure your autoscaling group to send a notification to an SNS topic. You can do this from the `Notifications` tab in the [Auto Scaling Groups](https://console.aws.amazon.com/ec2/autoscaling/home) section in the AWS console.\n\nCreate an SQS queue and have it subscribe to the SNS topic. You can do this from the [SQS section](https://console.aws.amazon.com/sqs/home) of the AWS console.\n\nSpecify the SQS queue URL in `sqs_autoscaling_queue_url` in the YML file.\n\nIf you're using the Route 53 naming feature, specify the `route53_zone_name` in the YML file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstardogventures%2Fdeploybot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstardogventures%2Fdeploybot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstardogventures%2Fdeploybot/lists"}