Created
February 20, 2009 14:13
-
-
Save kamal/67467 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "apps": [ | |
| "foo" | |
| ], | |
| "apache": | |
| { | |
| "foo": | |
| { | |
| "server_name": "example.com", | |
| "aliases": [ | |
| "www.example.com" | |
| ], | |
| "max_pool_size": 10, | |
| "enable": true | |
| } | |
| }, | |
| "rails_env": "staging", | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /var/chef/cache/cookbooks/passenger/recipes/default.rb:53:in `[]': Symbol as array index (TypeError) | |
| from /var/chef/cache/cookbooks/passenger/recipes/default.rb:53:in `from_file' | |
| from /usr/lib/ruby/gems/1.8/gems/chef-0.5.1/lib/chef/recipe.rb:161:in `instance_eval' | |
| from /usr/lib/ruby/gems/1.8/gems/chef-0.5.1/lib/chef/recipe.rb:161:in `method_missing' | |
| from /var/chef/cache/cookbooks/passenger/recipes/default.rb:50:in `from_file' | |
| from /var/chef/cache/cookbooks/passenger/recipes/default.rb:33:in `each' | |
| from /var/chef/cache/cookbooks/passenger/recipes/default.rb:33:in `from_file' | |
| from /usr/lib/ruby/gems/1.8/gems/chef-0.5.1/lib/chef/cookbook.rb:139:in `load_recipe' | |
| from /usr/lib/ruby/gems/1.8/gems/chef-0.5.1/lib/chef/recipe.rb:79:in `include_recipe' | |
| ... 15 levels... | |
| from /usr/lib/ruby/gems/1.8/gems/chef-0.5.1/bin/chef-client:108:in `loop' | |
| from /usr/lib/ruby/gems/1.8/gems/chef-0.5.1/bin/chef-client:108 | |
| from /usr/bin/chef-client:19:in `load' | |
| from /usr/bin/chef-client:19 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| node[:apps].each do |app| | |
| template "/etc/apache2/sites-available/#{app}_#{node[:rails_env]}" do | |
| owner 'root' | |
| group 'root' | |
| mode 0644 | |
| source "application.vhost.erb" | |
| variables({ | |
| :docroot => "/data/#{app}/current/public", | |
| :server_name => node[:apache][app][:server_name], | |
| :max_pool_size => node[:apache][app][:max_pool_size] || 2, | |
| :env => node[:rails_env], | |
| :aliases => node[:apache][app][:aliases], | |
| :app => app | |
| }) | |
| notifies :reload, resources(:service => "apache2") | |
| end | |
| apache_site "#{app}_#{node[:rails_env]}" do | |
| enable node[:apache][app][:enable] | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| node[:apps].each do |app| | |
| template "/etc/apache2/sites-available/#{app}_#{node[:rails_env]}" do | |
| owner 'root' | |
| group 'root' | |
| mode 0644 | |
| source "application.vhost.erb" | |
| variables({ | |
| :docroot => "/data/#{app}/current/public", | |
| :server_name => node[:apache][app][:server_name], | |
| :max_pool_size => node[:apache][app][:max_pool_size] || 2, | |
| :env => node[:rails_env], | |
| :aliases => node[:apache][app][:aliases], | |
| :app => app | |
| }) | |
| notifies :reload, resources(:service => "apache2") | |
| end | |
| enabled_flag = node[:apache][app][:enable] # what's up with closures, man? | |
| apache_site "#{app}_#{node[:rails_env]}" do | |
| enable enabled_flag | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment