+package "liblockfile-simple-perl"
+package "libfilesys-df-perl"
+
+template "/usr/local/bin/cleanup-tiles" do
+ source "cleanup-tiles.erb"
+ owner "root"
+ group "root"
+ mode "755"
+end
+
+systemd_service "cleanup-tiles@" do
+ description "Cleanup old tiles for /%I"
+ exec_start "/usr/local/bin/cleanup-tiles /%I"
+ user "_renderd"
+ io_scheduling_class "idle"
+ sandbox true
+ read_write_paths "/%I"
+end
+
+systemd_timer "cleanup-tiles@" do
+ description "Cleanup old tiles for /%I"
+ on_boot_sec "30m"
+ on_unit_inactive_sec "60m"
+ randomized_delay_sec "10m"
+end
+
+tile_directories.each do |directory|
+ label = directory[1..].gsub("/", "-")
+
+ service "cleanup-tiles@#{label}.timer" do
+ action [:enable, :start]
+ end
+end
+
+package "ruby-webrick"
+
+prometheus_exporter "modtile" do
+ port 9494
+end
+
+prometheus_exporter "renderd" do
+ port 9393
+end