File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Load diff This file was deleted.
Original file line number Diff line number Diff line change @@ -85,7 +85,7 @@ ARG FRONTEND2_DIR=frontend2-static
8585
8686RUN apt-get update \
8787 && apt-get upgrade -y \
88- && apt-get install -y curl git libpq5 gnupg nginx supervisor \
88+ && apt-get install -y curl git libpq5 gnupg nginx \
8989 && curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \
9090 && apt-get install -y nodejs \
9191 && apt-get clean \
@@ -99,12 +99,10 @@ ENV PATH="/app/.venv/bin:$PATH"
9999
100100COPY ${FRONTEND2_DIR}/ /usr/share/nginx/frontend2/
101101COPY deploy/nginx-extra.conf /etc/nginx/conf.d/frontend2.conf.template
102- COPY deploy/supervisord.conf /etc/supervisor/conf.d/langflow.conf
103102COPY scripts/start_with_nginx.sh /app/scripts/start_with_nginx.sh
104103
105104RUN chmod +x /app/scripts/start_with_nginx.sh \
106- && rm /etc/nginx/conf.d/default.conf \
107- && mkdir -p /var/log/supervisor
105+ && rm /etc/nginx/conf.d/default.conf
108106
109107LABEL org.opencontainers.image.title=langflow
110108LABEL org.opencontainers.image.authors=['Langflow' ]
Original file line number Diff line number Diff line change 11#! /bin/sh
2- set -e
2+ set -eu
33
44BACKEND_HOST=" ${LANGFLOW_HOST:- 0.0.0.0} "
55PUBLIC_PORT=" ${LANGFLOW_PORT:- 7860} "
66BACKEND_PORT=" ${LANGFLOW_BACKEND_PORT:- 7861} "
77
88export LANGFLOW_HOST=" $BACKEND_HOST "
9- export LANGFLOW_PORT=" $PUBLIC_PORT "
109export LANGFLOW_BACKEND_PORT=" $BACKEND_PORT "
10+ export LANGFLOW_PUBLIC_PORT=" $PUBLIC_PORT "
11+ export LANGFLOW_PORT=" $BACKEND_PORT "
1112
1213CONFIG_TEMPLATE=" /etc/nginx/conf.d/frontend2.conf.template"
1314CONFIG_PATH=" /etc/nginx/conf.d/frontend2.conf"
@@ -19,4 +20,39 @@ if [ -f "$CONFIG_TEMPLATE" ]; then
1920 " $CONFIG_TEMPLATE " > " $CONFIG_PATH "
2021fi
2122
22- exec supervisord -c /etc/supervisor/conf.d/langflow.conf
23+ cleanup () {
24+ if [ -n " ${BACKEND_PID:- } " ] && kill -0 " $BACKEND_PID " 2> /dev/null; then
25+ kill " $BACKEND_PID "
26+ fi
27+ if [ -n " ${NGINX_PID:- } " ] && kill -0 " $NGINX_PID " 2> /dev/null; then
28+ kill " $NGINX_PID "
29+ fi
30+ }
31+
32+ trap ' cleanup' INT TERM
33+
34+ /usr/sbin/runuser -u user -- langflow run --host " $BACKEND_HOST " --port " $BACKEND_PORT " --log-level info &
35+ BACKEND_PID=$!
36+
37+ /usr/sbin/nginx -g " daemon off;" &
38+ NGINX_PID=$!
39+
40+ while : ; do
41+ if ! kill -0 " $BACKEND_PID " 2> /dev/null; then
42+ wait " $BACKEND_PID "
43+ EXIT_CODE=$?
44+ cleanup
45+ wait " $NGINX_PID " 2> /dev/null || true
46+ exit " $EXIT_CODE "
47+ fi
48+
49+ if ! kill -0 " $NGINX_PID " 2> /dev/null; then
50+ wait " $NGINX_PID "
51+ EXIT_CODE=$?
52+ cleanup
53+ wait " $BACKEND_PID " 2> /dev/null || true
54+ exit " $EXIT_CODE "
55+ fi
56+
57+ sleep 1
58+ done
You can’t perform that action at this time.
0 commit comments