From 9e68a6f7e7bbfdf768cd7bc60b42af10b7979465 Mon Sep 17 00:00:00 2001 From: Aitor Pazos Date: Sun, 18 Sep 2016 19:06:51 +0100 Subject: [PATCH 1/2] Update base image to ubuntu 16.04 LTS and add tor support to it. In order to keep the Dockerfile simple, needed opotions have been appended to package provided torrc file and the /etc/init.d/tor script is used to start tor. If further customisation is desired, a wrapper script should be created to have further control on the startup. This would allow things like specifying external (tor) proxies and disable tor startup in those situations. --- Dockerfile | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index d521d18c..0ad99f29 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:14.04 +FROM ubuntu:16.04 MAINTAINER Felix Imobersteg @@ -9,17 +9,20 @@ ENV HOME /root #Install ZeroNet RUN \ apt-get update -y; \ - apt-get -y install msgpack-python python-gevent python-pip python-dev; \ + apt-get -y install msgpack-python python-gevent python-pip python-dev tor; \ pip install msgpack-python --upgrade; \ apt-get clean -y; \ - rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*; \ + echo "ControlPort 9051" >> /etc/tor/torrc; \ + echo "CookieAuthentication 1" >> /etc/tor/torrc + #Add Zeronet source ADD . /root VOLUME /root/data #Set upstart command -CMD cd /root && python zeronet.py --ui_ip 0.0.0.0 +CMD cd /root && /etc/init.d/tor start && python zeronet.py --ui_ip 0.0.0.0 #Expose ports EXPOSE 43110 From 39dc00ad78f7263b39b035ec8e04413bbc868e04 Mon Sep 17 00:00:00 2001 From: Aitor Pazos Date: Mon, 19 Sep 2016 23:00:58 +0100 Subject: [PATCH 2/2] Make Tor optional in the Docker image and disable it by default as it's usage may be not allowed by hosting providers --- Dockerfile | 5 ++++- README.md | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 0ad99f29..350fff9f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,8 +21,11 @@ RUN \ ADD . /root VOLUME /root/data +#Control if Tor proxy is started +ENV ENABLE_TOR false + #Set upstart command -CMD cd /root && /etc/init.d/tor start && python zeronet.py --ui_ip 0.0.0.0 +CMD cd /root && (! ${ENABLE_TOR} || /etc/init.d/tor start) && python zeronet.py --ui_ip 0.0.0.0 #Expose ports EXPOSE 43110 diff --git a/README.md b/README.md index 362ff060..efe80ed7 100644 --- a/README.md +++ b/README.md @@ -103,6 +103,11 @@ It downloads the latest version of ZeroNet then starts it automatically. ### [Docker](https://www.docker.com/) * `docker run -d -v :/root/data -p 15441:15441 -p 43110:43110 nofish/zeronet` +* This Docker image includes the Tor proxy, which is disabled by default. Beware that some +hosting providers may not allow you running Tor in their servers. If you want to enable it, +set `ENABLE_TOR` environment variable to `true` (Default: `false`). E.g.: + + `docker run -d -e "ENABLE_TOR=true" -v :/root/data -p 15441:15441 -p 43110:43110 nofish/zeronet` * Open http://127.0.0.1:43110/ in your browser ### [Virtualenv](https://virtualenv.readthedocs.org/en/latest/)