Compare commits

..
6 changed files with 14 additions and 4 deletions
+6 -2
View File
@@ -1,5 +1,9 @@
FROM avatao/frontend-tutorial-framework:chausie-20191021 as frontend ARG FRONTEND_VERSION
FROM avatao/frontend-tutorial-framework:${FRONTEND_VERSION} as frontend
FROM avatao/debian:buster FROM avatao/debian:buster
ARG FRONTEND_VERSION
LABEL tfw.frontend.version=${FRONTEND_VERSION}
RUN apt-get update &&\ RUN apt-get update &&\
apt-get install -y --no-install-recommends \ apt-get install -y --no-install-recommends \
@@ -69,7 +73,7 @@ ONBUILD COPY ${BUILD_CONTEXT}/supervisor/ ${TFW_SUPERVISORD_COMPONENTS}
ONBUILD RUN for f in "${TFW_NGINX_DEFAULT}" ${TFW_NGINX_COMPONENTS}/*.conf; do \ ONBUILD RUN for f in "${TFW_NGINX_DEFAULT}" ${TFW_NGINX_COMPONENTS}/*.conf; do \
envsubst "$(printenv | cut -d= -f1 | grep TFW_ | sed -e 's/^/$/g')" < $f > $f~ && mv $f~ $f ;\ envsubst "$(printenv | cut -d= -f1 | grep TFW_ | sed -e 's/^/$/g')" < $f > $f~ && mv $f~ $f ;\
done done
ONBUILD VOLUME ["/etc/nginx", "/var/lib/nginx", "/var/log/nginx", "${TFW_LIB_DIR}/tfw"] ONBUILD VOLUME ["/etc/nginx", "/etc/supervisor", "/var/lib/nginx", "/var/log/nginx", "${TFW_LIB_DIR}/tfw"]
ENTRYPOINT ["/bin/init", "--"] ENTRYPOINT ["/bin/init", "--"]
CMD exec supervisord --nodaemon --configuration ${TFW_SUPERVISORD_CONF} CMD exec supervisord --nodaemon --configuration ${TFW_SUPERVISORD_CONF}
+1
View File
@@ -4,3 +4,4 @@ directory=/tmp
command=bash tfw_init.sh command=bash tfw_init.sh
autorestart=false autorestart=false
startsecs=0 startsecs=0
priority=1
+1
View File
@@ -2,3 +2,4 @@
user=root user=root
directory=%(ENV_TFW_SERVER_DIR)s directory=%(ENV_TFW_SERVER_DIR)s
command=python3 -u tfw_server.py command=python3 -u tfw_server.py
priority=2
@@ -12,7 +12,7 @@ class FrontendConfigHandler:
def handle_event(self, _, connector): def handle_event(self, _, connector):
# pylint: disable=no-self-use # pylint: disable=no-self-use
for message in self._config_messages: for message in self._config_messages:
connector.send_message(message) connector.send_message(message, scope=Scope.WEBSOCKET)
connector.send_message({'key': 'frontend.ready'}, scope=Scope.WEBSOCKET) connector.send_message({'key': 'frontend.ready'}, scope=Scope.WEBSOCKET)
@property @property
@@ -42,6 +42,9 @@ class TerminalHandler:
LOG.error('IGNORING MESSAGE: Invalid message received: %s', message) LOG.error('IGNORING MESSAGE: Invalid message received: %s', message)
def handle_write(self, message): def handle_write(self, message):
concat = message.get('concat', False)
if not concat:
self.terminado_server.pty.write('\x15')
self.terminado_server.pty.write(message['command']) self.terminado_server.pty.write(message['command'])
def cleanup(self): def cleanup(self):
+2 -1
View File
@@ -2,6 +2,7 @@
from datetime import datetime from datetime import datetime
from typing import TextIO, Union from typing import TextIO, Union
from dataclasses import dataclass from dataclasses import dataclass
from collections.abc import Mapping
from traceback import format_exception from traceback import format_exception
from logging import DEBUG, getLogger, Handler, Formatter, Filter from logging import DEBUG, getLogger, Handler, Formatter, Filter
@@ -81,7 +82,7 @@ class LogFormatter(Formatter):
def format(self, record): def format(self, record):
time = datetime.utcfromtimestamp(record.created).strftime('%H:%M:%S') time = datetime.utcfromtimestamp(record.created).strftime('%H:%M:%S')
if record.args: if record.args:
tuple_args = (record.args,) if isinstance(record.args, dict) else record.args tuple_args = (record.args,) if isinstance(record.args, Mapping) else record.args
clean_args = tuple((self.trim(arg) for arg in tuple_args)) clean_args = tuple((self.trim(arg) for arg in tuple_args))
message = record.msg % clean_args message = record.msg % clean_args
else: else: