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()