From 358261806e76408726d0a4f927516d6f7a886122 Mon Sep 17 00:00:00 2001 From: Angelika Ophagen Date: Mon, 20 Feb 2023 21:10:41 +0100 Subject: [PATCH 1/2] - copy Dockerfile from [meshviewer-server-docker](https://github.com/FreifunkMD/meshviewer-server-docker) - try simplify Dockerfile --- Dockerfile | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..2bc18fd --- /dev/null +++ b/Dockerfile @@ -0,0 +1,28 @@ +FROM node:13-slim + +WORKDIR . + +EXPOSE 80 + +RUN apt update \ + && apt install -y --no-install-recommends \ + unattended-upgrades \ + ca-certificates \ + nginx \ + git \ + wget \ + curl + +COPY ./nginx-site.default /etc/nginx/sites-available/default + +CMD rm -rf /var/www/html/* ; \ + mkdir -p /var/www/html/data ; \ + echo "

Meshviewer wird frisch geklont und neu gebaut.

Bitte 1-2 Minuten warten...

" > /var/www/html/index.html ; \ + service nginx start ; \ + yarn ; \ + yarn gulp ; \ + yarn cache clean ; \ + rm -rf node_modules ; \ + sh -c "wget http://gw01.babel.md.freifunk.net:8080/data/meshviewer.json -O /var/www/html/data/meshviewer.json" ; \ + cp -R -f build/* /var/www/html ; \ + while true; do sleep 1m; sh -c "wget http://gw01.babel.md.freifunk.net:8080/data/meshviewer.json -O /var/www/html/data/meshviewer.json" ; done From 222c77444fd3239a816e1d996cf8d575a7d82786 Mon Sep 17 00:00:00 2001 From: Angelika Ophagen Date: Mon, 20 Feb 2023 21:26:25 +0100 Subject: [PATCH 2/2] \#22: add missing file --- nginx-site.default | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 nginx-site.default diff --git a/nginx-site.default b/nginx-site.default new file mode 100644 index 0000000..3ff630b --- /dev/null +++ b/nginx-site.default @@ -0,0 +1,40 @@ +server_tokens off; + +proxy_cache_path /var/www/cache levels=1:2 keys_zone=osm-backend-cache:8m max_size=5g inactive=7d; + +upstream osm_backend { + server a.tile.openstreetmap.org; + server b.tile.openstreetmap.org; + server c.tile.openstreetmap.org; +} + +server { + listen 80 default_server; + listen [::]:80 default_server; + root /var/www/html; + index index.html; + server_name _; + + location / { + # First attempt to serve request as file, then + # as directory, then fall back to displaying a 404. + try_files $uri $uri/ =404; + } + + location ~ ^/tiles-cache/(.*)$ { + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X_FORWARDED_PROTO http; + proxy_set_header Host $http_host; + + proxy_cache osm-backend-cache; + proxy_hide_header Set-Cookie; + proxy_ignore_headers Set-Cookie; + proxy_cache_valid 200 302 7d; + proxy_cache_valid 404 1m; + proxy_redirect off; + if (!-f $request_filename) { + proxy_pass http://osm_backend/$1; + break; + } + } +}