aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSeb Bacon <seb.bacon@gmail.com>2012-03-15 08:43:53 +0000
committerSeb Bacon <seb.bacon@gmail.com>2012-03-15 08:43:53 +0000
commitffa1ec02f7838c13b33a836d715498ecaa3e5b3a (patch)
tree989018c90d8ff41e4a7cf61438f83da6865509f1
parentaea78ca01b8a01243689014c24fa1f5565323206 (diff)
Provision more stuff with chef (not particularly smartly, mind...).
-rw-r--r--Gemfile3
-rw-r--r--Gemfile.lock8
-rw-r--r--chef/cookbooks/alaveteli/attributes/default.rb1
-rw-r--r--chef/cookbooks/alaveteli/recipes/default.rb18
-rw-r--r--chef/cookbooks/alaveteli/templates/default/database.yml.erb6
-rw-r--r--chef/cookbooks/bundler/attributes/bundler.rb1
-rw-r--r--chef/cookbooks/bundler/metadata.json81
-rw-r--r--chef/cookbooks/bundler/readme.md28
-rw-r--r--chef/cookbooks/bundler/recipes/default.rb13
-rw-r--r--chef/cookbooks/bundler/recipes/install.rb4
-rw-r--r--chef/cookbooks/bundler/recipes/lock.rb4
-rw-r--r--chef/cookbooks/bundler/recipes/pack.rb4
-rw-r--r--chef/cookbooks/bundler/recipes/unlock.rb4
-rw-r--r--chef/solo.json6
-rw-r--r--config/environments/development.rb1
-rw-r--r--contrib/xapian-full-1.2.9.gembin0 -> 5580800 bytes
-rw-r--r--contrib/xapian-full.gemspec34
-rw-r--r--doc/INSTALL-vagrant.md8
18 files changed, 205 insertions, 19 deletions
diff --git a/Gemfile b/Gemfile
index 57464256c..76d8c58ad 100644
--- a/Gemfile
+++ b/Gemfile
@@ -28,7 +28,8 @@ gem 'ruby-msg', '~> 1.5.0'
gem 'test-unit', '~> 1.2.3' if RUBY_VERSION.to_f >= 1.9
gem 'vpim'
gem 'will_paginate', '~> 2.3.11'
-gem 'xapian-full'
+# when 1.2.9 is released by the maintainer, we can remove the local copy of this gem
+gem 'xapian-full', '~> 1.2.9', :path => 'contrib'
gem 'xml-simple'
gem 'zip'
diff --git a/Gemfile.lock b/Gemfile.lock
index 8cf57fc79..8084ffd20 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -1,3 +1,8 @@
+PATH
+ remote: contrib
+ specs:
+ xapian-full (1.2.9)
+
GEM
remote: http://rubygems.org/
specs:
@@ -44,7 +49,6 @@ GEM
ruby-ole (1.2.11.2)
vpim (0.695)
will_paginate (2.3.16)
- xapian-full (1.2.3)
xml-simple (1.1.0)
zip (2.0.2)
@@ -71,6 +75,6 @@ DEPENDENCIES
ruby-msg (~> 1.5.0)
vpim
will_paginate (~> 2.3.11)
- xapian-full
+ xapian-full (~> 1.2.9)!
xml-simple
zip
diff --git a/chef/cookbooks/alaveteli/attributes/default.rb b/chef/cookbooks/alaveteli/attributes/default.rb
index 461ea7aba..4e9031b6c 100644
--- a/chef/cookbooks/alaveteli/attributes/default.rb
+++ b/chef/cookbooks/alaveteli/attributes/default.rb
@@ -1,3 +1,4 @@
node.default["root"] = File.join(File.dirname(__FILE__), "../../../../")
node.default["user"] = ENV['USERNAME']
node.default["group"] = ENV['USERNAME']
+node.default["database_prefix"] = "foi"
diff --git a/chef/cookbooks/alaveteli/recipes/default.rb b/chef/cookbooks/alaveteli/recipes/default.rb
index 1cb7d80cd..80146ff3e 100644
--- a/chef/cookbooks/alaveteli/recipes/default.rb
+++ b/chef/cookbooks/alaveteli/recipes/default.rb
@@ -38,3 +38,21 @@ cookbook_file "#{node[:root]}/config/general.yml" do
owner node[:user]
group node[:group]
end
+
+# install dependencies
+require_recipe "bundler::install"
+
+bash "create databases" do
+ cwd node[:root]
+ code "rake db:create:all"
+end
+
+bash "checkout submodules" do
+ cwd node[:root]
+ code "git submodule update --init"
+end
+
+bash "run the post-install script" do
+ cwd node[:root]
+ code "./script/rails-post-deploy"
+end
diff --git a/chef/cookbooks/alaveteli/templates/default/database.yml.erb b/chef/cookbooks/alaveteli/templates/default/database.yml.erb
index 78193bfda..cf904916c 100644
--- a/chef/cookbooks/alaveteli/templates/default/database.yml.erb
+++ b/chef/cookbooks/alaveteli/templates/default/database.yml.erb
@@ -3,7 +3,7 @@
development:
adapter: postgresql
- database: foi_development
+ database: <%= node['database_prefix'] %>_development
username: postgres
password: <%= node['postgresql']['password']['postgres'] %>
host: localhost
@@ -14,7 +14,7 @@ development:
# Do not set this db to the same as development or production.
test:
adapter: postgresql
- database: foi_test
+ database: <%= node['database_prefix'] %>_test
username: postgres
password: <%= node['postgresql']['password']['postgres'] %>
host: localhost
@@ -22,7 +22,7 @@ test:
production:
adapter: postgresql
- database: foi_production
+ database: <%= node['database_prefix'] %>_production
username: postgres
password: <%= node['postgresql']['password']['postgres'] %>
host: localhost
diff --git a/chef/cookbooks/bundler/attributes/bundler.rb b/chef/cookbooks/bundler/attributes/bundler.rb
new file mode 100644
index 000000000..ed43f857b
--- /dev/null
+++ b/chef/cookbooks/bundler/attributes/bundler.rb
@@ -0,0 +1 @@
+set_unless[:bundler][:apps_path] = "/home/ubuntu/apps"
diff --git a/chef/cookbooks/bundler/metadata.json b/chef/cookbooks/bundler/metadata.json
new file mode 100644
index 000000000..278b80e4a
--- /dev/null
+++ b/chef/cookbooks/bundler/metadata.json
@@ -0,0 +1,81 @@
+{
+ "dependencies": {
+ "rubygems": [
+
+ ]
+ },
+ "maintainer_email": "cookbooks@jackhq.com",
+ "conflicting": {
+
+ },
+ "description": "Installs bundler and provides recipes to bundle actions",
+ "recipes": {
+ "bundler": "",
+ "bundler": "install",
+ "bundler": "pack",
+ "bundler": "lock",
+ "bundler": "unlock"
+
+ },
+ "providing": {
+ "bundler": [
+
+ ]
+ },
+ "platforms": {
+ "ubuntu": [
+
+ ],
+ "debian": [
+
+ ]
+ },
+ "version": "0.2.0",
+ "name": "bundler",
+ "replacing": {
+
+ },
+ "groupings": {
+
+ },
+ "long_description": "See Readme.md",
+ "attributes": {
+ "bundler/app_path": {
+ "default": "/home/ubuntu/apps",
+ "calculated": false,
+ "type": "string",
+ "choice": [
+
+ ],
+ "description": "Your Rack App Path",
+ "display_name": "Application Path",
+ "required": "optional",
+ "recipes": [
+
+ ]
+ },
+ "bundler/app": {
+ "default": "my_app",
+ "calculated": false,
+ "type": "string",
+ "choice": [
+
+ ],
+ "description": "Your Rack App",
+ "display_name": "Application Name",
+ "required": "optional",
+ "recipes": [
+
+ ]
+ }
+
+ },
+ "recommendations": {
+
+ },
+ "license": "Apache 2.0",
+ "maintainer": "Jack Russell Software Company, LLC",
+ "suggestions": {
+
+ }
+} \ No newline at end of file
diff --git a/chef/cookbooks/bundler/readme.md b/chef/cookbooks/bundler/readme.md
new file mode 100644
index 000000000..d294daeff
--- /dev/null
+++ b/chef/cookbooks/bundler/readme.md
@@ -0,0 +1,28 @@
+# Bundler Recipe
+
+The default recipe installs bundler and this cookbook as the following also added recipes:
+
+ # Executes bundle install at the app_path/app/current directory
+ bundler:install
+
+ # Executes bundle pack at the app_path/app/current directory
+ bundler:pack
+
+ # Executes bundle lock at the app_path/app/current directory
+ bundler:lock
+
+ # Executes bundle unlock at the app_path/app/current directory
+ bundler:unlock
+
+
+## Support
+
+ Email Jack Russell Software
+
+ support@jackrussellsoftware.com
+
+ or
+
+ http://support.jackrussellsoftware.com
+
+ \ No newline at end of file
diff --git a/chef/cookbooks/bundler/recipes/default.rb b/chef/cookbooks/bundler/recipes/default.rb
new file mode 100644
index 000000000..50d8643c3
--- /dev/null
+++ b/chef/cookbooks/bundler/recipes/default.rb
@@ -0,0 +1,13 @@
+include_recipe "ruby"
+include_recipe "rubygems"
+
+%w{ bundler }.each do |bundler_gem|
+ gem_package bundler_gem do
+ if node[:bundler][:version]
+ version node[:bundler][:version]
+ action :install
+ else
+ action :install
+ end
+ end
+end
diff --git a/chef/cookbooks/bundler/recipes/install.rb b/chef/cookbooks/bundler/recipes/install.rb
new file mode 100644
index 000000000..949fc85cf
--- /dev/null
+++ b/chef/cookbooks/bundler/recipes/install.rb
@@ -0,0 +1,4 @@
+bash "run bundle install in app directory" do
+ cwd node[:root]
+ code "bundle install"
+end
diff --git a/chef/cookbooks/bundler/recipes/lock.rb b/chef/cookbooks/bundler/recipes/lock.rb
new file mode 100644
index 000000000..4d672c994
--- /dev/null
+++ b/chef/cookbooks/bundler/recipes/lock.rb
@@ -0,0 +1,4 @@
+bash "run bundle install in app directory" do
+ cwd File.join(node[:bundler][:apps_path], node[:bundler][:app], "current")
+ code "bundle lock"
+end
diff --git a/chef/cookbooks/bundler/recipes/pack.rb b/chef/cookbooks/bundler/recipes/pack.rb
new file mode 100644
index 000000000..541eff3a2
--- /dev/null
+++ b/chef/cookbooks/bundler/recipes/pack.rb
@@ -0,0 +1,4 @@
+bash "run bundle install in app directory" do
+ cwd File.join(node[:bundler][:apps_path], node[:bundler][:app], "current")
+ code "bundle pack"
+end
diff --git a/chef/cookbooks/bundler/recipes/unlock.rb b/chef/cookbooks/bundler/recipes/unlock.rb
new file mode 100644
index 000000000..8b6f957ab
--- /dev/null
+++ b/chef/cookbooks/bundler/recipes/unlock.rb
@@ -0,0 +1,4 @@
+bash "run bundle install in app directory" do
+ cwd File.join(node[:bundler][:apps_path], node[:bundler][:app], "current")
+ code "bundle unlock"
+end
diff --git a/chef/solo.json b/chef/solo.json
index 8c71a79fc..c5a99e062 100644
--- a/chef/solo.json
+++ b/chef/solo.json
@@ -1,5 +1,3 @@
{
- "run_list": [ "recipe[alaveteli::default]" ],
- "user": "<user>",
- "group": "<group>"
-} \ No newline at end of file
+ "run_list": [ "recipe[alaveteli::default]" ]
+}
diff --git a/config/environments/development.rb b/config/environments/development.rb
index d5f2f5772..b605ed611 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -22,4 +22,3 @@ config.action_mailer.delivery_method = :sendmail # so is queued, rather than giv
# require 'memory_profiler'
# MemoryProfiler.start :string_debug => true, :delay => 10
-config.gem "gettext", :version => '>=1.9.3', :lib => false
diff --git a/contrib/xapian-full-1.2.9.gem b/contrib/xapian-full-1.2.9.gem
new file mode 100644
index 000000000..37ca7951d
--- /dev/null
+++ b/contrib/xapian-full-1.2.9.gem
Binary files differ
diff --git a/contrib/xapian-full.gemspec b/contrib/xapian-full.gemspec
new file mode 100644
index 000000000..3c6cec9c7
--- /dev/null
+++ b/contrib/xapian-full.gemspec
@@ -0,0 +1,34 @@
+# -*- encoding: utf-8 -*-
+
+Gem::Specification.new do |s|
+ s.name = %q{xapian-full}
+ s.version = "1.2.9"
+
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
+ s.authors = ["Tom Adams", "Rich Lane", "Seb Bacon"]
+ s.date = %q{2009-12-21}
+ s.description = %q{Xapian bindings for Ruby without dependency on system Xapian library}
+ s.email = %q{rlane@club.cc.cmu.edu}
+ s.extensions = ["Rakefile"]
+ s.files = [
+ "lib/xapian.rb",
+ "Rakefile",
+ "xapian-bindings-1.2.9.tar.gz",
+ "xapian-core-1.2.9.tar.gz",
+ "xapian-full.gemspec",
+ ]
+ s.rdoc_options = ["--charset=UTF-8"]
+ s.require_paths = ["lib"]
+ s.rubygems_version = %q{1.3.3}
+ s.summary = %q{xapian-core + Ruby xapian-bindings}
+
+ if s.respond_to? :specification_version then
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
+ s.specification_version = 3
+
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
+ else
+ end
+ else
+ end
+end
diff --git a/doc/INSTALL-vagrant.md b/doc/INSTALL-vagrant.md
index 08af70d11..35561f4a7 100644
--- a/doc/INSTALL-vagrant.md
+++ b/doc/INSTALL-vagrant.md
@@ -22,10 +22,6 @@ Usage
git clone https://github.com/sebbacon/alaveteli.git
cd alaveteli
-### Clone the submodules
-
- git submodule update --init
-
### Download, install and run VM
NOTE: This will download at least 400MB and take some time (30 minutes with a
@@ -42,10 +38,6 @@ shared folders.
vagrant ssh
cd /vagrant
-### Setup the database
-
- rake db:create && rake db:migrate
-
### Load sample data and index it
./script/load-sample-data && ./script/rebuild-xapian-index