From a9820a09e74d94021b84af0f7102c44b9f1f800d Mon Sep 17 00:00:00 2001 From: Tobias <96661824+CrazyWolf13@users.noreply.github.com> Date: Mon, 22 Dec 2025 14:06:02 +0100 Subject: [PATCH] reitti: add: nginx tile cache Added installation of Nginx and configuration for tile caching. --- install/reitti-install.sh | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/install/reitti-install.sh b/install/reitti-install.sh index f602dbde0..088c42055 100644 --- a/install/reitti-install.sh +++ b/install/reitti-install.sh @@ -18,7 +18,8 @@ $STD apt install -y \ redis-server \ rabbitmq-server \ libpq-dev \ - zstd + zstd \ + nginx msg_ok "Installed Dependencies" JAVA_VERSION="25" setup_java @@ -46,6 +47,31 @@ mv /opt/reitti/reitti-*.jar /opt/reitti/reitti.jar USE_ORIGINAL_FILENAME="true" fetch_and_deploy_gh_release "photon" "komoot/photon" "singlefile" "latest" "/opt/photon" "photon-0*.jar" mv /opt/photon/photon-*.jar /opt/photon/photon.jar +msg_info "Installing Nginx Tile Cache" +mkdir -p /var/cache/nginx/tiles +cat </etc/nginx/nginx.conf +events { + worker_connections 1024; +} +http { + proxy_cache_path /var/cache/nginx/tiles levels=1:2 keys_zone=tiles:10m max_size=1g inactive=30d use_temp_path=off; + server { + listen 80; + location / { + proxy_pass https://tile.openstreetmap.org/; + proxy_set_header Host tile.openstreetmap.org; + proxy_set_header User-Agent "Reitti/1.0"; + proxy_cache tiles; + proxy_cache_valid 200 30d; + proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504; + } + } +} +EOF +chown -R www-data:www-data /var/cache/nginx/tiles +systemctl restart nginx +msg_info "Installed Nginx Tile Cache" + msg_info "Creating Reitti Configuration-File" mkdir -p /opt/reitti/data cat </opt/reitti/application.properties @@ -92,6 +118,9 @@ PROCESSING_WORKERS_PER_QUEUE=4-16 # Disable potentially dangerous features unless needed DANGEROUS_LIFE=false + +# Tiles Cache +reitti.ui.tiles.cache.url=http://127.0.0.1 EOF msg_ok "Created Configuration-File for Reitti"