Run taginfo updates from a daily cron job
authorTom Hughes <tom@compton.nu>
Mon, 17 Feb 2014 00:31:37 +0000 (00:31 +0000)
committerTom Hughes <tom@compton.nu>
Mon, 17 Feb 2014 00:43:24 +0000 (00:43 +0000)
cookbooks/taginfo/recipes/default.rb
cookbooks/taginfo/templates/default/cron.erb [new file with mode: 0644]

index ee3d887fee3342f37c8da14e7b65f51b1e1ae706..d6c0dd53b34fa5b1cf23284d05e9082d7d27927c 100644 (file)
@@ -46,6 +46,13 @@ gem_package "sinatra"
 gem_package "sinatra-r18n"
 gem_package "rack-contrib"
 
 gem_package "sinatra-r18n"
 gem_package "rack-contrib"
 
+template "/etc/cron.d/taginfo" do
+  source "cron.erb"
+  owner "root"
+  group "root"
+  mode 0644
+end
+
 directory "/var/log/taginfo" do
   owner "taginfo"
   group "taginfo"
 directory "/var/log/taginfo" do
   owner "taginfo"
   group "taginfo"
@@ -66,7 +73,7 @@ node[:taginfo][:sites].each do |site|
   icon = site[:icon]
   contact = site[:contact]
 
   icon = site[:icon]
   contact = site[:contact]
 
-  directory "/var/log/taginfo/#{site}" do
+  directory "/var/log/taginfo/#{name}" do
     owner "taginfo"
     group "taginfo"
     mode 0755
     owner "taginfo"
     group "taginfo"
     mode 0755
@@ -100,9 +107,11 @@ node[:taginfo][:sites].each do |site|
   settings["instance"]["description"] = description
   settings["instance"]["icon"] = "/img/logo/#{icon}.png"
   settings["instance"]["contact"] = contact
   settings["instance"]["description"] = description
   settings["instance"]["icon"] = "/img/logo/#{icon}.png"
   settings["instance"]["contact"] = contact
-  settings["logging"]["directory"] = "/var/log/taginfo/#{site}"
+  settings["logging"]["directory"] = "/var/log/taginfo/#{name}"
   settings["opensearch"]["shortname"] = "Taginfo"
   settings["opensearch"]["contact"] = "webmaster@openstreetmap.org"
   settings["opensearch"]["shortname"] = "Taginfo"
   settings["opensearch"]["contact"] = "webmaster@openstreetmap.org"
+  settings["sources"]["download"] = ""
+  settings["sources"]["create"] = "db languages josm potlatch wiki"
   settings["sources"]["db"]["planetfile"] = "#{directory}/planet/planet.pbf"
   settings["sources"]["db"]["tagstats"] = "#{directory}/taginfo/tagstats/tagstats"
   settings["tagstats"]["cxxflags"] = "-I../../osmium/include"
   settings["sources"]["db"]["planetfile"] = "#{directory}/planet/planet.pbf"
   settings["sources"]["db"]["tagstats"] = "#{directory}/taginfo/tagstats/tagstats"
   settings["tagstats"]["cxxflags"] = "-I../../osmium/include"
diff --git a/cookbooks/taginfo/templates/default/cron.erb b/cookbooks/taginfo/templates/default/cron.erb
new file mode 100644 (file)
index 0000000..b80cdf8
--- /dev/null
@@ -0,0 +1,9 @@
+# DO NOT EDIT - This file is being maintained by Chef
+
+<% node[:taginfo][:sites].each do |site| -%>
+<% if site[:directory] -%>
+0 1 * * * taginfo <%= site[:directory] %>/bin/update
+<% else -%>
+0 1 * * * taginfo /srv/<%= site[:name] %>/bin/update
+<% end -%>
+<% end -%>