]> git.openstreetmap.org Git - chef.git/commitdiff
Replace incron with inotifywait as the planetdump trigger
authorTom Hughes <tom@compton.nu>
Fri, 24 Mar 2023 16:49:03 +0000 (16:49 +0000)
committerTom Hughes <tom@compton.nu>
Fri, 24 Mar 2023 16:49:03 +0000 (16:49 +0000)
cookbooks/planet/metadata.rb
cookbooks/planet/recipes/dump.rb
cookbooks/planet/templates/default/planetdump-trigger.erb [new file with mode: 0644]

index da36c06455a7e14415d60c827473563c700be853..da493b5bab7c49fb84ba87526dfa4692e2296fc8 100644 (file)
@@ -10,7 +10,6 @@ depends           "accounts"
 depends           "apache"
 depends           "apt"
 depends           "git"
 depends           "apache"
 depends           "apt"
 depends           "git"
-depends           "incron"
 depends           "munin"
 depends           "ruby"
 depends           "osmosis"
 depends           "munin"
 depends           "ruby"
 depends           "osmosis"
index 39c8196dd64d3dd1459b5cf9a93e890ec9e26983..7bd11aecef88497339137e48e5dddb376a6656ca 100644 (file)
 # limitations under the License.
 #
 
 # limitations under the License.
 #
 
-node.default[:incron][:planetdump] = {
-  :user => "root",
-  :path => "/store/backup",
-  :events => %w[IN_CREATE IN_MOVED_TO],
-  :command => "/bin/systemctl start planetdump@$#"
-}
-
 include_recipe "git"
 include_recipe "git"
-include_recipe "incron"
 
 package %w[
   gcc
 
 package %w[
   gcc
@@ -50,6 +42,7 @@ package %w[
   mktorrent
   xmlstarlet
   libxml2-utils
   mktorrent
   xmlstarlet
   libxml2-utils
+  inotify-tools
 ]
 
 directory "/opt/planet-dump-ng" do
 ]
 
 directory "/opt/planet-dump-ng" do
@@ -125,6 +118,18 @@ systemd_service "planetdump@" do
   ]
 end
 
   ]
 end
 
+systemd_service "planetdump-trigger" do
+  description "Planet dump trigger"
+  user "root"
+  exec_start "/usr/local/bin/planetdump-trigger"
+  sandbox true
+  restrict_address_families "AF_UNIX"
+end
+
+service "planetdump-trigger" do
+  action [:enable, :start]
+end
+
 systemd_service "planet-dump-mirror" do
   description "Update planet dump mirrors"
   exec_start "/usr/local/bin/planet-mirror-redirect-update"
 systemd_service "planet-dump-mirror" do
   description "Update planet dump mirrors"
   exec_start "/usr/local/bin/planet-mirror-redirect-update"
diff --git a/cookbooks/planet/templates/default/planetdump-trigger.erb b/cookbooks/planet/templates/default/planetdump-trigger.erb
new file mode 100644 (file)
index 0000000..b24197f
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+inotifywait --quiet --monitor --event CREATE --event MOVED_TO --include "/osm-[0-9]{4}-[0-9]{2}-[0-9]{2}\\.dmp\$" --format %f /store/backup | \
+  xargs -I %file% systemctl start planetdump@%file%.service