-
-
Save schisamo/6e4b07ec2a650baa7ac3 to your computer and use it in GitHub Desktop.
hubot deploy cookbook
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
default['hubot']['user'] = "hubot" | |
default['hubot']['group'] = "hubot" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Cookbook Name:: opscode-hubot | |
# Recipe:: default | |
# | |
# Copyright 2011, Opscode | |
# | |
# All rights reserved - Do Not Redistribute | |
# | |
include_recipe "node" | |
include_recipe "opscode-github" | |
include_recipe "runit" | |
env = data_bag_item("environments", node[:app_environment]) | |
user node['hubot']['user'] do | |
home "/srv/hubot" | |
end | |
group node['hubot']['group'] do | |
members [node['hubot']['user']] | |
end | |
directory "/srv/hubot" do | |
owner node['hubot']['user'] | |
group node['hubot']['group'] | |
mode "0755" | |
end | |
# required os packages | |
%w{ libexpat1 libexpat1-dev }.each do |pkg| | |
package pkg do | |
action :install | |
end | |
end | |
node_npm "coffee-script" do | |
action :install | |
end | |
hubot_config = env.select{|k,v| k =~ /hubot_/i}.inject(Hash.new) do |h,k| | |
{k[0] => k[1]}.merge(h) | |
end | |
git "hubot-clone" do | |
destination "/srv/hubot" | |
repository "git@github.com:opscode/opscode-hubot.git" | |
revision "master" | |
user node['hubot']['user'] | |
group node['hubot']['group'] | |
action :sync | |
notifies :restart, 'service[hubot]', :delayed | |
end | |
runit_service "hubot" do | |
options hubot_config | |
action :enable | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
maintainer "Opscode Dev Team" | |
maintainer_email "dev@opscode.com" | |
license "All rights reserved" | |
description "Installs/Configures opscode-hubot" | |
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) | |
version "0.0.1" | |
depends "node" | |
depends "opscode-github" | |
depends "runit" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
exec chpst -unobody logger -d -p local6.info -t [opscode-hubot] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
exec 2>&1 | |
cd /srv/hubot | |
exec chpst -u <=% node['hubot']['user'] %> \ | |
-U <=% node['hubot']['user'] %> env HOME="/srv/hubot" \ | |
<% @options.each_pair do |k,v| -%> | |
<%= "#{k.to_s.upcase}='#{v}' \\" %> | |
<% end -%> | |
bin/hubot -a hipchat -n "<%= @options['hubot_hipchat_name'] %>" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment