Browse Source

Add requirements to uses the RRZE tile server hd through local proxy cache

pull/72/head
Dashie der otter 10 months ago
parent
commit
ade87b2a58
Signed by: dashie <rhaamo@leloop.org> GPG Key ID: C2D57B325840B755
5 changed files with 71 additions and 20 deletions
  1. +2
    -0
      README.md
  2. +4
    -1
      backend/priv/static/js/config.js
  3. +13
    -3
      backend/priv/static/js/core/map_init.js
  4. +7
    -0
      docs/install.md
  5. +45
    -16
      installation/nginx.conf

+ 2
- 0
README.md View File

@@ -27,6 +27,8 @@ Some more features will be available like airplane picture, company, and statist
- postgresql >= 10 (should work with lower but you are on your own)
- python >= 3.6
- elixir >= 1.5
- at least 5G of disk space on the server running nginx (tile caching)


## Setup



+ 4
- 1
backend/priv/static/js/config.js View File

@@ -50,4 +50,7 @@ var defaultZoom = 9; // Default zoom level of the map
// vehicle path style:
var pathStrokeOpacity = 0.8;
var pathStrokeWeight = 2.0;
var pathzIndex = 1000;
var pathzIndex = 1000;

// Uses local tileserver cache or no (need specific nginx config)
var mapUsesLocalCache = false;

+ 13
- 3
backend/priv/static/js/core/map_init.js View File

@@ -38,12 +38,22 @@ function initMap() {
}

// Setup layers
if (mapUsesLocalCache === false) {
Logger.info('Using RRZE tile server directly.');
var rrzeUrl = 'https://osm.rrze.fau.de/osmhd';
} else {
Logger.info('Using RRZE tile server through local cache.');
var rrzeUrl = '/';
}
let layerRrze = L.tileLayer(rrzeUrl + '/{z}/{x}/{y}.png', {
attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors and <a href="https://osm.rrze.fau.de/">RRZE Tile Server</a'
})
let baseLayers = {
"OpenStreetMap": L.tileLayer.provider('OpenStreetMap.Mapnik'),
"OpenStreetMap": layerRrze,
"Esri World Imagery": L.tileLayer.provider('Esri.WorldImagery'),
"OpenTopo": L.tileLayer.provider('OpenTopoMap'),
"OpenTopo (non-hd)": L.tileLayer.provider('OpenTopoMap'),
"Stamen Terrain": L.tileLayer.provider('Stamen.Terrain'),
"Esri Ocean Basemap": L.tileLayer.provider('Esri.OceanBasemap')
"Esri Ocean Basemap (non-hd)": L.tileLayer.provider('Esri.OceanBasemap')
};

let overlaysLayers = {


+ 7
- 0
docs/install.md View File

@@ -25,6 +25,13 @@ CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
CREATE EXTENSION IF NOT EXISTS "postgis";
```

# Nginx

You should uses the file `installation/nginx.conf` as a template.

If you enable the tile caching part, you should also set `mapUsesLocalCache` to `true` in `backend/priv/static/js/config.js`.


# Install

useradd -m -s /bin/bash pyairwaves


+ 45
- 16
installation/nginx.conf View File

@@ -1,31 +1,44 @@
# Specific tile caching {
upstream rrze {
server a.osm.rrze.fau.de;
server b.osm.rrze.fau.de;
server c.osm.rrze.fau.de;
}
# }

server {
listen 443;
listen [::]:443;
# Specific tile caching {
proxy_cache_path /tmp/cache/tiles/rrze levels=1:2 keys_zone=tiles-cache-rrze:8m max_size=1000m inactive=30d;
proxy_temp_path /tmp/cache/tmp;
# }

listen 443;
listen [::]:443;

access_log /var/log/nginx/pyairwaves.access.log;
error_log /var/log/nginx/pyairwaves.error.log error;
access_log /var/log/nginx/pyairwaves.access.log;
error_log /var/log/nginx/pyairwaves.error.log error;

ssl on;
ssl_certificate /srv/letsencrypt/certs/lan.sigpipe.me/fullchain.pem;
ssl_certificate_key /srv/letsencrypt/certs/lan.sigpipe.me/privkey.pem;
ssl on;
ssl_certificate /srv/letsencrypt/certs/lan.sigpipe.me/fullchain.pem;
ssl_certificate_key /srv/letsencrypt/certs/lan.sigpipe.me/privkey.pem;

index index.php index.html index.htm index.nginx-debian.html;
index index.php index.html index.htm index.nginx-debian.html;

server_name pyairwaves.domain.tld;
server_name pyairwaves.domain.tld;

location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_redirect off;
proxy_pass http://192.168.10.139:4000;
proxy_redirect off;
proxy_pass http://192.168.10.139:4000;
}

location /ws {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_http_version 1.1;
proxy_buffering off;
@@ -34,4 +47,20 @@ server {
proxy_pass http://192.168.10.139:4000/ws;
}

# Specific tile caching {
location /cache/tiles/rrze {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X_FORWARDED_PROTO https;
proxy_set_header Host $host;
proxy_cache tiles-cache-rrze;
proxy_cache_valid 200 302 365d;
proxy_cache_valid 404 1m;
proxy_redirect off;
if (!-f $request_filename) {
proxy_pass https://rrze/osmhd/;
break;
}
}
# }

}

Loading…
Cancel
Save