fix(cloud-image): enhance firstboot and cleanup scripts for improved security and functionality

- Updated cleanup.sh to avoid recreating .env during cleanup, preventing exposure of default passwords before firstboot.
- Modified firstboot.sh to create .env from .env.example only if it doesn't exist, ensuring no sensitive data is present before initialization.
- Added support for Docker Hub and GitHub tarball download acceleration via new environment variables WEKNORA_GH_PROXY and DOCKER_REGISTRY_MIRROR.
- Implemented a mechanism to prune old WeKnora images based on the current version, reducing image size and maintaining a clean environment.
- Enhanced README.md with instructions for using the new acceleration features and image pruning options.
This commit is contained in:
wizardchen
2026-05-11 15:21:28 +08:00
committed by lyingbug
parent 0eb95ccbd8
commit 0cfbad7f97
5 changed files with 145 additions and 22 deletions
+6 -1
View File
@@ -1,8 +1,13 @@
[Unit]
Description=WeKnora (docker compose)
Requires=docker.service
Requires=docker.service weknora-firstboot.service
After=docker.service network-online.target weknora-firstboot.service
Wants=network-online.target
# 关键: Requires=weknora-firstboot.service 让首启 init 失败时本服务也不启动,
# 避免 firstboot 没成功生成随机密钥就用 .env.example 默认明文密码把 postgres
# 数据卷初始化掉。weknora-firstboot.service 在已初始化的实例上由
# ConditionPathExists=!/opt/WeKnora/.firstboot.done 跳过, 跳过 = 成功,
# 不会阻塞本服务后续重启。
[Service]
Type=oneshot