Skip to content

Commit

Permalink
Merge pull request zielmicha#12 from cwinfo/master
Browse files Browse the repository at this point in the history
Docker Support
  • Loading branch information
Arceliar authored Jan 26, 2019
2 parents f292dbb + 6cec5e1 commit d599481
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 3 deletions.
26 changes: 23 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -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).

Expand All @@ -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
```
23 changes: 23 additions & 0 deletions contrib/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM debian:stretch
LABEL maintainer="Christer Waren/CWINFO <[email protected]>"

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 change: 1 addition & 0 deletions contrib/docker/crontab
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*/10 * * * * root cd /src/yggdrasil-map/web/ && python updateGraph.py
8 changes: 8 additions & 0 deletions contrib/docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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 $?
1 change: 1 addition & 0 deletions contrib/docker/web_config.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DEBUG = False

0 comments on commit d599481

Please sign in to comment.