]> git.openstreetmap.org Git - chef.git/blob - cookbooks/imagery/recipes/tiler.rb
Civicrm extension update
[chef.git] / cookbooks / imagery / recipes / tiler.rb
1 #
2 # Cookbook:: imagery
3 # Recipe:: tiler
4 #
5 # Copyright:: 2023, OpenStreetMap Foundation
6 #
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
10 #
11 #     https://www.apache.org/licenses/LICENSE-2.0
12 #
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
18 #
19
20 include_recipe "imagery"
21 include_recipe "podman"
22
23 # FIXME: until upstream supports arm64 images: https://github.com/developmentseed/titiler/pull/740
24 container_image = if arm?
25                     "ghcr.io/firefishy/titiler:latest"
26                   else
27                     "ghcr.io/developmentseed/titiler:latest"
28                   end
29
30 podman_service "titiler" do
31   description "Container service for titiler"
32   image container_image
33   ports 8080 => 8080
34   environment :PORT                                => 8080,
35               :WORKERS_PER_CORE                    => 2,
36               :GDAL_CACHEMAX                       => 200,
37               :GDAL_DISABLE_READDIR_ON_OPEN        => "EMPTY_DIR",
38               :GDAL_INGESTED_BYTES_AT_OPEN         => 32768,
39               :GDAL_HTTP_MERGE_CONSECUTIVE_RANGES  => "YES",
40               :GDAL_HTTP_MULTIPLEX                 => "YES",
41               :GDAL_HTTP_VERSION                   => 2,
42               :VSI_CACHE                           => "TRUE",
43               :VSI_CACHE_SIZE                      => 5000000,
44               :TITILER_API_ROOT_PATH               => "/api/v1/titiler",
45               :FORWARDED_ALLOW_IPS                 => "*" # https://docs.gunicorn.org/en/latest/settings.html#forwarded-allow-ips
46 end
47
48 ssl_certificate "tiler.openstreetmap.org" do
49   domains "tiler.openstreetmap.org"
50   notifies :reload, "service[nginx]"
51 end
52
53 nginx_site "tiler.openstreetmap.org" do
54   template "nginx_titiler.conf.erb"
55   variables :aliases => ["tiler.osm.org"]
56 end