refactor: 项目更名 WeKnora → Academy
Build & Publish (dsh-academy) / End-to-end inside dsh (latest, advisory) (push) Skipped
CLI / test (macos-latest / go 1.26) (push) Canceled after 0s
CLI / test (ubuntu-latest / go 1.26) (push) Canceled after 0s
CLI / test (windows-latest / go 1.26) (push) Canceled after 0s
Build and Push Docker Image / build-ui (push) Canceled after 0s
Build and Push Docker Image / build-docreader (push) Canceled after 0s
Build and Push Docker Image / build-sandbox (push) Canceled after 0s
Build and Push Docker Image / build-app (amd64, linux/amd64, ubuntu-latest) (push) Canceled after 0s
Build and Push Docker Image / build-app (arm64, linux/arm64, ubuntu-24.04-arm) (push) Canceled after 0s
Build and Push Docker Image / merge (push) Canceled after 0s
Frontend / Test, type-check, and build (push) Canceled after 0s
Frontend / Docker multi-stage image (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.10) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.11) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.12) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.13) (push) Canceled after 0s
Build & Publish (mcp-server) / Build sdist + wheel (push) Canceled after 0s
Build & Publish (mcp-server) / Publish to PyPI (push) Canceled after 0s
Anydoc / anydoc parser engine (push) Canceled after 0s
App / Format, vet, test, and build (push) Canceled after 0s
DocReader / Python tests and Go client tests (push) Canceled after 0s
Build & Publish (dsh-academy) / Typecheck, test, pack (push) Canceled after 0s
Build & Publish (dsh-academy) / End-to-end inside dsh (pinned) (push) Canceled after 0s
Build & Publish (dsh-academy) / Publish to npm (push) Canceled after 0s
Go Lint Cache / warm lint cache (.) (push) Canceled after 0s
Go Lint Cache / warm lint cache (cli) (push) Canceled after 0s
Go Lint Cache / warm lint cache (client) (push) Canceled after 0s
Helm / chart (push) Canceled after 0s
Build & Publish (dsh-academy) / End-to-end inside dsh (latest, advisory) (push) Skipped
CLI / test (macos-latest / go 1.26) (push) Canceled after 0s
CLI / test (ubuntu-latest / go 1.26) (push) Canceled after 0s
CLI / test (windows-latest / go 1.26) (push) Canceled after 0s
Build and Push Docker Image / build-ui (push) Canceled after 0s
Build and Push Docker Image / build-docreader (push) Canceled after 0s
Build and Push Docker Image / build-sandbox (push) Canceled after 0s
Build and Push Docker Image / build-app (amd64, linux/amd64, ubuntu-latest) (push) Canceled after 0s
Build and Push Docker Image / build-app (arm64, linux/arm64, ubuntu-24.04-arm) (push) Canceled after 0s
Build and Push Docker Image / merge (push) Canceled after 0s
Frontend / Test, type-check, and build (push) Canceled after 0s
Frontend / Docker multi-stage image (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.10) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.11) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.12) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.13) (push) Canceled after 0s
Build & Publish (mcp-server) / Build sdist + wheel (push) Canceled after 0s
Build & Publish (mcp-server) / Publish to PyPI (push) Canceled after 0s
Anydoc / anydoc parser engine (push) Canceled after 0s
App / Format, vet, test, and build (push) Canceled after 0s
DocReader / Python tests and Go client tests (push) Canceled after 0s
Build & Publish (dsh-academy) / Typecheck, test, pack (push) Canceled after 0s
Build & Publish (dsh-academy) / End-to-end inside dsh (pinned) (push) Canceled after 0s
Build & Publish (dsh-academy) / Publish to npm (push) Canceled after 0s
Go Lint Cache / warm lint cache (.) (push) Canceled after 0s
Go Lint Cache / warm lint cache (cli) (push) Canceled after 0s
Go Lint Cache / warm lint cache (client) (push) Canceled after 0s
Helm / chart (push) Canceled after 0s
- 全量替换代码/配置/文档中的项目名(保留上游 GitHub 链接、weixin 文档域名、Docker Hub 镜像名) - 重命名 32 个含项目名的文件/目录;Go module 路径改为 academy(含 client/cli 子模块) - docreader proto 描述符采用等长替换,保持序列化字节布局有效 - Dockerfile.app 构建网络修复: browserskill 离线产物通道、PyPI/apt 国内镜像 - 运行验证: go build ✓ docker compose up ✓ 健康检查 ✓
This commit is contained in:
1 parent
9097ee699d
commit
9058149576
3136 files changed
+18018
-18004
No files matched your search
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# firstboot.sh - 由 weknora-firstboot.service 在新实例首次开机时自动执行。
|
||||
# firstboot.sh - 由 academy-firstboot.service 在新实例首次开机时自动执行。
|
||||
# 任务: 生成随机密钥写入 .env -> 启动容器 -> 输出凭证 -> 标记完成 + 自禁用。
|
||||
#
|
||||
# 幂等性策略:
|
||||
@@ -11,12 +11,12 @@
|
||||
# 凭证仍可在 ${ENV_FILE} 中查到。
|
||||
set -euo pipefail
|
||||
|
||||
WEKNORA_DIR="${WEKNORA_DIR:-/opt/WeKnora}"
|
||||
ENV_FILE="${WEKNORA_DIR}/.env"
|
||||
ENV_TEMPLATE="${WEKNORA_DIR}/.env.example"
|
||||
CRED_FILE="/root/weknora-credentials.txt"
|
||||
LOG_FILE="/var/log/weknora-firstboot.log"
|
||||
MARKER="${WEKNORA_DIR}/.firstboot.done"
|
||||
ACADEMY_DIR="${ACADEMY_DIR:-/opt/Academy}"
|
||||
ENV_FILE="${ACADEMY_DIR}/.env"
|
||||
ENV_TEMPLATE="${ACADEMY_DIR}/.env.example"
|
||||
CRED_FILE="/root/academy-credentials.txt"
|
||||
LOG_FILE="/var/log/academy-firstboot.log"
|
||||
MARKER="${ACADEMY_DIR}/.firstboot.done"
|
||||
|
||||
# 提前打开 LOG_FILE, 同时把 stderr 也复制一份到 systemd journal 方便调试
|
||||
# (单纯 exec >> LOG_FILE 时, 脚本一开始的失败会因为 stderr 已被吞掉而看不到)
|
||||
@@ -30,7 +30,7 @@ if [[ -f "${MARKER}" ]]; then
|
||||
fi
|
||||
|
||||
# cleanup.sh 不再保留 .env, 这里从 .env.example 拷贝模板再做替换。
|
||||
# 这样保证 firstboot 之前不会有任何含明文默认密码的 .env 让 weknora.service
|
||||
# 这样保证 firstboot 之前不会有任何含明文默认密码的 .env 让 academy.service
|
||||
# 抢先把 postgres 数据卷用错的密码初始化掉。
|
||||
if [[ ! -f "${ENV_FILE}" ]]; then
|
||||
if [[ -f "${ENV_TEMPLATE}" ]]; then
|
||||
@@ -77,15 +77,15 @@ replace JWT_SECRET "${JWT}"
|
||||
replace SYSTEM_AES_KEY "${SYS_AES}"
|
||||
replace GIN_MODE "release"
|
||||
|
||||
# 把 prepare.sh 阶段记录在 .cloud-image-meta 里的 WEKNORA_REF 还原为 .env 的
|
||||
# WEKNORA_VERSION, 否则 docker compose 会落回 :latest 默认值, 导致镜像版本
|
||||
# 把 prepare.sh 阶段记录在 .cloud-image-meta 里的 ACADEMY_REF 还原为 .env 的
|
||||
# ACADEMY_VERSION, 否则 docker compose 会落回 :latest 默认值, 导致镜像版本
|
||||
# 与 prepare 时拉取的版本不一致。
|
||||
META_FILE="${WEKNORA_DIR}/.cloud-image-meta"
|
||||
META_FILE="${ACADEMY_DIR}/.cloud-image-meta"
|
||||
if [[ -f "${META_FILE}" ]]; then
|
||||
META_REF=$(grep -E '^WEKNORA_REF=' "${META_FILE}" | tail -1 | cut -d= -f2- || true)
|
||||
META_REF=$(grep -E '^ACADEMY_REF=' "${META_FILE}" | tail -1 | cut -d= -f2- || true)
|
||||
if [[ -n "${META_REF}" ]]; then
|
||||
replace WEKNORA_VERSION "${META_REF}"
|
||||
echo "restored WEKNORA_VERSION=${META_REF} from ${META_FILE}"
|
||||
replace ACADEMY_VERSION "${META_REF}"
|
||||
echo "restored ACADEMY_VERSION=${META_REF} from ${META_FILE}"
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -97,7 +97,7 @@ touch "${MARKER}"
|
||||
chmod 0600 "${MARKER}"
|
||||
|
||||
echo "env updated, marker written, starting docker compose..."
|
||||
cd "${WEKNORA_DIR}"
|
||||
cd "${ACADEMY_DIR}"
|
||||
"${DOCKER_BIN}" compose up -d
|
||||
|
||||
# 尝试拿公网 IP, 失败就用内网
|
||||
@@ -107,7 +107,7 @@ PUB_IP=$(curl -fsS --max-time 5 https://ifconfig.me 2>/dev/null \
|
||||
|
||||
cat >"${CRED_FILE}" <<INFO
|
||||
========================================
|
||||
WeKnora 实例初始化完成
|
||||
Academy 实例初始化完成
|
||||
生成时间: $(date -Iseconds)
|
||||
========================================
|
||||
|
||||
@@ -115,7 +115,7 @@ cat >"${CRED_FILE}" <<INFO
|
||||
|
||||
注册后如需关闭后续注册, 编辑 ${ENV_FILE}:
|
||||
DISABLE_REGISTRATION=true
|
||||
然后执行: cd ${WEKNORA_DIR} && docker compose up -d
|
||||
然后执行: cd ${ACADEMY_DIR} && docker compose up -d
|
||||
|
||||
下列随机凭证已写入 ${ENV_FILE}, 请妥善保存(仅 root 可读):
|
||||
DB_PASSWORD = ${DB_PWD}
|
||||
@@ -133,7 +133,7 @@ INFO
|
||||
echo "credentials written to ${CRED_FILE}"
|
||||
|
||||
# 仅停掉 unit, 不删 unit 文件 (否则当前正在运行的 oneshot 可能被 systemd 标记 failed)。
|
||||
# 下次重启时, weknora-firstboot.service 通过 ConditionPathExists=!${MARKER} 自动跳过。
|
||||
systemctl disable weknora-firstboot.service || true
|
||||
# 下次重启时, academy-firstboot.service 通过 ConditionPathExists=!${MARKER} 自动跳过。
|
||||
systemctl disable academy-firstboot.service || true
|
||||
|
||||
echo "==== firstboot finished at $(date -Iseconds) ===="
|
||||
Reference in new issue
Block a user