5
0
mirror of https://github.com/cwinfo/yggdrasil-map synced 2024-11-09 16:00:27 +00:00

Merge pull request #12 from cwinfo/master

Docker Support
This commit is contained in:
Arceliar 2019-01-25 18:17:50 -06:00 committed by GitHub
commit d599481543
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 56 additions and 3 deletions

View File

@ -1,8 +1,8 @@
# Yggdrasil map # Yggdrasil map
* Internet: https://yggdrasil-map.cwo.fi * Internet: https://yggdrasil-map.cwinfo.org
* Hyperboria: https://yggdrasil-map.h.cwo.fi * Hyperboria: https://yggdrasil-map.h.cwinfo.org
* Yggdrasil Network: https://yggdrasil-map.y.cwo.fi * Yggdrasil Network: https://yggdrasil-map.y.cwinfo.org
Forked from the code for http://www.fc00.org (http://h.fc00.org on Hyperboria). 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. 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. 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
```

23
contrib/docker/Dockerfile Normal file
View File

@ -0,0 +1,23 @@
FROM debian:stretch
LABEL maintainer="Christer Waren/CWINFO <christer.waren@cwinfo.org>"
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"]

1
contrib/docker/crontab Normal file
View File

@ -0,0 +1 @@
*/10 * * * * root cd /src/yggdrasil-map/web/ && python updateGraph.py

View File

@ -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 $?

View File

@ -0,0 +1 @@
DEBUG = False