- 在 generate-config.sh 中添加详细的调试日志输出 - 添加目标目录存在性检查和自动创建 - 显示所有 VITE_* 环境变量用于调试 - 验证配置文件生成结果并输出预览 - 修复字符串拼接问题,避免 \n 显示异常 - 在 start-services.sh 中添加脚本可执行性检查 - 添加 config.js 生成验证和手动重试机制 - 改进错误提示和日志输出格式 关联: #186
41 lines
1.4 KiB
Bash
41 lines
1.4 KiB
Bash
#!/bin/sh
|
|
|
|
# 创建日志目录
|
|
mkdir -p /var/log/supervisor
|
|
|
|
# 处理nginx配置文件中的环境变量
|
|
echo "Processing nginx configuration with environment variables..."
|
|
envsubst '${NGINX_PORT}' < /etc/nginx/conf.d/default.conf > /tmp/nginx.conf
|
|
mv /tmp/nginx.conf /etc/nginx/conf.d/default.conf
|
|
echo "Nginx configuration updated with NGINX_PORT=${NGINX_PORT}"
|
|
|
|
# 运行原有的nginx初始化脚本
|
|
echo "Running nginx initialization scripts..."
|
|
for script in /docker-entrypoint.d/*.sh; do
|
|
if [ -f "$script" ] && [ -x "$script" ]; then
|
|
echo "Running $script"
|
|
sh "$script" || echo "WARNING: $script failed with exit code $?"
|
|
elif [ -f "$script" ]; then
|
|
echo "WARNING: $script is not executable, attempting to run anyway..."
|
|
sh "$script" || echo "WARNING: $script failed with exit code $?"
|
|
fi
|
|
done
|
|
|
|
# 验证config.js是否已生成
|
|
if [ -f "/usr/share/nginx/html/config.js" ]; then
|
|
echo "✅ config.js generated successfully"
|
|
echo "Content preview:"
|
|
head -n 5 /usr/share/nginx/html/config.js
|
|
else
|
|
echo "❌ ERROR: config.js was not generated!"
|
|
echo "Attempting manual generation..."
|
|
sh /docker-entrypoint.d/40-generate-config.sh || echo "Manual generation failed"
|
|
fi
|
|
|
|
echo "Starting services with supervisor..."
|
|
echo "MCP Server will run on port: ${MCP_HTTP_PORT}"
|
|
echo "MCP Server log level: ${MCP_LOG_LEVEL}"
|
|
|
|
# 启动supervisor
|
|
exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf
|