subscribes :restart, "systemd_service[replicate]"
end
elsif node[:tile][:replication][:engine] == "osm2pgsql"
- service "expire-tiles.path" do
- action [:disable, :stop]
+ template "/usr/local/bin/expire-tiles" do
+ source "expire-tiles-osm2pgsql.erb"
+ owner "root"
+ group "root"
+ mode "755"
end
- systemd_path "expire-tiles" do
- action :delete
+ directory "/var/lib/replicate/expire-queue" do
+ owner "tile"
+ group "_renderd"
+ mode "775"
+ end
+
+ systemd_service "expire-tiles" do
+ description "Tile dirtying service"
+ type "simple"
+ user "_renderd"
+ exec_start "/usr/local/bin/expire-tiles"
+ nice 10
+ sandbox true
+ restrict_address_families "AF_UNIX"
+ read_write_paths tile_directories + [
+ "/var/lib/replicate/expire-queue"
+ ]
end
- service "expire-tiles" do
- action :stop
+ systemd_path "expire-tiles" do
+ description "Tile dirtying trigger"
+ directory_not_empty "/var/lib/replicate/expire-queue"
end
- systemd_service "expire-tiles" do
- action :delete
+ service "expire-tiles.path" do
+ action [:enable, :start]
+ subscribes :restart, "systemd_path[expire-tiles]"
end
- template "/usr/local/bin/expire-tiles" do
- source "expire-tiles-osm2pgsql.erb"
+ template "/usr/local/bin/replicate-post" do
+ source "replicate-post.erb"
owner "root"
group "root"
mode "755"
after "postgresql.service"
wants "postgresql.service"
user "tile"
- exec_start "/bin/osm2pgsql-replication update --database gis --post-processing /usr/local/bin/expire-tiles -- #{osm2pgsql_arguments.join(' ')}"
+ exec_start "/bin/osm2pgsql-replication update --database gis --post-processing /usr/local/bin/replicate-post -- #{osm2pgsql_arguments.join(' ')}"
sandbox :enable_network => true
restrict_address_families "AF_UNIX"
- read_write_paths tile_directories + [
- "/srv/tile.openstreetmap.org/tiles",
+ read_write_paths [
"/store/database/nodes",
"/var/lib/replicate"
]
-#!/bin/sh -e
+#!/usr/bin/ruby
# DO NOT EDIT - This file is being maintained by Chef
-sequence="$1"
-timestamp="$2"
+args = [
+ "--socket=/var/run/renderd/renderd.sock",
+ "--tile-dir=/srv/tile.openstreetmap.org/tiles",
+ "--touch-from=13",
+ "--min-zoom=13"
+]
-render_expired \
- --map=default \
- --socket=/var/run/renderd/renderd.sock \
- --tile-dir=/srv/tile.openstreetmap.org/tiles \
- --min-zoom=13 --max-zoom=19 \
- --touch-from=13 < /var/lib/replicate/dirty-tiles.txt
-
-rm -f /var/lib/replicate/dirty-tiles.txt
-
-echo "$sequence" > /var/log/replicate/sequence.txt
-echo "$timestamp" > /var/log/replicate/timestamp.txt
+Dir.glob("/var/lib/replicate/expire-queue/changes-*.txt").sort.each do |f|
+ <% node[:tile][:styles].each do |name,details| -%>
+ system("/usr/bin/render_expired", "--map=<%= name %>", *args, "--max-zoom=<%= details[:max_zoom] %>", :in=> f) &&
+ <% end -%>
+ File::unlink(f)
+end