A Slack bot that helps you to deploy your apps. With this bot you’re able to build your own ChatOps tool!
For code please go to slack-deploy-bot
What it can do?
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:
Production
How to setup
- 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.
Launching with eye
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
Configuration
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
Development & Testing
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
Since you scrolled this far, you might as well take a look at some other things I wrote !
- Non-Standard Temperature Monitoring in an Apartment
- Нестандартный мониторинг температуры в квартире
- MacOS: tiling window manager
- Деплоим с докером без простоя
- Vim: Путь ниндзя
- How to resize a VirtualBox Virtual Machine hard disk with LVM
- Все мои компы
- 10 лет рабства
... or some other article from my blog.