Skip to content

Commit 9d5900c

Browse files
authored
Merge pull request #35 from SubBoost/ryan/dev
Fix v2.5.0 self-hosted doctor
2 parents 31157c8 + 046c846 commit 9d5900c

3 files changed

Lines changed: 70 additions & 4 deletions

File tree

docs/release-notes.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ SubBoost v2.5.0 主要改善代理组编辑、自部署更新和订阅生成稳
88

99
### 主要变化
1010

11-
- 移除单独的筛选代理组入口,相关功能转移到分流代理组高级模式和自定义分流组。
11+
- **移除筛选代理组**,相关功能转移到分流代理组高级模式和自定义分流组。
1212
- 分流代理组高级模式支持按来源、地区、关键词和排除条件整理节点。
1313
- 订阅生成更稳,规则顺序、代理组输出和常见 Mihomo 字段处理减少了意外变化。
1414
- 节点导入兼容性更好,覆盖更多常见节点链接和 Mihomo YAML 配置。
@@ -22,7 +22,7 @@ SubBoost v2.5.0 主要改善代理组编辑、自部署更新和订阅生成稳
2222
- 建议升级前备份 `/opt/subboost/.env` 和数据库,方便需要时回滚。
2323
- 已安装 v2.4.0 的自部署实例可以继续使用 `subboost update` 更新。
2424
- 普通订阅转换、模板和规则功能不需要手动改环境变量。
25-
- 现有筛选代理组会自动迁移到自定义代理组。如果你在 v2.4.0 使用过筛选代理组,请升级后打开自定义代理组检查;必要时可能需要重新配置
25+
- 如果你在 v2.4.0 使用过筛选代理组,请升级后到自定义代理组或分流代理组高级模式里重新配置
2626

2727
## English
2828

@@ -32,7 +32,7 @@ SubBoost v2.5.0 mainly improves proxy group editing, self-hosted updates, and su
3232

3333
### Main Changes
3434

35-
- Removed the separate filtered proxy group entry point. Related features have moved to proxy group advanced mode and custom proxy groups.
35+
- Removed filtered proxy groups. Related features have moved to proxy group advanced mode and custom proxy groups.
3636
- Proxy group advanced mode supports organizing nodes by source, region, keyword, and exclusion rules.
3737
- Made subscription generation more stable, reducing unexpected changes in rule order, proxy group output, and common Mihomo fields.
3838
- Improved node import compatibility for more common node links and Mihomo YAML configurations.
@@ -46,4 +46,4 @@ SubBoost v2.5.0 mainly improves proxy group editing, self-hosted updates, and su
4646
- Back up `/opt/subboost/.env` and the database before upgrading so rollback is easier if needed.
4747
- Existing v2.4.0 self-hosted installations can continue to update with `subboost update`.
4848
- Normal subscription conversion, templates, and rules do not require manual environment-variable changes.
49-
- Existing filtered proxy groups will migrate to custom proxy groups automatically. If you used filtered proxy groups in v2.4.0, open the custom proxy group editor after upgrading and check the result. You may need to reconfigure them if the output is not what you expect.
49+
- If you used filtered proxy groups in v2.4.0, reconfigure them after upgrading through custom proxy groups or proxy group advanced mode.

local/scripts/selfhost-shell.test.ts

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,71 @@ ENV
150150
expect(result.stdout).toContain("Doctor: OK");
151151
});
152152

153+
it("loads SUBBOOST_PORT from .env before doctor health checks", () => {
154+
const script = `
155+
set -Eeuo pipefail
156+
home="$(mktemp -d)"
157+
trap 'rm -rf "$home"' EXIT
158+
cat > "$home/.env" <<'ENV'
159+
SUBBOOST_IMAGE=image
160+
POSTGRES_DB=subboost
161+
POSTGRES_USER=subboost
162+
POSTGRES_PASSWORD=password
163+
DATABASE_URL=postgresql://subboost:password@db:5432/subboost?schema=public
164+
ENCRYPTION_KEY=key
165+
JWT_SECRET=jwt
166+
CRON_SECRET=cron
167+
APP_URL=http://127.0.0.1:31041
168+
SUBBOOST_PORT=31041
169+
ENV
170+
: > "$home/docker-compose.yml"
171+
export SUBBOOST_SCRIPT_SOURCE_ONLY=1
172+
export SUBBOOST_HOME="$home"
173+
export SUBBOOST_DOCTOR_HEALTH_ATTEMPTS=1
174+
export SUBBOOST_DOCTOR_HEALTH_INTERVAL_SECONDS=0
175+
unset SUBBOOST_PORT APP_URL
176+
source local/scripts/subboost.sh
177+
docker() {
178+
if [ "$1" = "info" ]; then return 0; fi
179+
if [ "$1" = "compose" ]; then
180+
case "$*" in
181+
"compose version"*) return 0 ;;
182+
*" config") return 0 ;;
183+
*" ps -q app") printf 'app-id\\n'; return 0 ;;
184+
*" ps -q db") printf 'db-id\\n'; return 0 ;;
185+
*" ps -q cron") printf 'cron-id\\n'; return 0 ;;
186+
esac
187+
fi
188+
if [ "$1" = "inspect" ]; then
189+
case "$*" in
190+
*".State.Status"*) printf 'running\\n'; return 0 ;;
191+
*".State.Health"*) printf 'healthy\\n'; return 0 ;;
192+
esac
193+
fi
194+
return 0
195+
}
196+
curl_urls="$home/curl-urls"
197+
: > "$curl_urls"
198+
curl() {
199+
printf '%s\\n' "$*" >> "$curl_urls"
200+
case "$*" in
201+
*"http://127.0.0.1:31041/api/health/"*) return 0 ;;
202+
esac
203+
return 1
204+
}
205+
doctor_cmd
206+
cat "$curl_urls"
207+
`;
208+
209+
const result = runBash(script);
210+
211+
expect(result.status).toBe(0);
212+
expect(result.stdout).toContain("Doctor: OK");
213+
expect(result.stdout).toContain("http://127.0.0.1:31041/api/health/live");
214+
expect(result.stdout).toContain("http://127.0.0.1:31041/api/health/ready");
215+
expect(result.stdout).not.toContain("http://127.0.0.1:3000/api/health");
216+
});
217+
153218
it("waits for health before reporting update status", () => {
154219
const script = `
155220
set -Eeuo pipefail

local/scripts/subboost.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,7 @@ doctor_cmd() {
348348
[ -d "$SUBBOOST_HOME" ] || die "Missing $SUBBOOST_HOME"
349349
[ -f "$ENV_FILE" ] || die "Missing $ENV_FILE"
350350
[ -f "$COMPOSE_FILE" ] || die "Missing $COMPOSE_FILE"
351+
load_env
351352
for key in SUBBOOST_IMAGE POSTGRES_DB POSTGRES_USER POSTGRES_PASSWORD DATABASE_URL ENCRYPTION_KEY JWT_SECRET CRON_SECRET APP_URL SUBBOOST_PORT; do
352353
grep -q "^$key=" "$ENV_FILE" || die "Missing $key in $ENV_FILE"
353354
done

0 commit comments

Comments
 (0)