diff --git a/Dockerfile b/Dockerfile index 4d673d3..479f91c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,6 +4,7 @@ FROM avatao/debian:buster RUN apt-get update &&\ apt-get install -y --no-install-recommends \ supervisor \ + ncat \ libzmq5 \ nginx \ jq \ @@ -19,12 +20,13 @@ RUN curl -Ls https://github.com/krallin/tini/releases/download/v0.18.0/tini-amd6 sha256sum --check --status &&\ chmod 755 /bin/init -ENV TFW_PUBLIC_PORT=8888 \ - TFW_WEB_PORT=4242 \ - TFW_LOGIN_APP_PORT=6666 \ - TFW_TERMINADO_PORT=7878 \ - TFW_SUPERVISOR_HTTP_PORT=9001 \ - TFW_PUB_PORT=7654 \ +ENV TFW_PUBLIC_PORT=8888 \ + TFW_WEB_PORT=4242 \ + TFW_LOGIN_APP_PORT=6666 \ + TFW_TERMINAL_PORT=7878 \ + TFW_TERMINAL_FALLBACK_PORT=7879 \ + TFW_SUPERVISOR_HTTP_PORT=9001 \ + TFW_PUB_PORT=7654 \ TFW_PULL_PORT=8765 EXPOSE ${TFW_PUBLIC_PORT} diff --git a/nginx/components/terminal.conf b/nginx/components/terminal.conf index 691ec5c..201a1c9 100644 --- a/nginx/components/terminal.conf +++ b/nginx/components/terminal.conf @@ -1,5 +1,5 @@ location = /terminal { - proxy_pass http://127.0.0.1:${TFW_TERMINADO_PORT}; + proxy_pass http://terminal; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; diff --git a/nginx/default.conf b/nginx/default.conf index abcd7fe..0329721 100644 --- a/nginx/default.conf +++ b/nginx/default.conf @@ -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 { listen ${TFW_PUBLIC_PORT}; server_name localhost; diff --git a/supervisor/components/terminal_fallback.conf b/supervisor/components/terminal_fallback.conf new file mode 100644 index 0000000..cc3745c --- /dev/null +++ b/supervisor/components/terminal_fallback.conf @@ -0,0 +1,4 @@ +[program:terminal_fallback] +command=ncat -klp %(ENV_TFW_TERMINAL_FALLBACK_PORT)s +autostart=true +autorestart=true