]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/web/resources/rails_port.rb
Merge pull request #177 from jburgess777/jburgess-raise-tilecache-limits
[chef.git] / cookbooks / web / resources / rails_port.rb
index 44c42470c20d7443b3ef90654e707b3d4aad7cc7..778d24ff4927d6b112b0e80f36abbb14f60d07b9 100644 (file)
@@ -107,6 +107,11 @@ action :create do
     options "--format-executable"
   end
 
     options "--format-executable"
   end
 
+  gem_package "bundler#{new_resource.ruby}" do
+    package_name "pkg-config"
+    gem_binary "gem#{new_resource.ruby}"
+  end
+
   declare_resource :directory, rails_directory do
     owner new_resource.user
     group new_resource.group
   declare_resource :directory, rails_directory do
     owner new_resource.user
     group new_resource.group
@@ -122,7 +127,7 @@ action :create do
     notifies :run, "execute[#{rails_directory}/Gemfile]"
     notifies :run, "execute[#{rails_directory}/public/assets]"
     notifies :delete, "file[#{rails_directory}/public/export/embed.html]"
     notifies :run, "execute[#{rails_directory}/Gemfile]"
     notifies :run, "execute[#{rails_directory}/public/assets]"
     notifies :delete, "file[#{rails_directory}/public/export/embed.html]"
-    notifies :run, "execute[#{rails_directory}]"
+    notifies :restart, "passenger_application[#{rails_directory}]"
   end
 
   declare_resource :directory, "#{rails_directory}/tmp" do
   end
 
   declare_resource :directory, "#{rails_directory}/tmp" do
@@ -146,7 +151,7 @@ action :create do
               :name => new_resource.database_name,
               :username => new_resource.database_username,
               :password => new_resource.database_password
               :name => new_resource.database_name,
               :username => new_resource.database_username,
               :password => new_resource.database_password
-    notifies :run, "execute[#{rails_directory}]"
+    notifies :restart, "passenger_application[#{rails_directory}]"
   end
 
   application_yml = edit_file "#{rails_directory}/config/example.application.yml" do |line|
   end
 
   application_yml = edit_file "#{rails_directory}/config/example.application.yml" do |line|
@@ -301,7 +306,7 @@ action :create do
     group "root"
     environment "NOKOGIRI_USE_SYSTEM_LIBRARIES" => "yes"
     subscribes :run, "gem_package[bundler#{new_resource.ruby}]"
     group "root"
     environment "NOKOGIRI_USE_SYSTEM_LIBRARIES" => "yes"
     subscribes :run, "gem_package[bundler#{new_resource.ruby}]"
-    notifies :run, "execute[#{rails_directory}]"
+    notifies :restart, "passenger_application[#{rails_directory}]"
   end
 
   execute "#{rails_directory}/db/migrate" do
   end
 
   execute "#{rails_directory}/db/migrate" do
@@ -311,7 +316,7 @@ action :create do
     user new_resource.user
     group new_resource.group
     subscribes :run, "git[#{rails_directory}]"
     user new_resource.user
     group new_resource.group
     subscribes :run, "git[#{rails_directory}]"
-    notifies :run, "execute[#{rails_directory}]"
+    notifies :restart, "passenger_application[#{rails_directory}]"
     only_if { new_resource.run_migrations }
   end
 
     only_if { new_resource.run_migrations }
   end
 
@@ -322,18 +327,14 @@ action :create do
     cwd rails_directory
     user new_resource.user
     group new_resource.group
     cwd rails_directory
     user new_resource.user
     group new_resource.group
-    notifies :run, "execute[#{rails_directory}]"
+    notifies :restart, "passenger_application[#{rails_directory}]"
   end
 
   file "#{rails_directory}/public/export/embed.html" do
     action :nothing
   end
 
   end
 
   file "#{rails_directory}/public/export/embed.html" do
     action :nothing
   end
 
-  execute rails_directory do
-    action :nothing
-    command "passenger-config restart-app --ignore-app-not-running #{rails_directory}"
-    user "root"
-    group "root"
+  passenger_application rails_directory do
     only_if { ::File.exist?("/usr/bin/passenger-config") }
   end
 
     only_if { ::File.exist?("/usr/bin/passenger-config") }
   end
 
@@ -348,11 +349,8 @@ action :create do
 end
 
 action :restart do
 end
 
 action :restart do
-  execute rails_directory do
-    action :run
-    command "passenger-config restart-app --ignore-app-not-running #{rails_directory}"
-    user "root"
-    group "root"
+  passenger_application rails_directory do
+    action :restart
   end
 end
 
   end
 end