Skip to content

Commit c705baf

Browse files
committed
build: Replace pm2 with Supervisor
1 parent bc3403b commit c705baf

5 files changed

Lines changed: 17 additions & 18 deletions

File tree

Dockerfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ RUN npm install
6767
# Runtime stage
6868
FROM registry.cn-qingdao.aliyuncs.com/dataease/sqlbot-python-pg:latest
6969

70+
RUN apt-get update && apt-get install -y --no-install-recommends supervisor \
71+
&& rm -rf /var/lib/apt/lists/*
72+
7073
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
7174
echo "Asia/Shanghai" > /etc/timezone
7275

@@ -85,11 +88,12 @@ COPY start.sh /opt/sqlbot/app/start.sh
8588
COPY g2-ssr/*.ttf /usr/share/fonts/truetype/liberation/
8689
COPY --from=sqlbot-builder ${SQLBOT_HOME} ${SQLBOT_HOME}
8790
COPY --from=ssr-builder /app /opt/sqlbot/g2-ssr
91+
COPY g2-ssr/supervisord.conf /etc/supervisor/conf.d/g2-ssr.conf
8892
COPY --from=vector-model /opt/maxkb/app/model /opt/sqlbot/models
8993

9094
WORKDIR ${SQLBOT_HOME}/app
9195

92-
RUN mkdir -p /opt/sqlbot/images /opt/sqlbot/g2-ssr
96+
RUN mkdir -p /opt/sqlbot/images /opt/sqlbot/g2-ssr/logs
9397

9498
EXPOSE 3000 8000 8001 5432
9599

g2-ssr/ecosystem.config.js

Lines changed: 0 additions & 13 deletions
This file was deleted.

g2-ssr/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
"@rollup/plugin-json": "^6.1.0",
99
"lodash": "^4.17.21",
1010
"nan": "^2.22.2",
11-
"pm2": "^6.0.13",
1211
"node-canvas": "^2.9.0",
1312
"nprogress": "^0.2.0"
1413
},

g2-ssr/supervisord.conf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[program:g2-ssr]
2+
command=node /opt/sqlbot/g2-ssr/app.js
3+
directory=/opt/sqlbot/g2-ssr
4+
autostart=true
5+
autorestart=true
6+
startsecs=1
7+
startretries=10
8+
redirect_stderr=true
9+
stdout_logfile=/opt/sqlbot/g2-ssr/logs/supervisor_stdout.log
10+
stderr_logfile=/opt/sqlbot/g2-ssr/logs/supervisor_stderr.log
11+
stopasgroup=true

start.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
SSR_PATH=/opt/sqlbot/g2-ssr
22
APP_PATH=/opt/sqlbot/app
3-
PM2_CMD_PATH=$SSR_PATH/node_modules/pm2/bin/pm2
43

54
/usr/local/bin/docker-entrypoint.sh postgres &
65
sleep 5
76
wait-for-it 127.0.0.1:5432 --timeout=120 --strict -- echo -e "\033[1;32mPostgreSQL started.\033[0m"
87

9-
nohup $PM2_CMD_PATH start $SSR_PATH/app.js &
10-
#nohup node $SSR_PATH/app.js &
8+
nohup /usr/bin/supervisord -c /etc/supervisor/supervisord.conf &
119

1210
nohup uvicorn main:mcp_app --host 0.0.0.0 --port 8001 --proxy-headers --forwarded-allow-ips='*' &
1311

0 commit comments

Comments
 (0)