From e857a0e46d18f98f2f7eb19b4ce05171669a7c44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=80=BB=E5=B7=A5?= Date: Sun, 30 Aug 2026 22:08:09 +0800 Subject: [PATCH] =?UTF-8?q?HEL-270:=20compose=20=E6=94=AF=E6=8C=81=20APP?= =?UTF-8?q?=5FUID/APP=5FGID=20=E5=8C=B9=E9=85=8D=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E7=9B=AE=E5=BD=95=E5=B1=9E=E4=B8=BB=EF=BC=88=E4=BF=AE=20WAL=20?= =?UTF-8?q?readonly=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: multica-agent --- deploy/.env.example | 4 ++++ deploy/README.md | 2 ++ deploy/compose.yaml | 3 +++ 3 files changed, 9 insertions(+) diff --git a/deploy/.env.example b/deploy/.env.example index d24ae32..ebf972a 100644 --- a/deploy/.env.example +++ b/deploy/.env.example @@ -1,6 +1,10 @@ # 测试环境变量示例。复制为 deploy/.env 后填写。 # 正式环境口令不得提交进仓库。 +# 容器运行 uid/gid:必须与 data/ 目录属主一致(宿主机 `id <用户>` 查看) +APP_UID=10001 +APP_GID=10001 + APP_HOST=0.0.0.0 APP_PORT=4173 APP_DB_PATH=/app/data/app.db diff --git a/deploy/README.md b/deploy/README.md index b6f0f98..b62e726 100644 --- a/deploy/README.md +++ b/deploy/README.md @@ -30,6 +30,8 @@ git fetch && git checkout release/prod && git pull cd deploy cp .env.example .env # 首次;按上面铁律填写 +# .env 必设 APP_UID/APP_GID = data/ 目录属主的 uid/gid(宿主机 `id <用户>`), +# 否则 SQLite WAL 写库报 readonly TAG=$(git rev-parse --short HEAD) ./deploy.sh curl -fsS http://127.0.0.1:4173/ >/dev/null && echo healthy ``` diff --git a/deploy/compose.yaml b/deploy/compose.yaml index 6b64423..78ca61c 100644 --- a/deploy/compose.yaml +++ b/deploy/compose.yaml @@ -11,6 +11,9 @@ services: dockerfile: deploy/Dockerfile env_file: - .env + # 绑定挂载 data/ 时,容器运行 uid 必须与数据目录属主一致(.env 里设 + # APP_UID/APP_GID,正式与测试环境各自填写,默认镜像内 app=10001) + user: "${APP_UID:-10001}:${APP_GID:-10001}" ports: - "4173:4173" volumes: