chore: keep generated images inside the project as real directories

The absolute-path + symlink layout added earlier today is awkward to
redeploy against: after a fresh clone the symlinks point at nothing and
compose quietly creates empty directories in their place, so the service
comes up healthy with no history.

/root/apps/ holds services only, so the images and the SQLite database
live in the project again as ./output and ./data, bind-mounted with
relative paths. Backups are handled by a separate hook that copies to
/root/backup_files/ai-image/, which is not part of /root/apps/.

Both directories stay gitignored.
This commit is contained in:
Jack
2026-11-04 23:57:55 +08:00
parent 53b2123ae9
commit 751208659d
2 changed files with 12 additions and 11 deletions
+4 -6
View File
@@ -3,14 +3,12 @@
.env.*
!.env.example
# Local runtime data (SQLite + 加密密钥)
# 2026-11-04 起真身已迁到 /root/apps/ai-image-data/(git 工作树外)。
# 这里的 data/ output/ 只保留为指向新位置的符号链接(方便老路径继续用)。
# Local runtime data (SQLite + 加密密钥) 与生成图片
# 这两个是本服务的真身目录,不进 git。
# 备份由 ruantang profile 的 backup-ai-image-output.sh 负责,
# 落到 /root/backup_files/ai-image/。
data/
output/
# 符号链接本身也别提交(目录形式的规则匹配不到 symlink)
/data
/output
.screenshots/
.trae-html-share-packages/
+8 -5
View File
@@ -8,9 +8,12 @@ services:
env_file:
- .env
volumes:
# 生成物与数据库放在 git 工作树外(/root/apps/ai-image 是 git repo,
# 目录一旦被 clone/rm 重建,未跟踪的生成物会一起消失 —— 2026-11-04 丢过一轮)。
# 用绝对路径而非 ./output,避免 bind mount 跟随符号链接的歧义。
- /root/apps/ai-image-data/output:/app/output
- /root/apps/ai-image-data/data:/app/data
# 生成物与数据库用项目内相对路径(2026-11-04 还原)。
# 不用绝对路径也不用符号链接:符号链接在重新 clone/rm -rf 重建后
# 会指向空气,compose 还会静默创建一个空目录。
# 注意:/root/apps/ai-image/output 与 /root/apps/ai-image/data 是本服务的
# 生成物目录,删项目之前先备份(备份脚本见 ruantang profile 的
# backup-ai-image-output.sh,落到 /root/backup_files/ai-image/)。
- ./output:/app/output
- ./data:/app/data
restart: unless-stopped