A Slack bot that helps you to deploy your apps.
For help just type help:
Show changelog for your branch against master branch:
changelog my-awesome-app#feature
Deploy your apps branches to different environments:
deploy my-awesome-app # deploy my-awesome-app default branch to default environment
deploy my-awesome-app to prod # deploy my-awesome-app default branch to prod environment
deploy my-awesome-app#my-feature to staging # deploy my-awesome-app my-feature branch to prod environment
in case of deploy fail you'll see the error message:
- Clone the repo
cp ./config/config.sample.rb ./config/config.rb
- Edit
./config/config.rb
to add configuration for your app bundle install --without development test
- You can try to launch bot with
SLACK_API_TOKEN=xxx bundle exec ruby run.rb
and test it - Launch bot as a daemon (you can use eye, upstart, systemd, etc.)
I'd recommend to use eye gem for launching bot. But it's up to you.
Please follow instruction on https://github.com/kostya/eye for installing eye
Put in the root .slack-api-token file which contains api token
Create config/slack-deploy-bot.eye config using config/slack-deploy-bot.eye.sample as sample
For first time or if slack-deploy-bot.eye config was changed than run:
eye load config/slack-deploy-bot.eye
Start bot:
eye start deploybot
Restart bot with command:
eye r deploybot
Info about bot process:
eye i deploybot
Copy config/config.sample.rb to config/config.rb
Example of config.rb
:
DeployBot.setup do |config|
config.apps = {
:'my-awesome-app' => {
envs: [:staging, :prod],
path: '~/projects/my-awesome-app',
default_branch: :master, # default branch to deploy, is not required
default_env: :prod, # default env to deploy, is not required
deploy_cmd: ->(env, branch) { "./deploy.sh #{env} #{branch}" } # deploy with Ansible for example
},
:'my-second-awesome-app': {
envs: [:dev, :prod],
path: '~/projects/my-second-awesome-app',
deploy_cmd: ->(env, branch) { "BRANCH_NAME=#{branch} bundle exec cap #{env} deploy" } # deploy with Capistrano
}
}
end
Required options for each app: envs, path, deploy_cmd
Start bot with command:
SLACK_API_TOKEN=xxx foreman start
Start console with:
bundle exec ./console
Run specs with:
bundle exec rake
Before starting specs please run:
git submodule update --init
for fetching spec/support/dummy_app
Configuration (apps, envs, default branch, deploy command)Notifications to channel about starting/ending/failing deploy eventsSpecs