From 7c0e6d49bca5c2fda31537410df93f1dc8b0f522 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20T=C3=B3th?= Date: Fri, 29 Jun 2018 22:53:44 +0200 Subject: [PATCH] Handle starting TFWServer in baseimage --- Dockerfile | 5 ++++- supervisor/components/tfw_server.conf | 4 ++++ supervisor/tfw_server.py | 9 +++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 supervisor/components/tfw_server.conf create mode 100644 supervisor/tfw_server.py diff --git a/Dockerfile b/Dockerfile index 95976be..85f00ee 100644 --- a/Dockerfile +++ b/Dockerfile @@ -37,6 +37,7 @@ ENV PYTHONPATH="/usr/local/lib" \ TFW_LIB_DIR="/usr/local/lib/" \ TFW_TERMINADO_DIR="/tmp/terminado_server" \ TFW_FRONTEND_DIR="/srv/frontend" \ + TFW_SERVER_DIR="/srv/.tfw" \ TFW_HISTFILE="/home/${AVATAO_USER}/.bash_history" \ PROMPT_COMMAND="history -a" @@ -45,13 +46,15 @@ RUN echo "export HISTFILE=${TFW_HISTFILE}" >> /tmp/bashrc &&\ cat /tmp/bashrc >> /home/${AVATAO_USER}/.bashrc COPY supervisor/supervisord.conf ${TFW_SUPERVISORD_CONF} +COPY supervisor/components/ ${TFW_SUPERVISORD_COMPONENTS} COPY nginx/nginx.conf ${TFW_NGINX_CONF} COPY nginx/default.conf ${TFW_NGINX_DEFAULT} COPY nginx/components/ ${TFW_NGINX_COMPONENTS} COPY lib LICENSE ${TFW_LIB_DIR} +COPY supervisor/tfw_server.py ${TFW_SERVER_DIR}/ RUN for dir in "${TFW_LIB_DIR}"/{tfw,tao,envvars} "/etc/nginx" "/etc/supervisor"; do \ - chown -R root:root "$dir" && chmod -R 700 "$dir"; \ + chown -R root:root "$dir" && chmod -R 700 "$dir"; \ done ONBUILD ARG BUILD_CONTEXT="solvable" diff --git a/supervisor/components/tfw_server.conf b/supervisor/components/tfw_server.conf new file mode 100644 index 0000000..f583be9 --- /dev/null +++ b/supervisor/components/tfw_server.conf @@ -0,0 +1,4 @@ +[program:tfwserver] +user=root +directory=%(ENV_TFW_SERVER_DIR)s +command=python3 tfw_server.py diff --git a/supervisor/tfw_server.py b/supervisor/tfw_server.py new file mode 100644 index 0000000..78766ac --- /dev/null +++ b/supervisor/tfw_server.py @@ -0,0 +1,9 @@ +from tornado.ioloop import IOLoop + +from tfw.networking import TFWServer +from tfw.config import TFWENV + + +if __name__ == '__main__': + TFWServer().listen(TFWENV.WEB_PORT) + IOLoop.instance().start()