From 4a4378537208784606c38a54a22c7285574c92b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Sat, 22 Dec 2018 10:00:15 +0200 Subject: [PATCH 01/17] Create entrypoint.sh --- contrib/docker/entrypoint.sh | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 contrib/docker/entrypoint.sh diff --git a/contrib/docker/entrypoint.sh b/contrib/docker/entrypoint.sh new file mode 100644 index 0000000..4d255ff --- /dev/null +++ b/contrib/docker/entrypoint.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env sh + +set -e + +cron +python /src/yggdrasil-map/web/web.py +exit $? From aa64834093c0557e0f611be3736ec09895e7252c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Sat, 22 Dec 2018 10:01:03 +0200 Subject: [PATCH 02/17] Create Dockerfile --- contrib/docker/Dockerfile | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 contrib/docker/Dockerfile diff --git a/contrib/docker/Dockerfile b/contrib/docker/Dockerfile new file mode 100644 index 0000000..3d68f6c --- /dev/null +++ b/contrib/docker/Dockerfile @@ -0,0 +1,21 @@ +FROM debian:stretch +LABEL maintainer="Christer Waren/CWINFO " + +WORKDIR /src + + +RUN apt-get update && \ + apt-get install -y git python-flask python-flup python-mysqldb python-pygraphviz python-networkx cron && \ + apt-get clean + +RUN git clone https://github.com/Arceliar/yggdrasil-map.git && \ + cd yggdrasil-map/web && \ + cp web_config.example.cfg web_config.cfg + +COPY entrypoint.sh /usr/bin/entrypoint.sh + +COPY crontab /etc/cron.d/jobs +RUN chmod 0644 /etc/cron.d/jobs + + +ENTRYPOINT [ "/usr/bin/entrypoint.sh"] From 3d7dd02a3d2b53b4f0915c1ffcc54b9a1d015846 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Sat, 22 Dec 2018 10:01:21 +0200 Subject: [PATCH 03/17] Create crontab --- contrib/docker/crontab | 1 + 1 file changed, 1 insertion(+) create mode 100644 contrib/docker/crontab diff --git a/contrib/docker/crontab b/contrib/docker/crontab new file mode 100644 index 0000000..4f928a1 --- /dev/null +++ b/contrib/docker/crontab @@ -0,0 +1 @@ +* * * * * root cd /src/yggdrasil-map/web/ && python updateGraph.py From ba61d7357fd8a56cd881466b984b858fe5f52713 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Thu, 27 Dec 2018 09:07:39 +0200 Subject: [PATCH 04/17] Update crontab --- contrib/docker/crontab | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/docker/crontab b/contrib/docker/crontab index 4f928a1..75a32ab 100644 --- a/contrib/docker/crontab +++ b/contrib/docker/crontab @@ -1 +1 @@ -* * * * * root cd /src/yggdrasil-map/web/ && python updateGraph.py +*/5 * * * * root cd /src/yggdrasil-map/web/ && python updateGraph.py From b22d7383541d800ec4e98f1fc470018daeb1fad3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Thu, 27 Dec 2018 09:15:33 +0200 Subject: [PATCH 05/17] Update Dockerfile --- contrib/docker/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/contrib/docker/Dockerfile b/contrib/docker/Dockerfile index 3d68f6c..4ac5214 100644 --- a/contrib/docker/Dockerfile +++ b/contrib/docker/Dockerfile @@ -13,6 +13,7 @@ RUN git clone https://github.com/Arceliar/yggdrasil-map.git && \ cp web_config.example.cfg web_config.cfg COPY entrypoint.sh /usr/bin/entrypoint.sh +RUN chmod 0555 /usr/bin/entrypoint.sh COPY crontab /etc/cron.d/jobs RUN chmod 0644 /etc/cron.d/jobs From bb0ab779fb18b09c164715c4a2d72423a3adc29a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Thu, 27 Dec 2018 09:16:20 +0200 Subject: [PATCH 06/17] Update entrypoint.sh --- contrib/docker/entrypoint.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/contrib/docker/entrypoint.sh b/contrib/docker/entrypoint.sh index 4d255ff..5dfb0bb 100644 --- a/contrib/docker/entrypoint.sh +++ b/contrib/docker/entrypoint.sh @@ -3,5 +3,6 @@ set -e cron +cd /src/yggdrasil-map/web/ && python updateGraph.py python /src/yggdrasil-map/web/web.py exit $? From 13db507b00b3afc07b9b55f1ce167aaab487c237 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Thu, 27 Dec 2018 09:19:01 +0200 Subject: [PATCH 07/17] Update crontab --- contrib/docker/crontab | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/docker/crontab b/contrib/docker/crontab index 75a32ab..eb7bc28 100644 --- a/contrib/docker/crontab +++ b/contrib/docker/crontab @@ -1 +1 @@ -*/5 * * * * root cd /src/yggdrasil-map/web/ && python updateGraph.py +*/10 * * * * root cd /src/yggdrasil-map/web/ && python updateGraph.py From eb35b69dfa1bc1284172d2209b5c837ccb83ef98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Mon, 31 Dec 2018 07:55:37 +0200 Subject: [PATCH 08/17] Update Dockerfile --- contrib/docker/Dockerfile | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/contrib/docker/Dockerfile b/contrib/docker/Dockerfile index 4ac5214..1777032 100644 --- a/contrib/docker/Dockerfile +++ b/contrib/docker/Dockerfile @@ -3,13 +3,13 @@ LABEL maintainer="Christer Waren/CWINFO " WORKDIR /src - RUN apt-get update && \ apt-get install -y git python-flask python-flup python-mysqldb python-pygraphviz python-networkx cron && \ apt-get clean -RUN git clone https://github.com/Arceliar/yggdrasil-map.git && \ - cd yggdrasil-map/web && \ +RUN git clone https://github.com/Arceliar/yggdrasil-map.git + +RUN cd yggdrasil-map/web && \ cp web_config.example.cfg web_config.cfg COPY entrypoint.sh /usr/bin/entrypoint.sh @@ -18,5 +18,4 @@ RUN chmod 0555 /usr/bin/entrypoint.sh COPY crontab /etc/cron.d/jobs RUN chmod 0644 /etc/cron.d/jobs - ENTRYPOINT [ "/usr/bin/entrypoint.sh"] From 8cb3c271783c0b5fbb0a2d85db61af0b73d4f516 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Mon, 31 Dec 2018 07:56:10 +0200 Subject: [PATCH 09/17] Update Dockerfile --- contrib/docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/docker/Dockerfile b/contrib/docker/Dockerfile index 1777032..9e18e47 100644 --- a/contrib/docker/Dockerfile +++ b/contrib/docker/Dockerfile @@ -7,7 +7,7 @@ RUN apt-get update && \ apt-get install -y git python-flask python-flup python-mysqldb python-pygraphviz python-networkx cron && \ apt-get clean -RUN git clone https://github.com/Arceliar/yggdrasil-map.git +RUN git clone https://github.com/Arceliar/yggdrasil-map.git yggdrasil-map RUN cd yggdrasil-map/web && \ cp web_config.example.cfg web_config.cfg From aa5ad824695861fe399cba6be85b12966e5ec998 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Tue, 22 Jan 2019 02:05:42 +0200 Subject: [PATCH 10/17] Create web_config.cfg --- contrib/docker/web_config.cfg | 1 + 1 file changed, 1 insertion(+) create mode 100644 contrib/docker/web_config.cfg diff --git a/contrib/docker/web_config.cfg b/contrib/docker/web_config.cfg new file mode 100644 index 0000000..c7d5d42 --- /dev/null +++ b/contrib/docker/web_config.cfg @@ -0,0 +1 @@ +DEBUG = False From a28a50220eb21affe5c486df15114dd428a6f1c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Tue, 22 Jan 2019 02:09:09 +0200 Subject: [PATCH 11/17] Update Dockerfile --- contrib/docker/Dockerfile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/contrib/docker/Dockerfile b/contrib/docker/Dockerfile index 9e18e47..2634557 100644 --- a/contrib/docker/Dockerfile +++ b/contrib/docker/Dockerfile @@ -9,9 +9,7 @@ RUN apt-get update && \ RUN git clone https://github.com/Arceliar/yggdrasil-map.git yggdrasil-map -RUN cd yggdrasil-map/web && \ - cp web_config.example.cfg web_config.cfg - +COPY web_config.cfg /src/yggdrasil-map/web/web_config.cfg COPY entrypoint.sh /usr/bin/entrypoint.sh RUN chmod 0555 /usr/bin/entrypoint.sh From ecf14ce90f1542db95bd5a4a4ae904b0a88a8433 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Tue, 22 Jan 2019 02:09:18 +0200 Subject: [PATCH 12/17] Update Dockerfile --- contrib/docker/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/contrib/docker/Dockerfile b/contrib/docker/Dockerfile index 2634557..ffc7fa8 100644 --- a/contrib/docker/Dockerfile +++ b/contrib/docker/Dockerfile @@ -10,6 +10,7 @@ RUN apt-get update && \ RUN git clone https://github.com/Arceliar/yggdrasil-map.git yggdrasil-map COPY web_config.cfg /src/yggdrasil-map/web/web_config.cfg + COPY entrypoint.sh /usr/bin/entrypoint.sh RUN chmod 0555 /usr/bin/entrypoint.sh From e6203db65dc14fde857663c0fdf9c1c918388e28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Tue, 22 Jan 2019 02:10:01 +0200 Subject: [PATCH 13/17] Update Dockerfile From 8cafbd76459f5feff4c74647c12de2784338a6e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Tue, 22 Jan 2019 03:00:28 +0200 Subject: [PATCH 14/17] Changing addresses to new domain CWO.FI -> CWINFO.ORG --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 7977e60..b61bf20 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # Yggdrasil map - * Internet: https://yggdrasil-map.cwo.fi - * Hyperboria: https://yggdrasil-map.h.cwo.fi - * Yggdrasil Network: https://yggdrasil-map.y.cwo.fi + * Internet: https://yggdrasil-map.cwinfo.org + * Hyperboria: https://yggdrasil-map.h.cwinfo.org + * Yggdrasil Network: https://yggdrasil-map.y.cwinfo.org Forked from the code for http://www.fc00.org (http://h.fc00.org on Hyperboria). From f6913e5c29d6936b9058658d8942d6689712a642 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Tue, 22 Jan 2019 03:02:38 +0200 Subject: [PATCH 15/17] Adding default environment variables --- contrib/docker/Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/contrib/docker/Dockerfile b/contrib/docker/Dockerfile index ffc7fa8..bb28aed 100644 --- a/contrib/docker/Dockerfile +++ b/contrib/docker/Dockerfile @@ -1,6 +1,9 @@ FROM debian:stretch LABEL maintainer="Christer Waren/CWINFO " +ENV HOST localhost +ENV PORT 3000 + WORKDIR /src RUN apt-get update && \ From cc5e8ca1ced24ecfc4080bf62a41ed5e795a04e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Tue, 22 Jan 2019 03:04:44 +0200 Subject: [PATCH 16/17] Use new variable choices Making possible to change IP and port with setting environment variables to docker run command --- contrib/docker/entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/docker/entrypoint.sh b/contrib/docker/entrypoint.sh index 5dfb0bb..a89a527 100644 --- a/contrib/docker/entrypoint.sh +++ b/contrib/docker/entrypoint.sh @@ -4,5 +4,5 @@ set -e cron cd /src/yggdrasil-map/web/ && python updateGraph.py -python /src/yggdrasil-map/web/web.py +python /src/yggdrasil-map/web/web.py --host $HOST --port $PORT exit $? From 6cec5e1a455f3f1a138ee7b92d1c50e2a1693bcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Tue, 22 Jan 2019 03:23:06 +0200 Subject: [PATCH 17/17] Docker Instructions 3 step instructions, how to run this code inside Docker container --- README.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/README.md b/README.md index b61bf20..3d9f1e5 100644 --- a/README.md +++ b/README.md @@ -23,3 +23,23 @@ python web.py You would need to edit web.py to adjust the address/port the server listens on, and may want to edit the web_config.cfg file. Note that most of the options in web_config.cfg are unused after forking from the fc00.org code, so this is mostly just a workaround until we have time to clean up this code. Run `web/updateGraph.py` periodically to rerender nodes graph. You may want to customize reverse-proxy IP retrieval logic in web.py. + +## Web server with Docker +### 1. Copy files from contrib/Docker/ to your folder of choice. + +### 2. Build image +Example folder is /docker/yggdrasil/map +```bash +sudo docker build -t Arceliar/yggdrasil-map /docker/yggdrasil/map/ +``` + +### 3. Create container +Run with using Docker host network +```bash +sudo docker run --name yggdrasil-map -d --net host --restart always Arceliar/yggdrasil-map +``` + +You can also use other Docker networks +```bash +sudo docker run --name yggdrasil-map -d --net local --ip 10.254.1.3 --ip6 fd80:deaf:1::3 --mac-address 02:42:01:00:00:03 -e HOST=fd80:deaf:1::3 -e PORT=80 --restart always Arceliar/yggdrasil-map +```