Add a fallback port for the terminal to avoid crashing proxies

This commit is contained in:
Kristóf Tóth 2019-10-08 14:24:31 +02:00
parent 251bc6325a
commit 641709c04e
4 changed files with 18 additions and 7 deletions

View File

@ -4,6 +4,7 @@ FROM avatao/debian:buster
RUN apt-get update &&\ RUN apt-get update &&\
apt-get install -y --no-install-recommends \ apt-get install -y --no-install-recommends \
supervisor \ supervisor \
ncat \
libzmq5 \ libzmq5 \
nginx \ nginx \
jq \ jq \
@ -19,12 +20,13 @@ RUN curl -Ls https://github.com/krallin/tini/releases/download/v0.18.0/tini-amd6
sha256sum --check --status &&\ sha256sum --check --status &&\
chmod 755 /bin/init chmod 755 /bin/init
ENV TFW_PUBLIC_PORT=8888 \ ENV TFW_PUBLIC_PORT=8888 \
TFW_WEB_PORT=4242 \ TFW_WEB_PORT=4242 \
TFW_LOGIN_APP_PORT=6666 \ TFW_LOGIN_APP_PORT=6666 \
TFW_TERMINADO_PORT=7878 \ TFW_TERMINAL_PORT=7878 \
TFW_SUPERVISOR_HTTP_PORT=9001 \ TFW_TERMINAL_FALLBACK_PORT=7879 \
TFW_PUB_PORT=7654 \ TFW_SUPERVISOR_HTTP_PORT=9001 \
TFW_PUB_PORT=7654 \
TFW_PULL_PORT=8765 TFW_PULL_PORT=8765
EXPOSE ${TFW_PUBLIC_PORT} EXPOSE ${TFW_PUBLIC_PORT}

View File

@ -1,5 +1,5 @@
location = /terminal { location = /terminal {
proxy_pass http://127.0.0.1:${TFW_TERMINADO_PORT}; proxy_pass http://terminal;
proxy_http_version 1.1; proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade; proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade"; proxy_set_header Connection "upgrade";

View File

@ -1,3 +1,8 @@
upstream terminal {
server 127.0.0.1:${TFW_TERMINAL_PORT};
server 127.0.0.1:${TFW_TERMINAL_FALLBACK_PORT} backup;
}
server { server {
listen ${TFW_PUBLIC_PORT}; listen ${TFW_PUBLIC_PORT};
server_name localhost; server_name localhost;

View File

@ -0,0 +1,4 @@
[program:terminal_fallback]
command=ncat -klp %(ENV_TFW_TERMINAL_FALLBACK_PORT)s
autostart=true
autorestart=true