Skip to content

Instantly share code, notes, and snippets.

@schisamo
Created January 25, 2012 16:56
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save schisamo/6e4b07ec2a650baa7ac3 to your computer and use it in GitHub Desktop.
Save schisamo/6e4b07ec2a650baa7ac3 to your computer and use it in GitHub Desktop.
hubot deploy cookbook

Description

Requirements

Attributes

Usage

default['hubot']['user'] = "hubot"
default['hubot']['group'] = "hubot"
#
# 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
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"
#!/bin/sh
exec chpst -unobody logger -d -p local6.info -t [opscode-hubot]
#!/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