From: Tom Hughes Date: Wed, 3 Feb 2021 15:43:12 +0000 (+0000) Subject: Prevent multiple low zoom renders running together X-Git-Url: https://git.openstreetmap.org/chef.git/commitdiff_plain/8fa2b7a61816cbdfc611f3db9373ec30b21f2915?ds=sidebyside Prevent multiple low zoom renders running together --- diff --git a/cookbooks/systemd/resources/service.rb b/cookbooks/systemd/resources/service.rb index 26cce2978..62c959692 100644 --- a/cookbooks/systemd/resources/service.rb +++ b/cookbooks/systemd/resources/service.rb @@ -22,7 +22,10 @@ default_action :create property :service, String, :name_property => true property :dropin, String property :description, String +property :condition_path_exists, [String, Array] +property :condition_path_exists_glob, [String, Array] property :after, [String, Array] +property :conflicts, [String, Array] property :wants, [String, Array] property :type, String, :is => %w[simple forking oneshot dbus notify idle] property :limit_nofile, Integer diff --git a/cookbooks/systemd/templates/default/service.erb b/cookbooks/systemd/templates/default/service.erb index 6d8a603cc..eff7b8308 100644 --- a/cookbooks/systemd/templates/default/service.erb +++ b/cookbooks/systemd/templates/default/service.erb @@ -4,9 +4,18 @@ <% if @description -%> Description=<%= @description %> <% end -%> +<% if @condition_path_exists -%> +ConditionPathExists=<%= Array(@condition_path_exists).join(" ") %> +<% end -%> +<% if @condition_path_exists_glob -%> +ConditionPathExistsGlob=<%= Array(@condition_path_exists_glob).join(" ") %> +<% end -%> <% if @after -%> After=<%= Array(@after).join(" ") %> <% end -%> +<% if @conflicts -%> +Conflicts=<%= Array(@conflicts).join(" ") %> +<% end -%> <% if @wants -%> Wants=<%= Array(@wants).join(" ") %> <% end -%> diff --git a/cookbooks/tile/recipes/default.rb b/cookbooks/tile/recipes/default.rb index 5299a3e38..7d5052fc2 100644 --- a/cookbooks/tile/recipes/default.rb +++ b/cookbooks/tile/recipes/default.rb @@ -274,8 +274,10 @@ nodejs_package "carto" systemd_service "update-lowzoom@" do description "Low zoom tile update service for %i layer" + conflicts "render-lowzoom.service" user "tile" exec_start "/bin/bash /usr/local/bin/update-lowzoom-%i" + runtime_directory "update-lowzoom-%i" private_tmp true private_devices true private_network true @@ -578,6 +580,7 @@ end systemd_service "render-lowzoom" do description "Render low zoom tiles" + condition_path_exists_glob "!/run/update-lowzoom-*" user "tile" exec_start "/usr/local/bin/render-lowzoom" private_tmp true