backup for nominatim
authorSarah Hoffmann <lonvia@denofr.de>
Thu, 8 Aug 2013 17:29:37 +0000 (19:29 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Thu, 8 Aug 2013 17:30:34 +0000 (19:30 +0200)
cookbooks/nominatim/recipes/default.rb
cookbooks/nominatim/templates/default/backup-nominatim.erb [new file with mode: 0644]

index 845bb7700bcf2383c674e8126438440d3531bf12..cd12156d87ad3c20f88e9d650e9fca1f297f7e4f 100644 (file)
@@ -243,3 +243,19 @@ end
 munin_plugin "nominatim_throttled_ips" do
   target "#{source_directory}/munin/nominatim_throttled_ips"
 end
+
+template "/usr/local/bin/backup-nominatim" do
+  source "backup-nominatim.erb"
+  owner "root"
+  group "root"
+  mode 0755
+end
+
+cron "nominatim_backup" do
+  hour "3"
+  minute "00"
+  day "1"
+  command "/usr/local/bin/backup-nominatim"
+  user "nominatim"
+  mailto email_errors
+end
diff --git a/cookbooks/nominatim/templates/default/backup-nominatim.erb b/cookbooks/nominatim/templates/default/backup-nominatim.erb
new file mode 100644 (file)
index 0000000..03dc01f
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+# DO NOT EDIT - This file is being maintained by Chef
+
+# Partial read-only backup only, to restore:
+#
+#   ./utils/setup.php --create-db --setup-db --create-functions --create-partition-functions
+#   pg_restore --no-tablespaces -O -d nominatim $F
+#   ./utils/setup.php --create-functions --create-partition-functions
+
+
+D=`date +%Y-%m-%d`
+F=/tmp/nominatim-${D}.dmp
+
+pg_dump --file=$F -F c -Z 9 -t 'country' -t file -t '*columns' -t 'import_polygon_*' -t import_status -t place_addressline -t placex -t search_name -t 'seq_*' -t word -t gb_postcode <%= node[:nominatim][:database][:dbname] %>
+
+rsync $F backup.openstreetmap.org::backup
+
+rm -f $F