From 232517b58f51c4bb03d00a3f78baf46482ff50a7 Mon Sep 17 00:00:00 2001 From: Sun-ZhenXing <1006925066@qq.com> Date: Wed, 24 Sep 2025 09:28:28 +0800 Subject: [PATCH] feat: add frps/frpc/mineru-sgalng --- README.md | 10 +-- README.zh.md | 10 +-- src/frpc/README.md | 32 ++++++++++ src/frpc/docker-compose.yaml | 30 +++++++++ src/frpc/frpc.toml | 10 +++ src/frps/README.zh.md | 35 +++++++++++ src/frps/docker-compose.yaml | 35 +++++++++++ src/frps/frps.toml | 8 +++ src/mineru-sgalng/README.md | 26 ++++++++ src/mineru-sgalng/docker-compose.yaml | 90 +++++++++++++++++++++++++++ src/mineru-v2/docker-compose.yaml | 2 +- 11 files changed, 279 insertions(+), 9 deletions(-) create mode 100644 src/frpc/README.md create mode 100644 src/frpc/docker-compose.yaml create mode 100644 src/frpc/frpc.toml create mode 100644 src/frps/README.zh.md create mode 100644 src/frps/docker-compose.yaml create mode 100644 src/frps/frps.toml create mode 100644 src/mineru-sgalng/README.md create mode 100644 src/mineru-sgalng/docker-compose.yaml diff --git a/README.md b/README.md index e897043..5fbf906 100644 --- a/README.md +++ b/README.md @@ -4,10 +4,12 @@ Compose Anything helps users quickly deploy various services by providing a set ## Supported Services -| Service | Version | -| ---------------------------- | ------- | -| [Redis](./src/redis) | 8.2.1 | -| [MinerU v2](./src/mineru-v2) | 2.5.3 | +| Service | Version | +| ---------------------------------------- | ------- | +| [Redis](./src/redis) | 8.2.1 | +| [MinerU v2](./src/mineru-v2) | 2.5.3 | +| [Bifrost Gateway](./src/bifrost-gateway) | 1.2.15 | +| [Docker Registry](./src/docker-registry) | 3.0.0 | ## Guidelines diff --git a/README.zh.md b/README.zh.md index 246d5f2..d9e460a 100644 --- a/README.zh.md +++ b/README.zh.md @@ -4,10 +4,12 @@ Compose Anything 通过提供一组高质量的 Docker Compose 配置文件, ## 已经支持的服务 -| 服务 | 版本 | -| ---------------------------- | ----- | -| [Redis](./src/redis) | 8.2.1 | -| [MinerU v2](./src/mineru-v2) | 2.5.3 | +| 服务 | 版本 | +| ---------------------------------------- | ------ | +| [Redis](./src/redis) | 8.2.1 | +| [MinerU v2](./src/mineru-v2) | 2.5.3 | +| [Bifrost Gateway](./src/bifrost-gateway) | 1.2.15 | +| [Docker Registry](./src/docker-registry) | 3.0.0 | ## 规范 diff --git a/src/frpc/README.md b/src/frpc/README.md new file mode 100644 index 0000000..4ca9338 --- /dev/null +++ b/src/frpc/README.md @@ -0,0 +1,32 @@ +# FRPC + +内网穿透客户端。 + +以 SSH 服务穿透为例,新建 `frpc.toml` 配置文件,内容如下: + +```toml +[common] +server_addr = {{ .Envs.FRP_SERVER_ADDR }} +server_port = {{ .Envs.FRP_SERVER_PORT }} +token = {{ .Envs.FRP_SERVER_TOKEN }} + +[app_22] +type = "tcp" +remote_port = 23922 +local_ip = 192.168.10.100 +local_port = 22 +``` + +配置远程 FRPS 服务地址到 `.env` 文件中: + +```properties +FRP_SERVER_ADDR=frps.example.com +FRP_SERVER_PORT=9870 +FRP_SERVER_TOKEN=password +``` + +启动服务,即可代理 `192.168.10.100:22` 到 `FRP_SERVER_ADDR:23922`。 + +```bash +docker compose up -d +``` diff --git a/src/frpc/docker-compose.yaml b/src/frpc/docker-compose.yaml new file mode 100644 index 0000000..2fbf822 --- /dev/null +++ b/src/frpc/docker-compose.yaml @@ -0,0 +1,30 @@ +x-default: &default + restart: unless-stopped + volumes: + - &localtime /etc/localtime:/etc/localtime:ro + - &timezone /etc/timezone:/etc/timezone:ro + logging: + driver: json-file + options: + max-size: 100m + +services: + frpc: + <<: *default + image: snowdreamtech/frpc:${FRPC_VERSION:-0.64.0} + volumes: + - *localtime + - *timezone + - ./frpc.toml:/etc/frp/frpc.toml:ro + environment: + FRP_SERVER_ADDR: ${FRP_SERVER_ADDR} + FRP_SERVER_PORT: ${FRP_SERVER_PORT} + FRP_SERVER_TOKEN: ${FRP_SERVER_TOKEN} + deploy: + resources: + limits: + cpus: '0.5' + memory: 128M + reservations: + cpus: '0.1' + memory: 64M diff --git a/src/frpc/frpc.toml b/src/frpc/frpc.toml new file mode 100644 index 0000000..dc09b39 --- /dev/null +++ b/src/frpc/frpc.toml @@ -0,0 +1,10 @@ +[common] +server_addr = {{ .Envs.FRP_SERVER_ADDR }} +server_port = {{ .Envs.FRP_SERVER_PORT }} +token = {{ .Envs.FRP_SERVER_TOKEN }} + +[app] +type = "tcp" +remote_port = 22 +local_ip = {{ .Envs.APP_HOST }} +local_port = 22 diff --git a/src/frps/README.zh.md b/src/frps/README.zh.md new file mode 100644 index 0000000..b8b637a --- /dev/null +++ b/src/frps/README.zh.md @@ -0,0 +1,35 @@ +# FRPS + +内网穿透服务端。 + +新建 `frps.toml` 配置文件,内容如下: + +```toml +[common] +bind_port = {{ .Envs.FRP_SERVER_PORT }} +token = {{ .Envs.FRP_SERVER_TOKEN }} + +dashboard_addr = 0.0.0.0 +dashboard_port = {{ .Envs.FRP_ADMIN_PORT }} +dashboard_user = {{ .Envs.FRP_ADMIN_USER }} +dashboard_pwd = {{ .Envs.FRP_ADMIN_PASS }} +``` + +配置密钥等信息到 `.env` 文件中: + +```properties +FRP_SERVER_TOKEN=token +FRP_ADMIN_USER=admin +FRP_ADMIN_PASS=password +``` + +启动服务,即可代理客户端请求,注意需要将客户端的端口映射出来。可以通过 HOST 网络或共享网络的方式共享服务。 + +使用如下方法启用 HOST 模式: + +```yaml +services: + frps: + # ... + network_mode: host +``` diff --git a/src/frps/docker-compose.yaml b/src/frps/docker-compose.yaml new file mode 100644 index 0000000..a799368 --- /dev/null +++ b/src/frps/docker-compose.yaml @@ -0,0 +1,35 @@ +x-default: &default + restart: unless-stopped + volumes: + - &localtime /etc/localtime:/etc/localtime:ro + - &timezone /etc/timezone:/etc/timezone:ro + logging: + driver: json-file + options: + max-size: 100m + +services: + frps: + <<: *default + image: snowdreamtech/frps:${FRPS_VERSION:-0.64.0} + volumes: + - *localtime + - *timezone + - ./frps.toml:/etc/frp/frps.toml:ro + ports: + - ${FRP_PORT_OVERRIDE_SERVER:-9870}:${FRP_SERVER_PORT:-9870} + - ${FRP_PORT_OVERRIDE_ADMIN:-7890}:${FRP_ADMIN_PORT:-7890} + environment: + FRP_SERVER_TOKEN: ${FRP_SERVER_TOKEN} + FRP_SERVER_PORT: ${FRP_SERVER_PORT:-9870} + FRP_ADMIN_PORT: ${FRP_ADMIN_PORT:-7890} + FRP_ADMIN_USER: ${FRP_ADMIN_USER:-admin} + FRP_ADMIN_PASS: ${FRP_ADMIN_PASS:-password} + deploy: + resources: + limits: + cpus: '0.5' + memory: 128M + reservations: + cpus: '0.1' + memory: 64M diff --git a/src/frps/frps.toml b/src/frps/frps.toml new file mode 100644 index 0000000..0b5e839 --- /dev/null +++ b/src/frps/frps.toml @@ -0,0 +1,8 @@ +[common] +bind_port = {{ .Envs.FRP_SERVER_PORT }} +token = {{ .Envs.FRP_SERVER_TOKEN }} + +dashboard_addr = 0.0.0.0 +dashboard_port = {{ .Envs.FRP_ADMIN_PORT }} +dashboard_user = {{ .Envs.FRP_ADMIN_USER }} +dashboard_pwd = {{ .Envs.FRP_ADMIN_PASS }} diff --git a/src/mineru-sgalng/README.md b/src/mineru-sgalng/README.md new file mode 100644 index 0000000..2af8bd0 --- /dev/null +++ b/src/mineru-sgalng/README.md @@ -0,0 +1,26 @@ +# MinerU SGLang + +SGLang backend server: + +```bash +docker compose --profile sglang-server up -d +``` + +Document parse API: + +```bash +docker compose --profile api up -d +``` + +Gradio WebUI: + +```bash +docker compose --profile gradio up -d +``` + +Test SGLang backend: + +```bash +pip install mineru +mineru -p demo.pdf -o ./output -b vlm-sglang-client -u http://localhost:30000 +``` diff --git a/src/mineru-sgalng/docker-compose.yaml b/src/mineru-sgalng/docker-compose.yaml new file mode 100644 index 0000000..8b99d50 --- /dev/null +++ b/src/mineru-sgalng/docker-compose.yaml @@ -0,0 +1,90 @@ +x-default: &default + restart: unless-stopped + volumes: + - &localtime /etc/localtime:/etc/localtime:ro + - &timezone /etc/timezone:/etc/timezone:ro + logging: + driver: json-file + options: + max-size: 100m + +x-mineru-sglang: &mineru-sglang + <<: *default + image: ${MINERU_DOCKER_IMAGE:-alexsuntop/mineru-sglang:2.2.2} + environment: + MINERU_MODEL_SOURCE: local + ulimits: + memlock: -1 + stack: 67108864 + ipc: host + deploy: + resources: + limits: + cpus: '8.0' + memory: 4G + reservations: + cpus: '1.0' + memory: 2G + devices: + - driver: nvidia + device_ids: [ '0' ] + capabilities: [ gpu ] + +services: + mineru-sglang-server: + <<: *mineru-sglang + profiles: ["sglang-server"] + ports: + - ${MINERU_PORT_OVERRIDE_SGLANG:-30000}:30000 + entrypoint: mineru-sglang-server + command: + - --host 0.0.0.0 + - --port 30000 + + # If using multiple GPUs, increase throughput using vllm's multi-GPU parallel mode. + # - --data-parallel-size 2 + # If running on a single GPU and encountering VRAM shortage, reduce the KV cache size by this parameter, + # if VRAM issues persist, try lowering it further to `0.4` or below. + # - --gpu-memory-utilization 0.5 + + healthcheck: + test: ["CMD-SHELL", "curl -f http://localhost:30000/health || exit 1"] + + mineru-api: + <<: *mineru-sglang + profiles: ["api"] + ports: + - ${MINERU_PORT_OVERRIDE_API:-8000}:8000 + entrypoint: mineru-api + command: + - --host 0.0.0.0 + - --port 8000 + + # If using multiple GPUs, increase throughput using vllm's multi-GPU parallel mode. + # - --data-parallel-size 2 + # If running on a single GPU and encountering VRAM shortage, reduce the KV cache size by this parameter, + # if VRAM issues persist, try lowering it further to `0.4` or below. + # - --gpu-memory-utilization 0.5 + + mineru-gradio: + <<: *mineru-sglang + profiles: ["gradio"] + ports: + - ${MINERU_PORT_OVERRIDE_GRADIO:-7860}:7860 + entrypoint: mineru-gradio + command: + - --server-name 0.0.0.0 + - --server-port 7860 + + # Enable the vllm engine for Gradio + - --enable-vllm-engine true + # If you want to disable the API, set this to false + # - --enable-api false + # If you want to limit the number of pages for conversion, set this to a specific number + # - --max-convert-pages 20 + + # If using multiple GPUs, increase throughput using vllm's multi-GPU parallel mode. + # - --data-parallel-size 2 + # If running on a single GPU and encountering VRAM shortage, reduce the KV cache size by this parameter, + # if VRAM issues persist, try lowering it further to `0.4` or below. + # - --gpu-memory-utilization 0.5 diff --git a/src/mineru-v2/docker-compose.yaml b/src/mineru-v2/docker-compose.yaml index 0e04ca1..dcd0286 100644 --- a/src/mineru-v2/docker-compose.yaml +++ b/src/mineru-v2/docker-compose.yaml @@ -23,7 +23,7 @@ x-mineru-vllm: &mineru-vllm cpus: '8.0' memory: 4G reservations: - cpus: '2.0' + cpus: '1.0' memory: 2G devices: - driver: nvidia