Hair Keeper v1.3.0版本更新:支持北京大学统一认证(IAAA)SSO登录;基于Redis实现权限变更后强制重新登录;解决MinIO客户端直传在反向代理部署下的兼容问题;云开发容器增加文件持久化机制、rsync、JDK17、Database Client插件

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-18 14:45:17 +08:00
parent 66c96fd331
commit 25762eee84
5 changed files with 46 additions and 16 deletions

View File

@@ -1,7 +1,7 @@
#!/bin/bash
# ============================================
# 文件持久化:通过符号链接将零碎文件持久化到命名卷
# 文件持久化:启动时恢复 + 后台定期同步到命名卷
# ============================================
PERSIST_DIR="/root/.hair-keeper-persist"
PERSIST_FILES=(
@@ -12,22 +12,29 @@ PERSIST_FILES=(
mkdir -p "$PERSIST_DIR"
# 启动时恢复:持久化目录中的文件优先覆盖到原路径
for filepath in "${PERSIST_FILES[@]}"; do
filename=$(basename "$filepath")
persist_path="$PERSIST_DIR/$filename"
# 如果原路径是真实文件(非符号链接),迁移到持久化目录
if [ -f "$filepath" ] && [ ! -L "$filepath" ]; then
mv "$filepath" "$persist_path"
if [ -f "$persist_path" ] && [ -s "$persist_path" ]; then
cp "$persist_path" "$filepath"
fi
# 确保持久化目录中存在该文件
[ -f "$persist_path" ] || touch "$persist_path"
# 创建符号链接
ln -sf "$persist_path" "$filepath"
done
# 后台定期同步将原路径文件同步回持久化目录每60秒
(
while true; do
sleep 60
for filepath in "${PERSIST_FILES[@]}"; do
filename=$(basename "$filepath")
persist_path="$PERSIST_DIR/$filename"
if [ -f "$filepath" ]; then
rsync -a "$filepath" "$persist_path"
fi
done
done
) &
# 设置默认密码
DEV_PASSWORD=${DEV_PASSWORD:-clouddev}
@@ -70,5 +77,20 @@ echo ""
echo "提示: 可通过环境变量 DEV_PASSWORD 自定义密码"
echo ""
# 容器停止时执行最终同步
cleanup() {
echo "Syncing persistent files before shutdown..."
for filepath in "${PERSIST_FILES[@]}"; do
filename=$(basename "$filepath")
persist_path="$PERSIST_DIR/$filename"
if [ -f "$filepath" ]; then
rsync -a "$filepath" "$persist_path"
fi
done
exit 0
}
trap cleanup SIGTERM SIGINT
# 保持容器运行
tail -f /dev/null
tail -f /dev/null &
wait $!