diff --git a/compose/martin.yml b/compose/martin.yml index 2bd65a05..200d79d4 100644 --- a/compose/martin.yml +++ b/compose/martin.yml @@ -1,7 +1,7 @@ services: varnish: image: varnish:7.5 - container_name: varnish + container_name: tiler_varnish ports: - "6081:6081" volumes: @@ -18,7 +18,7 @@ services: - martin martin: - container_name: martin + container_name: tiler_server_martin image: rub21/tiler-server-martin:v1 build: context: ../images/tiler-server-martin diff --git a/hetzner/deploy.sh b/hetzner/deploy.sh index e21d9f8a..9726d523 100755 --- a/hetzner/deploy.sh +++ b/hetzner/deploy.sh @@ -42,9 +42,9 @@ if [[ "$ACTION" == "start" || "$ACTION" == "restart" ]] && [ "$AUTO_YES" != "tru fi case "$ACTION" in - start) $COMPOSE up -d ;; + start) $COMPOSE up -d --build;; stop) $COMPOSE down ;; - restart) $COMPOSE up -d --force-recreate ;; + restart) $COMPOSE up -d --force-recreate --build ;; *) echo "Unknown action: $ACTION"; exit 1 ;; esac diff --git a/hetzner/tiler/tiler.production.yml b/hetzner/tiler/tiler.production.yml index 696fbe99..173e500e 100644 --- a/hetzner/tiler/tiler.production.yml +++ b/hetzner/tiler/tiler.production.yml @@ -79,7 +79,7 @@ services: tiler_server_martin: container_name: tiler_server_martin - image: ghcr.io/openhistoricalmap/tiler-server-martin:0.0.1-0.dev.git.3349.h2739b4b1 + image: ghcr.io/openhistoricalmap/tiler-server-martin:0.0.1-0.dev.git.3359.h756000d2 restart: always environment: - OHM_DOMAIN=${OHM_DOMAIN:-openhistoricalmap.org} @@ -88,9 +88,7 @@ services: ports: - "3030:80" networks: - ohm_network: - aliases: - - martin + - ohm_network tiler_varnish: container_name: tiler_varnish diff --git a/hetzner/tiler/tiler.staging.yml b/hetzner/tiler/tiler.staging.yml index db040d75..64b59340 100644 --- a/hetzner/tiler/tiler.staging.yml +++ b/hetzner/tiler/tiler.staging.yml @@ -1,10 +1,55 @@ services: -volumes: - tiler_pgdata: - driver: local - name: tiler_db_11_02 + tiler_server_martin: + container_name: tiler_server_martin + image: ohm/tiler-server-martin:v1 + build: + context: ../../images/tiler-server-martin + dockerfile: Dockerfile + restart: always + environment: + - OHM_DOMAIN=${OHM_DOMAIN:-openhistoricalmap.org} + env_file: + - .env.tiler + ports: + - "3030:80" + networks: + - ohm_network - tiler_imposm_data: - driver: local - name: tiler_imposm_11_02 + tiler_varnish: + container_name: tiler_varnish + image: varnish:7.5 + restart: always + ports: + - "6081:6081" + volumes: + - ../../images/tiler-varnish/default.vcl:/etc/varnish/default.vcl:ro + tmpfs: + - /var/lib/varnish/varnishd:exec + command: > + varnishd -F + -a :6081 + -f /etc/varnish/default.vcl + -s dynamic=malloc,${VARNISH_DYNAMIC_SIZE:-16G} + -s static=malloc,${VARNISH_STATIC_SIZE:-4G} + -p thread_pool_min=100 + -p thread_pool_max=2000 + -p thread_pools=2 + -p workspace_backend=256k + -p workspace_client=256k + -p http_resp_hdr_len=32k + -p http_resp_size=256k + -p nuke_limit=1000 + -p timeout_idle=30 + -p feature=+http2 + mem_limit: 4G + cpus: "2.0" + ulimits: + memlock: -1 + nofile: + soft: 131072 + hard: 131072 + networks: + - ohm_network + depends_on: + - tiler_server_martin diff --git a/images/tiler-server-martin/scripts/generate_functions.py b/images/tiler-server-martin/scripts/generate_functions.py index d41701b9..ec47048d 100644 --- a/images/tiler-server-martin/scripts/generate_functions.py +++ b/images/tiler-server-martin/scripts/generate_functions.py @@ -41,6 +41,22 @@ def load_config(): } +# Per-group attribution strings (see openhistoricalmap/issues/1343). +# OHM groups link to the copyright page without "©" or "contributors", since +# OHM does not claim copyright over all contributed data. +OHM_ATTRIBUTION = 'OpenHistoricalMap' +OSM_ATTRIBUTION = '© OpenStreetMap contributors' +NE_ATTRIBUTION = 'Natural Earth' + +GROUP_ATTRIBUTION = { + "ohm": OHM_ATTRIBUTION, + "ohm_admin": OHM_ATTRIBUTION, + "ohm_other_boundaries": OHM_ATTRIBUTION, + "osm_land": OSM_ATTRIBUTION, + "ne": NE_ATTRIBUTION, +} + + def get_columns(cur, table_name, exclude): """Get column names from a table/mview, excluding specified columns.""" exclude = list(exclude) + ALWAYS_EXCLUDE @@ -171,14 +187,14 @@ def get_maxzoom(zoom_mapping): return 20 if last_max is None else last_max -def build_tilejson(name, description, tiles_url, vector_layers, minzoom=0, maxzoom=20): +def build_tilejson(name, description, tiles_url, vector_layers, attribution, minzoom=0, maxzoom=20): """Build a TileJSON 3.0.0 manifest.""" return { "tilejson": "3.0.0", "name": name, "description": description, "version": "1.0.0", - "attribution": "© OpenHistoricalMap contributors", + "attribution": attribution, "scheme": "xyz", "tiles": [tiles_url], "minzoom": minzoom, @@ -207,6 +223,7 @@ def generate_tilejson_files(groups, fields_per_function, base_url): for group in groups: group_name = group["name"] + attribution = GROUP_ATTRIBUTION.get(group_name, OHM_ATTRIBUTION) group_vector_layers = [] group_minzoom = 20 group_maxzoom = 0 @@ -231,6 +248,7 @@ def generate_tilejson_files(groups, fields_per_function, base_url): description=f"Layer: {func_def['source_layer']}", tiles_url=f"{base_url}/maps/{group_name}/{fn}/{{z}}/{{x}}/{{y}}", vector_layers=[vl], + attribution=attribution, minzoom=fn_minzoom, maxzoom=fn_maxzoom, ) @@ -246,6 +264,7 @@ def generate_tilejson_files(groups, fields_per_function, base_url): description=f"Composite: {group_name} ({len(group_vector_layers)} layers)", tiles_url=f"{base_url}/maps/{group_name}/{{z}}/{{x}}/{{y}}", vector_layers=group_vector_layers, + attribution=attribution, minzoom=group_minzoom, maxzoom=group_maxzoom, ) diff --git a/images/tiler-server-martin/static/index.html b/images/tiler-server-martin/static/index.html index c7cf3085..aebde2c5 100644 --- a/images/tiler-server-martin/static/index.html +++ b/images/tiler-server-martin/static/index.html @@ -352,7 +352,13 @@