Permalink
Browse files

initial import - 0.0.1

  • Loading branch information...
0 parents commit c4088d02547372afcc483196d521d3206c6d0a18 @webframp committed Apr 11, 2012
@@ -0,0 +1,33 @@
+Description
+===========
+
+Cookbook to automatically deploy the Gdash web interface for
+Graphite.
+
+Requirements
+============
+
+## Platform:
+
+ * Debian/Ubuntu
+
+## Cookbooks
+
+ * build-essentials
+ * runit
+
+Attributes
+==========
+
+ See `attributes/default.rb` for defaults.
+
+ * `node['gdash']['graphite_whisperdb']` - Full path to graphite
+ database
+ * `node['gdash']['templatedir']` - Full path to graph templates
+
+Usage
+=====
+
+This cookbook currently sets up gdash and a basic runit service.
+Graph creation is left to the user.
+
@@ -0,0 +1,13 @@
+default.gdash.tarfile = "/usr/src/gdash.tgz"
+default.gdash.base = "/srv/gdash"
+default.gdash.url = "https://github.com/ripienaar/gdash/tarball/master"
+default.gdash.graphite_url = "http://#{fqdn}"
+default.gdash.templatedir = "/srv/gdash/graph_templates"
+default.gdash.basic_auth = false
+default.gdash.username = "gdash"
+default.gdash.password = "gdash"
+default.gdash.title = "Dashboard"
+default.gdash.refresh_rate = 60
+default.gdash.columns = 2
+default.gdash.graphite_whisperdb = "/opt/graphite/storage/whisper"
+default.gdash.port = 9292
@@ -0,0 +1,16 @@
+maintainer "Sean Escriva"
+maintainer_email "sean.escriva@gmail.com"
+license "Apache 2.0"
+description "Installs/Configures gdash"
+long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
+version "0.0.1"
+
+%w{debian ubuntu}.each do |os|
+ supports os
+end
+
+%w{build-essential runit}.each do |dep|
+ depends dep
+end
+
+suggests "iptables"
@@ -0,0 +1,69 @@
+#
+# Cookbook Name:: gdash
+# Recipe:: default
+#
+# Copyright 2012, Sean Escriva <sean.escriva@gmail.com>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+include_recipe "build-essential"
+
+%w[libcurl4-gnutls-dev ruby1.9.1-full].each do |pkg|
+ apt_package pkg
+end
+
+gem_package "bundler"
+
+remote_file node.gdash.tarfile do
+ mode "00666"
+ owner "www-data"
+ group "www-data"
+ source node.gdash.url
+ action :create_if_missing
+end
+
+directory node.gdash.base do
+ owner "www-data"
+ group "www-data"
+end
+
+directory File.join(node.gdash.base, "templates") do
+ owner "www-data"
+ group "www-data"
+end
+
+execute "bundle" do
+ command "bundle install --deployment --binstubs"
+ user "www-data"
+ group "www-data"
+ cwd node.gdash.base
+ creates File.join(node.gdash.base, "bin")
+ action :nothing
+end
+
+execute "gdash: untar" do
+ command "tar zxf #{node.gdash.tarfile} -C #{node.gdash.base} --strip-components=1"
+ creates File.join(node.gdash.base, "Gemfile.lock")
+ user "www-data"
+ group "www-data"
+ notifies :run, resources(:execute => "bundle"), :immediately
+end
+
+template File.join(node.gdash.base, "config", "gdash.yaml") do
+ owner "www-data"
+ group "www-data"
+ notifies :restart, "service[gdash]"
+end
+
+runit_service "gdash"
+
@@ -0,0 +1,20 @@
+#
+# Cookbook Name:: gdash
+# Recipe:: firewall
+#
+# Copyright 2012, Sean Escriva <sean.escriva@gmail.com>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+include_recipe "iptables"
+iptables_rule "port_gdash"
@@ -0,0 +1,32 @@
+:graphite: http://<%= node.gdash.fqdn %>
+:templatedir: <%= node.gdash.templatedir %>
+<% if node.gdash.basic_auth -%>
+:username: <%= node.gdash.username %>
+:password: <%= node.gdash.password %>
+<% end -%>
+:options:
+ :title: <%= node.gdash.title %>
+ :prefix:
+ :refresh_rate: <%= node.gdash.refresh_rate %>
+ :graph_columns: <%= node.gdash.columns %>
+ :graph_width: 500
+ :graph_height: 250
+ :whisper_dir: <%= node.gdash.graphite_whisperdb %>
+ :interval_filters:
+ - :label: Last Hour
+ :from: -1hour
+ :to: now
+ - :label: Last Day
+ :from: -1day
+ - :label: Last Week
+ :from: -1week
+ - :label: Last Month
+ :from: -1month
+ - :label: Last Year
+ :from: -1year
+ :intervals:
+ - [ "-1hour", "1 hour" ]
+ - [ "-2hour", "2 hour" ]
+ - [ "-1day", "1 day" ]
+ - [ "-1month", "1 month" ]
+ - [ "-1year", "1 year" ]
@@ -0,0 +1,2 @@
+# gdash
+-A FWR -p tcp -m tcp -m state --state NEW --dport <%= node.gdash.port %> -j ACCEPT -m comment --comment "Gdash sinatra app, running in Unicorn"
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec svlogd -tt ./main
@@ -0,0 +1,5 @@
+#!/bin/sh
+exec 2>&1
+cd <%= node.gdash.base %>
+export RACK_ENV=<%= node.chef_environment %>
+exec chpst -u www-data:www-data -l <%= node.gdash.base %>/lock -- bundle exec bin/rackup -p <%= node.gdash.port %> -E <%= node.chef_environment %> config.ru

0 comments on commit c4088d0

Please sign in to comment.