Merge branch 'test' into prod
This commit is contained in:
commit
7ecc88e234
4 files changed
+55
-3
No files matched your search
+4
-2
@@ -1,10 +1,12 @@
|
||||
FROM python:3.12-slim
|
||||
FROM python:3.12-slim-bookworm
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Oracle Instant Client runtime dependencies for thick mode.
|
||||
# `libaio1` is available on Debian bookworm, while newer variants may expose `libaio1t64`.
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends libaio1 libnsl2 \
|
||||
&& (apt-get install -y --no-install-recommends libaio1 libnsl2 \
|
||||
|| apt-get install -y --no-install-recommends libaio1t64 libnsl2) \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install Python dependencies
|
||||
|
||||
@@ -88,7 +88,7 @@ class DifyService:
|
||||
'inputs': {},
|
||||
'query': query,
|
||||
'response_mode': 'streaming',
|
||||
'conversation_id': conversation_id,
|
||||
'conversation_id': conversation_id or '',
|
||||
'user': str(user_id),
|
||||
}
|
||||
|
||||
@@ -115,6 +115,18 @@ class DifyService:
|
||||
response.status_code,
|
||||
response.reason,
|
||||
)
|
||||
if not response.ok and current_app:
|
||||
try:
|
||||
error_body = response.text[:2000]
|
||||
except Exception:
|
||||
error_body = "<failed to read response body>"
|
||||
current_app.logger.error(
|
||||
"[chat-stream] dify bad response status=%s url=%s payload=%s body=%s",
|
||||
response.status_code,
|
||||
url,
|
||||
json.dumps(payload, ensure_ascii=False),
|
||||
error_body,
|
||||
)
|
||||
response.raise_for_status()
|
||||
|
||||
for line in response.iter_lines():
|
||||
|
||||
@@ -14,6 +14,21 @@ echo "=== 开始容器化部署流程 [$(date)] ==="
|
||||
# ------------------------------------------------------------------------------
|
||||
PROJECT_DIR="/data/ai-platform/hxops"
|
||||
BRANCH="super"
|
||||
ORACLE_CLIENT_DIR="${PROJECT_DIR}/oracle_client"
|
||||
|
||||
check_oracle_client() {
|
||||
if [ ! -d "$ORACLE_CLIENT_DIR" ]; then
|
||||
echo "错误: 未找到 Oracle Instant Client 目录: $ORACLE_CLIENT_DIR"
|
||||
echo "请先在项目根目录准备 oracle_client,并确保 docker-compose 能挂载到 /app/oracle_client。"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! find "$ORACLE_CLIENT_DIR" \( -iname "oci.dll" -o -iname "libclntsh.so" -o -iname "libclntsh.dylib" -o -type d -name "instantclient_*" \) | grep -q .; then
|
||||
echo "错误: Oracle Instant Client 目录存在,但未发现可用客户端文件: $ORACLE_CLIENT_DIR"
|
||||
echo "请确认目录中包含 Instant Client 解压内容,例如 instantclient_* / oci.dll / libclntsh.so。"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# 2. 更新代码
|
||||
# ------------------------------------------------------------------------------
|
||||
@@ -37,6 +52,9 @@ if ! command -v docker &> /dev/null; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo ">>> [2.5/4] 检查 Oracle Instant Client..."
|
||||
check_oracle_client
|
||||
|
||||
# 4. 构建与启动容器
|
||||
# ------------------------------------------------------------------------------
|
||||
echo ">>> [3/4] 重建并启动容器..."
|
||||
|
||||
@@ -19,6 +19,21 @@ DEPLOY_CONFIG_CHANGED="${6:-false}"
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
COMPOSE_FILE="${ROOT_DIR}/docker-compose.yml"
|
||||
ENV_FILE="${ROOT_DIR}/.env.${ENV_NAME}"
|
||||
ORACLE_CLIENT_DIR="${ROOT_DIR}/oracle_client"
|
||||
|
||||
check_oracle_client() {
|
||||
if [[ ! -d "${ORACLE_CLIENT_DIR}" ]]; then
|
||||
echo "Missing Oracle Instant Client directory: ${ORACLE_CLIENT_DIR}"
|
||||
echo "Please prepare oracle_client under the project root so docker-compose can mount it to /app/oracle_client."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! find "${ORACLE_CLIENT_DIR}" \( -iname "oci.dll" -o -iname "libclntsh.so" -o -iname "libclntsh.dylib" -o -type d -name "instantclient_*" \) | grep -q .; then
|
||||
echo "Oracle Instant Client directory exists but no client library was found: ${ORACLE_CLIENT_DIR}"
|
||||
echo "Expected extracted Instant Client files such as instantclient_* / oci.dll / libclntsh.so."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# 基础文件检查:compose 文件必须存在
|
||||
if [[ ! -f "${COMPOSE_FILE}" ]]; then
|
||||
@@ -91,6 +106,11 @@ echo "Deploying environment: ${ENV_NAME}"
|
||||
echo "Services: ${services[*]}"
|
||||
echo "Prebuilt image mode: ${PREBUILT_MODE}"
|
||||
|
||||
if printf '%s\n' "${services[@]}" | grep -qx "hxops-backend"; then
|
||||
echo "Checking Oracle Instant Client directory..."
|
||||
check_oracle_client
|
||||
fi
|
||||
|
||||
# 预构建镜像模式:只启动,不构建
|
||||
# 非预构建镜像模式:在目标机本地构建并启动
|
||||
if [[ "${PREBUILT_MODE}" == "true" ]]; then
|
||||
|
||||
Reference in new issue
Block a user