Permalink
Browse files

adding intergrity recipe

  • Loading branch information...
1 parent 017258f commit 9bb3e2e1d21defefff9d276f525e9b63f4e98b82 Ezra Zygmuntowicz committed Mar 14, 2009
@@ -0,0 +1,25 @@
+class Chef
+ class Recipe
+ def if_app_needs_recipe(recipe, &block)
+ index = 0
+ node[:applications].map{|k,v| [k,v] }.sort_by {|a,b| a }.each do |name, app_data|
+ if app_data[:recipes].detect { |r| r == recipe }
+ Chef::Log.info("Applying Recipe: #{recipe}")
+ block.call(name, app_data, index)
+ index += 1
+ end
+ end
+ end
+
+ def any_app_needs_recipe?(recipe)
+ needs = false
+ node[:applications].each do |name, app_data|
+ if app_data[:recipes].detect { |r| r == recipe }
+ needs = true
+ end
+ end
+ needs
+ end
+
+ end
+end
@@ -0,0 +1,60 @@
+#
+# Cookbook Name:: integrity
+# Recipe:: default
+#
+# Copyright 2009, Engine Yard, Inc.
+#
+# All rights reserved - Do Not Redistribute
+#
+
+if any_app_needs_recipe?('integrity')
+
+ require 'digest/sha1'
+
+ gem_package 'foca-integrity-email' do
+ action :install
+ source "http://gems.github.com"
+ end
+
+ gem_package 'foca-sinatra-ditties' do
+ action :install
+ source "http://gems.github.com"
+ end
+
+ gem_package 'do_sqlite3' do
+ action :install
+ end
+
+ gem_package 'integrity' do
+ action :install
+ version '0.1.9.0'
+ end
+
+end
+
+if_app_needs_recipe("integrity") do |app,data,index|
+
+ execute "install integrity" do
+ command "integrity install --passenger /data/#{app}/current"
+ end
+
+ template "/data/#{app}/current/config.ru" do
+ owner node[:owner_name]
+ group node[:owner_name]
+ mode 0655
+ source "config.ru.erb"
+ end
+
+ template "/data/#{app}/current/config.yml" do
+ owner node[:owner_name]
+ group node[:owner_name]
+ mode 0655
+ source "config.yml.erb"
+ variables({
+ :app => app,
+ :domain => data[:vhosts].first[:name],
+ })
+ end
+
+end
+
@@ -0,0 +1,19 @@
+require "rubygems"
+require "integrity"
+
+# If you want to add any notifiers, install the gems and then require them here
+# For example, to enable the Email notifier: install the gem (from github:
+#
+# sudo gem install -s http://gems.github.com foca-integrity-email
+#
+# And then uncomment the following line:
+#
+# require "notifier/email"
+
+# Load configuration and initialize Integrity
+Integrity.new(File.dirname(__FILE__) + "/config.yml")
+
+# You probably don't want to edit anything below
+Integrity::App.set :environment, ENV["RACK_ENV"] || :production
+
+run Integrity::App
@@ -0,0 +1,41 @@
+# Domain where integrity will be running from. This is used to have
+# nice URLs in your notifications.
+# For example:
+# http://builder.integrityapp.com
+:base_uri: <%= @domain %>
+
+# This should be a complete connection string to your database.
+#
+# Examples:
+# * `mysql://user:password@localhost/integrity`
+# * `postgres://<:password@localhost/integrity`
+# * `sqlite3:///home/integrity/db/integrity.sqlite`
+#
+# Note:
+# * The appropriate data_objects adapter must be installed (`do_mysql`, etc)
+# * You must create the `integrity` database on localhost, of course.
+:database_uri: sqlite3:///data/<%= @app %>/current/integrity.db
+
+# This is where your project's code will be checked out to. Make sure it's
+# writable by the user that runs Integrity.
+:export_directory: /data/<%= @app %>/current/builds
+
+# Path to the integrity log file
+:log: /data/<%= @app %>/current/log/integrity.log
+
+# Enable or disable HTTP authentication for the app. BE AWARE that if you
+# disable this anyone can delete and alter projects, so do it only if your
+# app is running in a controlled environment (ie, behind your company's
+# firewall.)
+:use_basic_auth: false
+
+# When `use_basic_auth` is true, the admin's username for HTTP authentication.
+:admin_username: <%= @node[:owner_name] %>
+
+# When `use_basic_auth` is true, the admin's password. Usually saved as a
+# SHA1 hash. See the next option.
+:admin_password: <%= Digest::SHA1.hexdigest(@node[:owner_pass]) %>
+
+# If this is true, then whenever we authenticate the admin user, will hash
+# it using SHA1. If not, we'll assume the provided password is in plain text.
+:hash_admin_password: true

0 comments on commit 9bb3e2e

Please sign in to comment.