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

Commit

Permalink
start stat-update cookbook
Browse files Browse the repository at this point in the history
dwradcliffe committed Nov 1, 2014
1 parent ce9dd2f commit 2a606d8
Showing 5 changed files with 37 additions and 0 deletions.
1 change: 1 addition & 0 deletions Berksfile
Original file line number Diff line number Diff line change
@@ -31,6 +31,7 @@ cookbook 'rubygems-repo', path: 'cookbooks/rubygems-repo'
cookbook 'rubygems-ruby', path: 'cookbooks/rubygems-ruby'
cookbook 'rubygems-sensu', path: 'cookbooks/rubygems-sensu'
cookbook 'rubygems-ssh', path: 'cookbooks/rubygems-ssh'
cookbook 'rubygems-stat-update', path: 'cookbooks/rubygems-stat-update'
cookbook 'rubygems-utility', path: 'cookbooks/rubygems-utility'

# Add cookbooks which diverge from the versions available on the community
4 changes: 4 additions & 0 deletions Berksfile.lock
Original file line number Diff line number Diff line change
@@ -75,6 +75,8 @@ DEPENDENCIES
path: cookbooks/rubygems-sensu
rubygems-ssh
path: cookbooks/rubygems-ssh
rubygems-stat-update
path: cookbooks/rubygems-stat-update
rubygems-utility
path: cookbooks/rubygems-utility

@@ -308,6 +310,8 @@ GRAPH
uchiwa (>= 0.0.0)
rubygems-ssh (0.0.5)
openssh (>= 0.0.0)
rubygems-stat-update (0.0.1)
runit (>= 0.0.0)
rubygems-utility (0.0.8)
apt (>= 0.0.0)
runit (1.4.6)
5 changes: 5 additions & 0 deletions cookbooks/rubygems-stat-update/metadata.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
name 'rubygems-stat-update'

version '0.0.1'

depends 'runit'
24 changes: 24 additions & 0 deletions cookbooks/rubygems-stat-update/recipes/default.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#
# Cookbook Name:: rubygems-stat-update
# Recipe:: default
#

include_recipe 'runit'

user 'stat-update' do
shell '/bin/false'
home '/var/run/stat-update'
system true
end

# TODO: intall package

redis_host = data_bag_item('hosts', 'redis')['environments'][node.chef_environment]
redis_ip = search('node', "name:#{redis_host}.#{node.chef_environment}.rubygems.org")[0]['ipaddress']

runit_service 'stat-update' do
owner 'stat-update'
group 'stat-update'
default_logger true
options(redis_host: redis_ip)
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
exec 2>&1
exec /usr/local/bin/stat-update -r <%= @options[:redis_host] %> -h http://production.cf.rubygems.org/gems/

0 comments on commit 2a606d8

Please sign in to comment.