From 4193b7c3aea52c461d1988aacb4e68751b533515 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Fri, 24 Mar 2023 16:49:03 +0000 Subject: [PATCH] Replace incron with inotifywait as the planetdump trigger --- cookbooks/planet/metadata.rb | 1 - cookbooks/planet/recipes/dump.rb | 21 ++++++++++++------- .../templates/default/planetdump-trigger.erb | 4 ++++ 3 files changed, 17 insertions(+), 9 deletions(-) create mode 100644 cookbooks/planet/templates/default/planetdump-trigger.erb diff --git a/cookbooks/planet/metadata.rb b/cookbooks/planet/metadata.rb index da36c0645..da493b5ba 100644 --- a/cookbooks/planet/metadata.rb +++ b/cookbooks/planet/metadata.rb @@ -10,7 +10,6 @@ depends "accounts" depends "apache" depends "apt" depends "git" -depends "incron" depends "munin" depends "ruby" depends "osmosis" diff --git a/cookbooks/planet/recipes/dump.rb b/cookbooks/planet/recipes/dump.rb index 39c8196dd..7bd11aece 100644 --- a/cookbooks/planet/recipes/dump.rb +++ b/cookbooks/planet/recipes/dump.rb @@ -17,15 +17,7 @@ # 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 "incron" package %w[ gcc @@ -50,6 +42,7 @@ package %w[ mktorrent xmlstarlet libxml2-utils + inotify-tools ] directory "/opt/planet-dump-ng" do @@ -125,6 +118,18 @@ systemd_service "planetdump@" do ] 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" diff --git a/cookbooks/planet/templates/default/planetdump-trigger.erb b/cookbooks/planet/templates/default/planetdump-trigger.erb new file mode 100644 index 000000000..b24197f4d --- /dev/null +++ b/cookbooks/planet/templates/default/planetdump-trigger.erb @@ -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 -- 2.39.5