]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/imagery/recipes/tiler.rb
imagery: use new custom command
[chef.git] / cookbooks / imagery / recipes / tiler.rb
index 028e8e34ec334a2178f0bef76e5cd4fdf8a3d129..319cb5794a749e11a70fc90665def050786b8f11 100644 (file)
@@ -37,11 +37,10 @@ container_image = if arm?
 podman_service "titiler" do
   description "Container service for titiler"
   image container_image
-  ports 8080 => 8080
-  volume "/store/imagery" => "/store/imagery"
-  environment :PORT                                => 8080,
-              :WORKERS_PER_CORE                    => 1,
-              :GDAL_CACHEMAX                       => 200,
+  volume :"/store/imagery"       => "/store/imagery",
+         :"/srv/imagery/sockets" => "/sockets"
+  environment :GDAL_CACHEMAX                       => 200,
+              :GDAL_BAND_BLOCK_CACHE               => "HASHSET",
               :GDAL_DISABLE_READDIR_ON_OPEN        => "EMPTY_DIR",
               :GDAL_INGESTED_BYTES_AT_OPEN         => 32768,
               :GDAL_HTTP_MERGE_CONSECUTIVE_RANGES  => "YES",
@@ -51,6 +50,7 @@ podman_service "titiler" do
               :VSI_CACHE_SIZE                      => 5000000,
               :TITILER_API_ROOT_PATH               => "/api/v1/titiler",
               :FORWARDED_ALLOW_IPS                 => "*" # https://docs.gunicorn.org/en/latest/settings.html#forwarded-allow-ips
+  command "gunicorn -k uvicorn.workers.UvicornWorker titiler.application.main:app --bind unix:/sockets/titiler.sock --workers #{node.cpu_cores}"
 end
 
 systemd_service "titiler-restart" do
@@ -62,8 +62,13 @@ systemd_service "titiler-restart" do
 end
 
 systemd_timer "titiler-restart" do
-  on_boot_sec "6h"
-  on_unit_inactive_sec "12h"
+  on_boot_sec "10m"
+  on_unit_inactive_sec "30m"
+  randomized_delay_sec "20m"
+end
+
+service "titiler-restart.timer" do
+  action [:enable, :start]
 end
 
 directory "/var/cache/nginx-cache" do