reitti: add: nginx tile cache

Added installation of Nginx and configuration for tile caching.
This commit is contained in:
Tobias
2025-12-22 14:06:02 +01:00
committed by GitHub
parent bad3a1ccad
commit a9820a09e7

View File

@ -18,7 +18,8 @@ $STD apt install -y \
redis-server \ redis-server \
rabbitmq-server \ rabbitmq-server \
libpq-dev \ libpq-dev \
zstd zstd \
nginx
msg_ok "Installed Dependencies" msg_ok "Installed Dependencies"
JAVA_VERSION="25" setup_java 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" 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 mv /opt/photon/photon-*.jar /opt/photon/photon.jar
msg_info "Installing Nginx Tile Cache"
mkdir -p /var/cache/nginx/tiles
cat <<EOF >/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" msg_info "Creating Reitti Configuration-File"
mkdir -p /opt/reitti/data mkdir -p /opt/reitti/data
cat <<EOF >/opt/reitti/application.properties cat <<EOF >/opt/reitti/application.properties
@ -92,6 +118,9 @@ PROCESSING_WORKERS_PER_QUEUE=4-16
# Disable potentially dangerous features unless needed # Disable potentially dangerous features unless needed
DANGEROUS_LIFE=false DANGEROUS_LIFE=false
# Tiles Cache
reitti.ui.tiles.cache.url=http://127.0.0.1
EOF EOF
msg_ok "Created Configuration-File for Reitti" msg_ok "Created Configuration-File for Reitti"