From e3ff6bfbbf3a49e9d81bb25e6ef48fe065679dc7 Mon Sep 17 00:00:00 2001 From: Tobias <96661824+CrazyWolf13@users.noreply.github.com> Date: Mon, 22 Dec 2025 22:52:01 +0100 Subject: [PATCH] refactor: reitti: v3.0.0 (#10196) --- ct/reitti.sh | 33 ++++++++++++++++++++++++++++++++- install/reitti-install.sh | 31 ++++++++++++++++++++++++++++++- 2 files changed, 62 insertions(+), 2 deletions(-) diff --git a/ct/reitti.sh b/ct/reitti.sh index 9c3d01ebd..4e5d63b78 100644 --- a/ct/reitti.sh +++ b/ct/reitti.sh @@ -27,6 +27,37 @@ function update_script() { msg_error "No ${APP} Installation Found!" exit fi + + if [ ! -d /var/cache/nginx/tiles ]; then + msg_info "Installing Nginx Tile Cache" + mkdir -p /var/cache/nginx/tiles + $STD apt install -y nginx + 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 + echo "reitti.ui.tiles.cache.url=http://127.0.0.1" >> /opt/reitti/application.properties + systemctl restart reitti + msg_info "Installed Nginx Tile Cache" + fi + if check_for_gh_release "reitti" "dedicatedcode/reitti"; then msg_info "Stopping Service" systemctl stop reitti @@ -67,4 +98,4 @@ description msg_ok "Completed Successfully!\n" echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" echo -e "${INFO}${YW} Access it using the following URL:${CL}" -echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:8080${CL}" \ No newline at end of file +echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:8080${CL}" 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"