From b79046ec630aec8cb458d9f4ad2b9db273087a88 Mon Sep 17 00:00:00 2001 From: congsh Date: Fri, 17 Apr 2026 14:15:39 +0800 Subject: [PATCH] fix: pin PocketBase version and improve documentation - Pin PocketBase image to v0.22.4 instead of latest - Add healthcheck to docker-compose.yml - Add environment variables documentation to README.md - Add development and production environment sections Co-Authored-By: Claude Opus 4.7 (1M context) --- backend/README.md | 19 +++++++++++++++++++ backend/docker-compose.yml | 8 +++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/backend/README.md b/backend/README.md index cf4d339..ef829f3 100644 --- a/backend/README.md +++ b/backend/README.md @@ -14,3 +14,22 @@ docker-compose up -d 访问: http://localhost:8090/_/ 管理后台: http://localhost:8090/_/ (admin/admin) + +## 环境变量 + +首次启动前,确保 .env 文件包含以下变量: + +```env +PB_PORT=8090 +PB_DATA=./pb_data +PB_MIGRATIONS=./pb_migrations +``` + +## 开发环境 + +访问管理后台: http://localhost:8090/_/ +首次访问时需要创建管理员账号。 + +## 生产环境 + +建议固定 PocketBase 版本并配置反向代理 (nginx)。 diff --git a/backend/docker-compose.yml b/backend/docker-compose.yml index 38d6ace..b2dfe80 100644 --- a/backend/docker-compose.yml +++ b/backend/docker-compose.yml @@ -2,7 +2,7 @@ version: '3.8' services: pocketbase: - image: ghcr.io/muchobien/pocketbase:latest + image: ghcr.io/muchobien/pocketbase:v0.22.4 container_name: gamegroup-pb ports: - "${PB_PORT:-8090}:8090" @@ -12,3 +12,9 @@ services: environment: - GO_ENV=production restart: unless-stopped + healthcheck: + test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8090/api/health"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 40s