diff --git a/README.md b/README.md index 7977e60..3d9f1e5 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). @@ -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 +``` diff --git a/contrib/docker/Dockerfile b/contrib/docker/Dockerfile new file mode 100644 index 0000000..bb28aed --- /dev/null +++ b/contrib/docker/Dockerfile @@ -0,0 +1,23 @@ +FROM debian:stretch +LABEL maintainer="Christer Waren/CWINFO " + +ENV HOST localhost +ENV PORT 3000 + +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 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 + +COPY crontab /etc/cron.d/jobs +RUN chmod 0644 /etc/cron.d/jobs + +ENTRYPOINT [ "/usr/bin/entrypoint.sh"] diff --git a/contrib/docker/crontab b/contrib/docker/crontab new file mode 100644 index 0000000..eb7bc28 --- /dev/null +++ b/contrib/docker/crontab @@ -0,0 +1 @@ +*/10 * * * * root cd /src/yggdrasil-map/web/ && python updateGraph.py diff --git a/contrib/docker/entrypoint.sh b/contrib/docker/entrypoint.sh new file mode 100644 index 0000000..a89a527 --- /dev/null +++ b/contrib/docker/entrypoint.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env sh + +set -e + +cron +cd /src/yggdrasil-map/web/ && python updateGraph.py +python /src/yggdrasil-map/web/web.py --host $HOST --port $PORT +exit $? 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