]> git.openstreetmap.org Git - chef.git/commitdiff
Use bundler to install gems for taginfo
authorTom Hughes <tom@compton.nu>
Tue, 3 Jul 2018 17:41:30 +0000 (18:41 +0100)
committerTom Hughes <tom@compton.nu>
Tue, 3 Jul 2018 17:43:14 +0000 (18:43 +0100)
cookbooks/taginfo/recipes/default.rb

index 98a45e378958ea963f46d7af18a4e2a5ddc3e59f..4eb552e09ccf56fbb6be99aa03c545502f6fe93c 100644 (file)
@@ -49,10 +49,10 @@ ruby_version = node[:passenger][:ruby_version]
 
 package "ruby#{ruby_version}"
 
-%w[json sqlite3 sinatra sinatra-r18n rack-contrib].each do |gem|
-  gem_package gem do
-    gem_binary "gem#{ruby_version}"
-  end
+gem_package "bundler#{ruby_version}" do
+  package_name "bundler"
+  gem_binary "gem#{ruby_version}"
+  options "--format-executable"
 end
 
 apache_module "cache"
@@ -185,6 +185,17 @@ node[:taginfo][:sites].each do |site|
     subscribes :run, "git[#{directory}/osmium-tool]"
   end
 
+  execute "#{directory}/taginfo/Gemfile" do
+    action :nothing
+    command "bundle#{ruby_version} install"
+    cwd "#{directory}/taginfo"
+    user "root"
+    group "root"
+    subscribes :run, "gem_package[bundler#{ruby_version}]"
+    subscribes :run, "git[#{directory}/taginfo]"
+    notifies :restart, "passenger_application[#{directory}/taginfo/web/public]"
+  end
+
   %w[taginfo/web/tmp bin data data/old download sources planet planet/log planet/replication].each do |dir|
     directory "#{directory}/#{dir}" do
       owner "taginfo"
@@ -238,6 +249,8 @@ node[:taginfo][:sites].each do |site|
     variables :name => site_name, :directory => directory
   end
 
+  passenger_application "#{directory}/taginfo/web/public"
+
   ssl_certificate site_name do
     domains [site_name] + site_aliases
     notifies :reload, "service[apache2]"