Skip to content
This repository has been archived by the owner on Jul 11, 2020. It is now read-only.

Commit

Permalink
WIP hubot
Browse files Browse the repository at this point in the history
dwradcliffe committed Jul 18, 2014
1 parent e800ea3 commit 2e19c20
Showing 3 changed files with 109 additions and 0 deletions.
18 changes: 18 additions & 0 deletions cookbooks/rubygems-hubot/files/default/scripts/maintenance.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Description:
# Enable or disable maintenance mode on the load balancer.
#
# Dependencies:
# None
#
# Configuration:
#
# Commands:
# hubot turn on|off maintenance for staging|production
#
# Author:
# David Radcliffe

module.exports = (robot) ->

robot.hear /turn (on|off) maintenance( mode)? for (staging|production)/i, (msg) ->
msg.send "I have turned #{msg.match[1]} maintenance mode for the #{msg.match[3]} environment!"
7 changes: 7 additions & 0 deletions cookbooks/rubygems-hubot/metadata.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name 'rubygems-hubot'

version '0.0.1'

depends 'chef-vault'
depends 'hubot', '~> 1.0.2'
depends 'rsyslog'
84 changes: 84 additions & 0 deletions cookbooks/rubygems-hubot/recipes/default.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#
# Cookbook Name:: rubygems-hubot
# Recipe:: default
#

include_recipe 'chef-vault'
slack_secrets = chef_vault_item('slack', 'hubot')


node.set['hubot']['version'] = '2.4.6'
node.set['hubot']['scripts_version'] = '2.4.1'
node.set['hubot']['install_dir'] = '/srv/hubot'
node.set['hubot']['adapter'] = 'slack'

node.set['hubot']['dependencies'] = {
'hubot-slack' => '2.1.0',
'hubot-chef' => '>= 0.0.0',
'hubot-capistrano' => '1.0.2'
}

node.set['hubot']['hubot_scripts'] = %w{
ascii.coffee
base64.coffee
beerme.coffee
gemwhois.coffee
github-status.coffee
goooood.coffee
haters.coffee
kittens.coffee
likeaboss.coffee
look-of-disapproval.coffee
nice.coffee
rubygems.coffee
shipit.coffee
sudo.coffee
wunderground.coffee
xkcd.coffee
}

node.set['hubot']['external_scripts'] = %w{
hubot-chef
hubot-capistrano
}

directory '/var/lib/hubot-capistrano'

node.set['hubot']['config'] = {
'HUBOT_SLACK_TOKEN' => slack_secrets['token'],
'HUBOT_SLACK_TEAM' => 'rubygems',
'HUBOT_SLACK_BOTNAME' => 'hubot',
'HUBOT_CAP_DIR' => '/var/lib/hubot-capistrano'
}

include_recipe 'hubot'

remote_directory "#{node['hubot']['install_dir']}/scripts" do
source 'scripts'
files_backup 0
files_owner node['hubot']['user']
files_group node['hubot']['group']
files_mode 00644
owner node['hubot']['user']
group node['hubot']['group']
overwrite true
mode 00755
notifies :restart, 'service[hubot]'
end

include_recipe 'rsyslog'

template '/etc/rsyslog.d/30-hubot.conf' do
source 'rsyslog.conf.erb'
owner 'root'
group 'root'
mode '644'
notifies :restart, 'service[rsyslog]'
end

template '/etc/logrotate.d/hubot' do
source 'logrotate.erb'
owner 'root'
group 'root'
mode '644'
end

0 comments on commit 2e19c20

Please sign in to comment.