From 8a5a4f73d049c83d2a2b493821c285d1d08829e6 Mon Sep 17 00:00:00 2001 From: chenzai666 Date: 2026年6月19日 11:09:52 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=BC=80=E7=AE=B1?= =?UTF-8?q?=E5=8D=B3=E7=94=A8=E7=9A=84=20Docker=20Compose=20=E9=83=A8?= =?UTF-8?q?=E7=BD=B2=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - docker-compose.yml:基于预构建镜像 bats666/subboost,含 PostgreSQL + cron - start.sh:首次运行自动生成 POSTGRES_PASSWORD/ENCRYPTION_KEY/JWT_SECRET/CRON_SECRET - 默认端口 8488 Co-Authored-By: Claude Sonnet 4.6 --- docker-compose.yml | 56 ++++++++++++++++++++++++++++++++++++++++++++++ start.sh | 47 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 103 insertions(+) create mode 100644 docker-compose.yml create mode 100755 start.sh diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..9ff6b32 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,56 @@ +services: + db: + image: postgres:16-alpine + restart: unless-stopped + environment: + POSTGRES_DB: subboost + POSTGRES_USER: subboost + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} + volumes: + - subboost-db:/var/lib/postgresql/data + healthcheck: + test: ["CMD-SHELL", "pg_isready -U subboost -d subboost"] + interval: 10s + timeout: 5s + retries: 10 + + app: + image: bats666/subboost:latest + restart: unless-stopped + depends_on: + db: + condition: service_healthy + ports: + - "${SUBBOOST_PORT:-8488}:3000" + environment: + DATABASE_URL: postgresql://subboost:${POSTGRES_PASSWORD}@db:5432/subboost + ENCRYPTION_KEY: ${ENCRYPTION_KEY} + JWT_SECRET: ${JWT_SECRET} + CRON_SECRET: ${CRON_SECRET} + APP_URL: ${APP_URL:-http://localhost:3000} + + cron: + image: curlimages/curl:8.11.1 + restart: unless-stopped + depends_on: + app: + condition: service_started + environment: + CRON_SECRET: ${CRON_SECRET} + command: + - "sh" + - "-c" + - | + i=0 + while true; do + if [ $$i -le 0 ]; then + curl -fsS -X POST -H "Authorization: Bearer $${CRON_SECRET}" http://app:3000/api/cron/update-rule-index || true + i=10 + fi + curl -fsS -X POST -H "Authorization: Bearer $${CRON_SECRET}" http://app:3000/api/cron/update-subscriptions || true + i=$$((i - 1)) + sleep 360 + done + +volumes: + subboost-db: diff --git a/start.sh b/start.sh new file mode 100755 index 0000000..ea0d100 --- /dev/null +++ b/start.sh @@ -0,0 +1,47 @@ +#!/bin/sh +set -e + +ENV_FILE=".env" +STATE_DIR=".data" +mkdir -p "$STATE_DIR" + +gen_secret() { + openssl rand -hex 32 +} + +load_or_gen() { + local key="1ドル" file="$STATE_DIR/.2ドル" + if [ -f "$file" ]; then + cat "$file" + else + val=$(gen_secret) + printf '%s' "$val"> "$file" + printf '%s' "$val" + fi +} + +if [ ! -f "$ENV_FILE" ]; then + echo "[subboost] 首次启动,自动生成密钥..." + + POSTGRES_PASSWORD=$(load_or_gen POSTGRES_PASSWORD pg_password) + ENCRYPTION_KEY=$(load_or_gen ENCRYPTION_KEY encryption_key) + JWT_SECRET=$(load_or_gen JWT_SECRET jwt_secret) + CRON_SECRET=$(load_or_gen CRON_SECRET cron_secret) + + cat> "$ENV_FILE" < Date: 2026年6月19日 11:22:22 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E9=87=8D=E5=86=99=20README=EF=BC=9A?= =?UTF-8?q?=E7=A7=BB=E9=99=A4=E5=A4=96=E9=83=A8=E9=93=BE=E6=8E=A5=EF=BC=8C?= =?UTF-8?q?=E4=BB=A5=20Docker=20Compose=20=E9=83=A8=E7=BD=B2=E4=B8=BA?= =?UTF-8?q?=E4=B8=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 4.6 --- README-CN.md | 60 +++++++++++++++++++++++++++------------- README.md | 78 +++++++++++++++++++++++++++++++++------------------- 2 files changed, 91 insertions(+), 47 deletions(-) diff --git a/README-CN.md b/README-CN.md index 376febd..9259372 100644 --- a/README-CN.md +++ b/README-CN.md @@ -5,9 +5,7 @@

平台:Linux + Docker 版本 2.4.0 - 在线入口 - 文档 - GHCR 镜像 + Docker Hub 镜像

English | 中文

@@ -32,16 +30,50 @@ SubBoost 可视化配置界面

-## 使用和部署 +## 部署 -- 在线入口:[无需部署 - 直接使用的公益服务](https://subboost.org) -- 部署文档:[一键部署 - 拉取镜像构建,速度快配置要求低](https://docs.subboost.org/deploy/one-click) -- 部署文档:[高级部署 - 编译源码构建,速度慢配置要求高](https://docs.subboost.org/deploy/advanced) -- 配置教程:[草履虫也能学会的 Clash 配置:UI 界面一键配置精确分流、链式代理](https://ryanvan.com/t/topic/59?u=ryan) +**前置要求:** Docker + Docker Compose + +```bash +git clone https://github.com/chenzai666/subboost.git +cd subboost +./start.sh +``` + +首次运行 `start.sh` 会自动生成所有密钥并写入 `.env`,随后拉取镜像(`bats666/subboost`)并启动全部服务(应用 + PostgreSQL + 定时任务)。 + +默认端口 **8488**,访问 `http://:8488`。 + +### 手动配置 + +复制示例配置文件并按需修改: + +```bash +cp local/local.env.example .env +# 编辑 .env,填写 POSTGRES_PASSWORD、ENCRYPTION_KEY、JWT_SECRET、CRON_SECRET +docker compose up -d +``` + +### 更新 + +```bash +docker compose pull && docker compose up -d +``` + +### 环境变量说明 + +| 变量 | 说明 | 示例 | +|------|------|------| +| `POSTGRES_PASSWORD` | 数据库密码 | 随机字符串 | +| `ENCRYPTION_KEY` | 数据加密密钥 | 64 位十六进制 | +| `JWT_SECRET` | JWT 签名密钥 | 64 位十六进制 | +| `CRON_SECRET` | 定时任务鉴权 token | 64 位十六进制 | +| `APP_URL` | 应用访问地址 | `http://192.168.1.1:8488` | +| `SUBBOOST_PORT` | 监听端口(默认 8488) | `8488` | ## 开发说明 -开发者可以从源码启动本地开发环境: +从源码启动本地开发环境: ```bash npm ci @@ -56,20 +88,10 @@ npm run test:unit npm run check:local-app ``` -## 相关链接 - -- 在线入口:[https://subboost.org](https://subboost.org) -- 部署文档:[https://docs.subboost.org](https://docs.subboost.org) -- 发行公告:[docs/release-notes.md](./docs/release-notes.md) -- 更新日志:[https://subboost.org/faq](https://subboost.org/faq) -- 社区反馈:[LINUX DO](https://linux.do/) & [IDC Flare](https://idcflare.com/);同时感谢论坛中小伙伴们的积极讨论和反馈 - ## 开源许可 SubBoost 公开源码以 [GNU Affero General Public License v3.0 only](./LICENSE) 授权。 -如果你修改 SubBoost 并通过网络向用户提供服务,AGPL-3.0 要求你向这些用户提供对应源码。公开源码入口是 [SubBoost/subboost](https://github.com/SubBoost/subboost)。 - ## 免责声明 本项目不提供任何代理服务,不对第三方订阅内容的可用性与合法性作出保证。 diff --git a/README.md b/README.md index 564b238..22dfdb3 100644 --- a/README.md +++ b/README.md @@ -5,26 +5,24 @@

Platform: Linux + Docker Version 2.4.0 - Online app - Documentation - GHCR image + Docker Hub image

English | 中文

-**SubBoost** is a **Clash/Mihomo subscription conversion, enhancement, and management** tool. It can convert airport subscriptions and self-hosted nodes into optimized aggregate subscriptions, then update them automatically. With the visual UI, you can configure advanced features such as **chained proxies, precise routing, DNS leak prevention, and multi-subscription aggregation** in one click. +**SubBoost** is a **Clash/Mihomo subscription conversion, enhancement, and management** tool. It converts airport subscriptions and self-hosted nodes into optimized aggregate subscriptions with automatic updates. With the visual UI, configure **chained proxies, precise routing, DNS leak prevention, and multi-subscription aggregation** in one click. -## Highlights & Use Cases +## Highlights - **Subscription conversion**: Import subscription links, YAML files, node links, and other common formats. - **Node management**: Rename, delete, or configure listening ports for nodes in batches. -- **Node filtering**: Build `filtered proxy groups` with only selected nodes by source, region, and custom rules. +- **Node filtering**: Build `filtered proxy groups` with selected nodes by source, region, and custom rules. - **Chained proxies**: Configure chained proxies and `relay proxy groups` visually in one click. -- **Precise routing**: Enable more than 30 common proxy groups and over 2,000 remote rule sets. -- **Rule management**: Reorder rules for deeper customization by advanced users. -- **DNS leak prevention**: The default `basic and DNS configuration` helps prevent DNS leaks. -- **Automatic refresh**: Refresh subscriptions on a schedule and intelligently match nodes during refresh. +- **Precise routing**: Enable 30+ common proxy groups and 2,000+ remote rule sets. +- **Rule management**: Reorder rules for deeper customization. +- **DNS leak prevention**: The default `basic and DNS configuration` prevents DNS leaks. +- **Automatic refresh**: Refresh subscriptions on a schedule with intelligent node matching. ## Interface Preview @@ -32,16 +30,50 @@ SubBoost visual configuration interface

-## Usage & Deployment +## Deployment -- Online entry: [No deployment required - direct access to the public service](https://subboost.org) -- Deployment docs: [One-click deployment - pulls an image to build, faster with lower requirements](https://docs.subboost.org/deploy/one-click) -- Deployment docs: [Advanced deployment - compiles from source, slower with higher requirements](https://docs.subboost.org/deploy/advanced) -- Configuration guide: [Clash configuration simple enough for a paramecium: configure precise routing and chained proxies from the UI in one click](https://ryanvan.com/t/topic/59?u=ryan) +**Requirements:** Docker + Docker Compose -## Development Notes +```bash +git clone https://github.com/chenzai666/subboost.git +cd subboost +./start.sh +``` + +On first run, `start.sh` auto-generates all secrets into `.env`, then pulls the image (`bats666/subboost`) and starts all services (app + PostgreSQL + cron). + +Default port is **8488**, visit `http://:8488`. + +### Manual Setup -Developers can start a local development environment from source: +Copy the example config and edit as needed: + +```bash +cp local/local.env.example .env +# Edit .env: fill in POSTGRES_PASSWORD, ENCRYPTION_KEY, JWT_SECRET, CRON_SECRET +docker compose up -d +``` + +### Update + +```bash +docker compose pull && docker compose up -d +``` + +### Environment Variables + +| Variable | Description | Example | +|----------|-------------|---------| +| `POSTGRES_PASSWORD` | Database password | random string | +| `ENCRYPTION_KEY` | Data encryption key | 64-char hex | +| `JWT_SECRET` | JWT signing key | 64-char hex | +| `CRON_SECRET` | Cron job auth token | 64-char hex | +| `APP_URL` | App access URL | `http://192.168.1.1:8488` | +| `SUBBOOST_PORT` | Listening port (default 8488) | `8488` | + +## Development + +Start a local development environment from source: ```bash npm ci @@ -56,19 +88,9 @@ npm run test:unit npm run check:local-app ``` -## Links - -- Online entry: [https://subboost.org](https://subboost.org) -- Deployment docs: [https://docs.subboost.org](https://docs.subboost.org) -- Release announcements: [docs/release-notes.md](./docs/release-notes.md) -- Changelog: [https://subboost.org/faq](https://subboost.org/faq) -- Community feedback: [LINUX DO](https://linux.do/) & [IDC Flare](https://idcflare.com/); thanks to everyone in the forums for the active discussion and feedback. - ## License -The public SubBoost source code is licensed under the [GNU Affero General Public License v3.0 only](./LICENSE). - -If you modify SubBoost and provide it to users over a network, AGPL-3.0 requires you to offer those users the corresponding source code. The public source entry is [SubBoost/subboost](https://github.com/SubBoost/subboost). +The SubBoost source code is licensed under the [GNU Affero General Public License v3.0 only](./LICENSE). ## Disclaimer From 54b28692a29758f2669ec5d2c8f5bd56b63e7cdb Mon Sep 17 00:00:00 2001 From: chenzai666 Date: 2026年6月19日 11:26:24 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E6=94=B9?= =?UTF-8?q?=E7=94=A8=E9=9D=9E=E9=BB=98=E8=AE=A4=E7=AB=AF=E5=8F=A3=2015432?= =?UTF-8?q?=EF=BC=8C=E9=81=BF=E5=85=8D=E4=B8=8E=E5=85=B6=E4=BB=96=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 4.6 --- README-CN.md | 3 ++- README.md | 3 ++- docker-compose.yml | 2 ++ start.sh | 1 + 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/README-CN.md b/README-CN.md index 9259372..91849b4 100644 --- a/README-CN.md +++ b/README-CN.md @@ -69,7 +69,8 @@ docker compose pull && docker compose up -d | `JWT_SECRET` | JWT 签名密钥 | 64 位十六进制 | | `CRON_SECRET` | 定时任务鉴权 token | 64 位十六进制 | | `APP_URL` | 应用访问地址 | `http://192.168.1.1:8488` | -| `SUBBOOST_PORT` | 监听端口(默认 8488) | `8488` | +| `SUBBOOST_PORT` | 应用监听端口(默认 8488) | `8488` | +| `SUBBOOST_DB_PORT` | 数据库对外端口(默认 15432) | `15432` | ## 开发说明 diff --git a/README.md b/README.md index 22dfdb3..a4f624f 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,8 @@ docker compose pull && docker compose up -d | `JWT_SECRET` | JWT signing key | 64-char hex | | `CRON_SECRET` | Cron job auth token | 64-char hex | | `APP_URL` | App access URL | `http://192.168.1.1:8488` | -| `SUBBOOST_PORT` | Listening port (default 8488) | `8488` | +| `SUBBOOST_PORT` | App listening port (default 8488) | `8488` | +| `SUBBOOST_DB_PORT` | Database external port (default 15432) | `15432` | ## Development diff --git a/docker-compose.yml b/docker-compose.yml index 9ff6b32..f68cf27 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,6 +6,8 @@ services: POSTGRES_DB: subboost POSTGRES_USER: subboost POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} + ports: + - "${SUBBOOST_DB_PORT:-15432}:5432" volumes: - subboost-db:/var/lib/postgresql/data healthcheck: diff --git a/start.sh b/start.sh index ea0d100..80bc57e 100755 --- a/start.sh +++ b/start.sh @@ -35,6 +35,7 @@ JWT_SECRET=${JWT_SECRET} CRON_SECRET=${CRON_SECRET} APP_URL=http://localhost:8488 SUBBOOST_PORT=8488 +SUBBOOST_DB_PORT=15432 EOF echo "[subboost] 密钥已写入 ${ENV_FILE}" From c872b7f10e1621c69f62b023a858609e43f3a991 Mon Sep 17 00:00:00 2001 From: chenzai666 Date: 2026年6月19日 11:35:33 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20uninstall.sh=EF=BC=9A?= =?UTF-8?q?=E5=AE=8C=E6=95=B4=E5=8D=B8=E8=BD=BD=E8=84=9A=E6=9C=AC=EF=BC=88?= =?UTF-8?q?=E5=AE=B9=E5=99=A8/=E5=8D=B7/=E9=95=9C=E5=83=8F/=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=96=87=E4=BB=B6=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 4.6 --- uninstall.sh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 uninstall.sh diff --git a/uninstall.sh b/uninstall.sh new file mode 100755 index 0000000..db4a5e3 --- /dev/null +++ b/uninstall.sh @@ -0,0 +1,29 @@ +#!/bin/sh + +echo "[subboost] 即将完整卸载 SubBoost,包括容器、数据卷、镜像和本地数据文件。" +printf "确认继续?(y/N) " +read -r confirm +if [ "$confirm" != "y" ] && [ "$confirm" != "Y" ]; then + echo "[subboost] 已取消。" + exit 0 +fi + +# 停止并删除容器、网络、数据卷 +echo "[subboost] 停止并删除容器、网络、数据卷..." +docker compose down -v --remove-orphans 2>/dev/null || true + +# 删除镜像 +echo "[subboost] 删除本地镜像..." +docker rmi -f bats666/subboost:latest 2>/dev/null || true +docker rmi -f postgres:16-alpine 2>/dev/null || true +docker rmi -f curlimages/curl:8.11.1 2>/dev/null || true + +# 删除残留 volume(防止 compose 未能清理干净) +docker volume rm subboost_subboost-db 2>/dev/null || true + +# 删除本地密钥和配置文件 +echo "[subboost] 删除本地数据文件..." +rm -rf .data .env + +echo "[subboost] 卸载完成。如需删除项目目录,请手动执行:" +echo " cd .. && rm -rf $(pwd)" From 3008f2188df778408f107ae317da1c36dc6912a2 Mon Sep 17 00:00:00 2001 From: chenzai666 Date: 2026年6月19日 11:35:58 +0800 Subject: [PATCH 5/7] =?UTF-8?q?README=20=E8=A1=A5=E5=85=85=E5=8D=B8?= =?UTF-8?q?=E8=BD=BD=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 4.6 --- README-CN.md | 8 ++++++++ README.md | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/README-CN.md b/README-CN.md index 91849b4..2418785 100644 --- a/README-CN.md +++ b/README-CN.md @@ -60,6 +60,14 @@ docker compose up -d docker compose pull && docker compose up -d ``` +### 完整卸载 + +```bash +./uninstall.sh +``` + +会依次删除容器、数据卷、本地镜像及密钥文件,执行前有确认提示。项目目录需手动删除。 + ### 环境变量说明 | 变量 | 说明 | 示例 | diff --git a/README.md b/README.md index a4f624f..9b61503 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,14 @@ docker compose up -d docker compose pull && docker compose up -d ``` +### Uninstall + +```bash +./uninstall.sh +``` + +Removes containers, volumes, local images, and secret files in order, with a confirmation prompt before proceeding. The project directory must be deleted manually. + ### Environment Variables | Variable | Description | Example | From c885c7cf4231bdb172c4b7047ff7103a2c08db94 Mon Sep 17 00:00:00 2001 From: chenzai666 Date: 2026年6月19日 11:36:55 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E5=AF=86=E9=92=A5=E7=94=9F=E6=88=90?= =?UTF-8?q?=E4=BB=8E=20hex=2032=20=E6=94=B9=E4=B8=BA=20hex=2048=EF=BC=8C?= =?UTF-8?q?=E5=A2=9E=E5=BC=BA=E8=87=B3=20384-bit=20=E7=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 4.6 --- start.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/start.sh b/start.sh index 80bc57e..7809aa2 100755 --- a/start.sh +++ b/start.sh @@ -6,7 +6,7 @@ STATE_DIR=".data" mkdir -p "$STATE_DIR" gen_secret() { - openssl rand -hex 32 + openssl rand -hex 48 } load_or_gen() { From 4da760e9541e7e787a3f6e62c3b2b4a134500a30 Mon Sep 17 00:00:00 2001 From: chenzai666 Date: 2026年6月19日 11:50:52 +0800 Subject: [PATCH 7/7] =?UTF-8?q?start.sh=20=E8=87=AA=E5=8A=A8=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E5=85=AC=E7=BD=91=20IP=20=E5=A1=AB=E5=85=A5=20APP=5FU?= =?UTF-8?q?RL?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 4.6 --- start.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/start.sh b/start.sh index 7809aa2..4d04c0f 100755 --- a/start.sh +++ b/start.sh @@ -28,12 +28,14 @@ if [ ! -f "$ENV_FILE" ]; then JWT_SECRET=$(load_or_gen JWT_SECRET jwt_secret) CRON_SECRET=$(load_or_gen CRON_SECRET cron_secret) + PUBLIC_IP=$(curl -sf --max-time 5 ifconfig.me || curl -sf --max-time 5 ipinfo.io/ip || echo "127.0.0.1") + cat> "$ENV_FILE" <

AltStyle によって変換されたページ (->オリジナル) /