Enable GPX upload for dev apis using the job queue
authorTom Hughes <tom@compton.nu>
Sun, 24 Mar 2019 17:19:57 +0000 (17:19 +0000)
committerTom Hughes <tom@compton.nu>
Sun, 24 Mar 2019 17:19:57 +0000 (17:19 +0000)
cookbooks/dev/recipes/default.rb
cookbooks/web/resources/rails_port.rb

index 613305d..63d82b3 100644 (file)
@@ -243,6 +243,7 @@ if node[:postgresql][:clusters][:"9.5/main"]
     log_directory = "#{site_directory}/logs"
     rails_directory = "#{site_directory}/rails"
     cgimap_directory = "#{site_directory}/cgimap"
+    gpx_directory = "#{site_directory}/gpx"
 
     if details[:repository]
       site_aliases = details[:aliases] || []
@@ -273,6 +274,24 @@ if node[:postgresql][:clusters][:"9.5/main"]
         mode 0o755
       end
 
+      directory gpx_directory do
+        owner "apis"
+        group "apis"
+        mode 0o755
+      end
+
+      directory "#{gpx_directory}/traces" do
+        owner "apis"
+        group "apis"
+        mode 0o755
+      end
+
+      directory "#{gpx_directory}/images" do
+        owner "apis"
+        group "apis"
+        mode 0o755
+      end
+
       rails_port site_name do
         ruby ruby_version
         directory rails_directory
@@ -283,10 +302,12 @@ if node[:postgresql][:clusters][:"9.5/main"]
         database_port node[:postgresql][:clusters][:"9.5/main"][:port]
         database_name database_name
         database_username "apis"
+        gpx_dir gpx_directory
         log_path "#{log_directory}/rails.log"
         memcache_servers ["127.0.0.1"]
         csp_enforce true
         run_migrations true
+        trace_use_job_queue true
       end
 
       template "#{rails_directory}/config/initializers/setup.rb" do
index a404011..f86c481 100644 (file)
@@ -66,6 +66,7 @@ property :totp_key, String
 property :csp_enforce, [TrueClass, FalseClass], :default => false
 property :csp_report_url, String
 property :piwik_configuration, Hash
+property :trace_use_job_queue, [TrueClass, FalseClass], :default => false
 
 action :create do
   package %W[
@@ -309,7 +310,8 @@ action :create do
     "thunderforest_key",
     "totp_key",
     "csp_enforce",
-    "csp_report_url"
+    "csp_report_url",
+    "trace_use_job_queue"
   ).reject { |_k, v| v.nil? }.merge(
     "server_protocol" => "https",
     "server_url" => new_resource.site,
@@ -317,8 +319,7 @@ action :create do
     "support_email" => "support@openstreetmap.org",
     "email_return_path" => "bounces@openstreetmap.org",
     "geonames_username" => "openstreetmap",
-    "geoip_database" => "/usr/share/GeoIP/GeoIPv6.dat",
-    "trace_use_job_queue" => false
+    "geoip_database" => "/usr/share/GeoIP/GeoIPv6.dat"
   )
 
   if new_resource.memcache_servers