@whyour/qinglong 2.19.0-5 → 2.19.0-6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/shell/start.sh +27 -15
package/package.json
CHANGED
package/shell/start.sh
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
|
|
3
|
-
# 前置依赖 nodejs、npm
|
|
3
|
+
# 前置依赖 nodejs、npm、python3
|
|
4
4
|
set -e
|
|
5
5
|
set -x
|
|
6
6
|
|
|
@@ -68,6 +68,18 @@ fi
|
|
|
68
68
|
|
|
69
69
|
npm install -g pnpm@8.3.1 pm2 ts-node
|
|
70
70
|
|
|
71
|
+
export PYTHON_SHORT_VERSION=$(python3 -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")')
|
|
72
|
+
export PNPM_HOME=${QL_DIR}/data/dep_cache/node
|
|
73
|
+
export PYTHON_HOME=${QL_DIR}/data/dep_cache/python3
|
|
74
|
+
export PYTHONUSERBASE=${QL_DIR}/data/dep_cache/python3
|
|
75
|
+
|
|
76
|
+
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:${PNPM_HOME}:${PYTHON_HOME}/bin
|
|
77
|
+
export NODE_PATH=/usr/local/bin:/usr/local/lib/node_modules:${PNPM_HOME}/global/5/node_modules
|
|
78
|
+
export PIP_CACHE_DIR=${PYTHON_HOME}/pip
|
|
79
|
+
export PYTHONPATH=${PYTHON_HOME}:${PYTHON_HOME}/lib/python${PYTHON_SHORT_VERSION}:${PYTHON_HOME}/lib/python${PYTHON_SHORT_VERSION}/site-packages
|
|
80
|
+
|
|
81
|
+
pip3 install --prefix ${PYTHON_HOME} requests
|
|
82
|
+
|
|
71
83
|
cd ${QL_DIR}
|
|
72
84
|
cp -f .env.example .env
|
|
73
85
|
chmod 777 ${QL_DIR}/shell/*.sh
|
|
@@ -75,7 +87,15 @@ chmod 777 ${QL_DIR}/shell/*.sh
|
|
|
75
87
|
. ${QL_DIR}/shell/share.sh
|
|
76
88
|
. ${QL_DIR}/shell/env.sh
|
|
77
89
|
|
|
78
|
-
|
|
90
|
+
log_with_style() {
|
|
91
|
+
local level="$1"
|
|
92
|
+
local message="$2"
|
|
93
|
+
local timestamp=$(date '+%Y-%m-%d %H:%M:%S')
|
|
94
|
+
|
|
95
|
+
printf "\n[%s] [%7s] %s\n" "${timestamp}" "${level}" "${message}"
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
log_with_style "INFO" "🚀 1. 检测配置文件..."
|
|
79
99
|
import_config "$@"
|
|
80
100
|
make_dir /etc/nginx/conf.d
|
|
81
101
|
make_dir /run/nginx
|
|
@@ -84,31 +104,23 @@ fix_config
|
|
|
84
104
|
|
|
85
105
|
pm2 l &>/dev/null
|
|
86
106
|
|
|
87
|
-
|
|
88
|
-
patch_version
|
|
89
|
-
|
|
90
|
-
echo -e "======================3. 启动nginx========================\n"
|
|
107
|
+
log_with_style "INFO" "🔄 2. 启动 nginx..."
|
|
91
108
|
nginx -s reload 2>/dev/null || nginx -c /etc/nginx/nginx.conf
|
|
92
|
-
echo -e "nginx启动成功...\n"
|
|
93
109
|
|
|
94
|
-
|
|
110
|
+
log_with_style "INFO" "⚙️ 3. 启动 pm2 服务...\n"
|
|
95
111
|
reload_pm2
|
|
96
112
|
|
|
97
113
|
if [[ $AutoStartBot == true ]]; then
|
|
98
|
-
|
|
114
|
+
log_with_style "INFO" "🤖 4. 启动 bot..."
|
|
99
115
|
nohup ql bot >$dir_log/bot.log 2>&1 &
|
|
100
|
-
echo -e "bot后台启动中...\n"
|
|
101
116
|
fi
|
|
102
117
|
|
|
103
118
|
if [[ $EnableExtraShell == true ]]; then
|
|
104
|
-
|
|
119
|
+
log_with_style "INFO" "🛠️ 5. 执行自定义脚本..."
|
|
105
120
|
nohup ql extra >$dir_log/extra.log 2>&1 &
|
|
106
|
-
echo -e "自定义脚本后台执行中...\n"
|
|
107
121
|
fi
|
|
108
122
|
|
|
109
123
|
pm2 startup
|
|
110
124
|
pm2 save
|
|
111
125
|
|
|
112
|
-
|
|
113
|
-
echo -e "启动完成..."
|
|
114
|
-
echo -e "############################################################\n"
|
|
126
|
+
log_with_style "SUCCESS" "🎉 容器启动成功!"
|