Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🚧 feature/22-add-docker-support-for-local-test-setup #23

Draft
wants to merge 2 commits into
base: ffmd
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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 "<html><head><meta http-equiv="refresh" content="5"></head> <body><h1>Meshviewer wird frisch geklont und neu gebaut.</h1><h1>Bitte 1-2 Minuten warten...</h1></body></html>" > /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
40 changes: 40 additions & 0 deletions nginx-site.default
Original file line number Diff line number Diff line change
@@ -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;
}
}
}