Permalink
Browse files

updated configs and makefile to deploy everware as docker image

  • Loading branch information...
1 parent d72a0c4 commit 16583e7cbf355c5ebefbfdff3661621b400c819c @anaderi anaderi committed Apr 4, 2017
Showing with 77 additions and 43 deletions.
  1. +1 −35 Makefile
  2. +0 −2 { → docs}/docker.md
  3. +2 −0 env.docker-remote.orig
  4. +2 −0 env.docker-swarm.orig
  5. +4 −5 etc/container_config.py
  6. +1 −1 etc/container_swarm_config.py
  7. +67 −0 run.makefile
View
@@ -9,8 +9,6 @@
SHELL := /bin/bash
TEST_OPTIONS := -s tests -N 2
TESTS := test_happy_mp
-LOG := everware.log
-PIDFILE := everware.pid
IP = $(shell python -c 'from IPython.utils.localinterfaces import public_ips; print (public_ips()[0])' 2>/dev/null)
OPTIONS = --debug --port 8000 --no-ssl --JupyterHub.hub_ip=${IP}
UPLOADDIR ?= ~/upload_screens
@@ -27,14 +25,13 @@ else
$(error Unable to find python)
endif
-EXECUTOR = everware-server
-
ifeq ($(shell uname -s),Linux)
SPAWNER_IP = "127.0.0.1"
else
SPAWNER_IP = "192.168.99.100"
endif
+include run.makefile
.PHONY: install reload clean run run-daemon stop test tail
@@ -56,37 +53,6 @@ install: ## install everware
if [ ! -f env.sh ] ; then cp env.sh.orig env.sh ; fi
-reload: ## reload everware whitelist
- PID=`pgrep '${EXECUTOR}'` ;\
- if [ -z "$${PID}" ] ; then echo "Cannot find running ${EXECUTOR}" ; exit 1 ; fi
- pkill -1 '${EXECUTOR}'
-
-clean: ## clean user base
- if [ -f ${PIDFILE} ] ; then echo "${PIDFILE} exists, cannot continute" ; exit 1; fi
- rm -f jupyterhub.sqlite
-
-run-linux: clean ## run everware server on linux
- source ./env.sh && \
- ${EXECUTOR} -f etc/local_config.py --no-ssl 2>&1 | tee ${LOG}
-
-run-dockermachine: clean ## run everware server on MacOS
- source ./env.sh && \
- ${EXECUTOR} -f etc/local_dockermachine_config.py --no-ssl 2>&1 | tee ${LOG}
-
-run-daemon: clean ## run everware in daemon mode, linux only, SSL required
- source ./env.sh && \
- ${EXECUTOR} -f etc/local_config.py >> ${LOG} 2>&1 &
- pgrep ${EXECUTOR} > ${PIDFILE} || ( tail ${LOG} && exit 1 )
- echo "Started. Log saved to ${LOG}"
-
-stop:
- -rm ${PIDFILE}
- -pkill -9 ${EXECUTOR}
- -pkill -9 node
-
-logs: ${LOG} ## watch log file
- tail -f ${LOG}
-
test: ## run all tests
export UPLOADDIR=${UPLOADDIR}; \
py.test everware/ ; \
@@ -11,8 +11,6 @@ This section explains how to run Everware in a container, and the different poss
docker build -t everware .
```
-JupyterHub Dockerfile needs a ["jupyterhub_config.py"](jupyterhub_config.py) file to be present at the root of the project.
-
## Create user containers on same machine as the Everware one
Fill the file which will contains environment variables for Everware.
View
@@ -3,3 +3,5 @@ GITHUB_CLIENT_SECRET=
OAUTH_CALLBACK_URL=http://xxxxxxxx:8000/hub/oauth_callback
EVERWARE_WHITELIST=whitelist.txt
DOCKER_HOST=tcp://xxx.xxx.xxx.xxx:2376
+# most likely the same IP as DOCKER_HOST
+DOCKER_PUBLIC_IP=xxx.xxx.xxx.xxx
View
@@ -5,3 +5,5 @@ EVERWARE_WHITELIST=whitelist.txt
DOCKER_CERT_PATH=/etc/docker
DOCKER_HOST=tcp://xxx.xxx.xxx.xxx:2376
DOCKER_TLS_VERIFY=1
+# most likely the same IP as DOCKER_HOST
+DOCKER_PUBLIC_IP=xxx.xxx.xxx.xxx
View
@@ -11,8 +11,7 @@
c.JupyterHub.hub_ip = '0.0.0.0'
c.JupyterHub.proxy_api_ip = '0.0.0.0'
-# Change these two next settings:
-# IP of the machine where the Everware can be contacted
-c.DockerSpawner.hub_ip_connect = 'xxx.xxx.xxx.xxx'
-# IP of the machine running Docker service
-c.DockerSpawner.container_ip = 'xxx.xxx.xxx.xxx'
+# IP of the machine where the Everware (run as docker container) can be contacted
+c.DockerSpawner.hub_ip_connect = os.environ['DOCKER_PUBLIC_IP']
+# IP of the machine running Docker service, normally the same as above
+c.DockerSpawner.container_ip = c.DockerSpawner.hub_ip_connect
@@ -18,4 +18,4 @@
# Change this setting:
# IP of the machine where the Everware can be contacted
-c.DockerSpawner.hub_ip_connect = 'xxx.xxx.xxx.xxx'
+c.DockerSpawner.hub_ip_connect = os.environ['DOCKER_PUBLIC_IP']
View
@@ -0,0 +1,67 @@
+HERE=$(shell pwd)
+LOG := everware.log
+PIDFILE := everware.pid
+EXECUTOR = everware-server
+
+reload: ## reload everware whitelist
+ PID=`pgrep '${EXECUTOR}'` ;\
+ if [ -z "$${PID}" ] ; then echo "Cannot find running ${EXECUTOR}" ; exit 1 ; fi
+ pkill -1 '${EXECUTOR}'
+
+clean: ## clean user base
+ if [ -f ${PIDFILE} ] ; then echo "${PIDFILE} exists, cannot continute" ; exit 1; fi
+ rm -f jupyterhub.sqlite
+
+run-linux: clean ## run everware server on linux
+ source ./env.sh && \
+ ${EXECUTOR} -f etc/local_config.py --no-ssl 2>&1 | tee ${LOG}
+
+run-dockermachine: clean ## run everware server on MacOS
+ source ./env.sh && \
+ ${EXECUTOR} -f etc/local_dockermachine_config.py --no-ssl 2>&1 | tee ${LOG}
+
+run-daemon: clean ## run everware in daemon mode, linux only, SSL required
+ source ./env.sh && \
+ ${EXECUTOR} -f etc/local_config.py >> ${LOG} 2>&1 &
+ pgrep ${EXECUTOR} > ${PIDFILE} || ( tail ${LOG} && exit 1 )
+ echo "Started. Log saved to ${LOG}"
+
+stop:
+ -rm ${PIDFILE}
+ -pkill -9 ${EXECUTOR}
+ -pkill -9 node
+run-docker-local:
+ docker run -d --name everware \
+ -v /var/run/docker.sock:/var/run/docker.sock \
+ -v ${HERE}/etc/container_config.py:/srv/everware/etc/container_config.py \
+ --env-file=env.docker-local \
+ -p 8000:8000 \
+ -p 8081:8081 \
+ everware/everware:latest /srv/everware/etc/container_config.py --no-ssl --debug
+
+run-docker-remote:
+ docker run -d --name everware \
+ -v ${HERE}/etc/container_config.py:/srv/everware/etc/container_config.py \
+ --env-file=env.docker-remote \
+ -p 8000:8000 \
+ -p 8081:8081 \
+ everware/everware:latest /srv/everware/etc/container_config.py --no-ssl --debug
+
+run-docker-swarm:
+ docker run -d --name everware \
+ -v ${HERE}/etc/container_swarm_config.py:/srv/everware/etc/container_swarm_config.py \
+ --env-file=env.docker-swarm \
+ -p 8000:8000 \
+ -p 8081:8081 \
+ everware/everware:latest /srv/everware/etc/container_swarm_config.py --no-ssl --debug
+
+stop-docker:
+ docker stop everware
+ docker rm everware
+
+stop-docker-swarm:
+ bash -c "source env.docker-swarm && docker stop everware && docker rm everware"
+
+logs: ${LOG} ## watch log file
+ tail -f ${LOG}
+

0 comments on commit 16583e7

Please sign in to comment.