forked from DevOps/deploy.stack
feat(camofox): 添加 camofox 反检测浏览器部署栈
- 新增 stack.yml 编排、env.cfg.example 模板、readme.md 文档 - 支持认证模式、代理配置、健康检查 - 复用旧 docker run 容器的命名卷 camofox-data
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
# Camofox 部署
|
||||
|
||||
反检测浏览器服务,Hermes browser 工具后端(Camoufox 引擎,C++ 层指纹伪装)。
|
||||
镜像 `redf0x1/camofox-browser`(`2.4.7`)预装引擎与版本元数据,零下载直跑。
|
||||
|
||||
## 快速开始
|
||||
|
||||
```bash
|
||||
cp env.cfg.example env.cfg # 按需配置(默认 disabled 认证即可用)
|
||||
docker compose -p camofox --env-file ./env.cfg -f ./stack.yml up -d
|
||||
docker compose -p camofox --env-file ./env.cfg -f ./stack.yml ps # 期望 healthy
|
||||
curl -s http://localhost:9377/health
|
||||
# {"ok":true,"running":true,"engine":"camoufox","version":"2.4.7",...}
|
||||
```
|
||||
|
||||
## 从 docker run 容器迁移(本次部署场景)
|
||||
|
||||
之前直接 `docker run` 跑过同名容器,切换到 compose:
|
||||
|
||||
```bash
|
||||
docker rm -f camofox # 删掉旧容器(卷 camofox-data 保留复用)
|
||||
docker compose -p camofox --env-file ./env.cfg -f ./stack.yml up -d
|
||||
```
|
||||
|
||||
## Hermes 接入(已配置,无需改动)
|
||||
|
||||
`~/.hermes/.env` 已有 `CAMOFOX_URL=http://localhost:9377`,browser 工具自动走 camofox。
|
||||
验证:Hermes 中调用 browser 工具 → camofox 容器日志出现 `/tabs` 请求、health 中
|
||||
`browserConnected` 变 true。
|
||||
|
||||
## 代理(可选,治境外站加载挂死 / 提升反检测)
|
||||
|
||||
编辑 `env.cfg` 取消注释并填值:
|
||||
|
||||
```cfg
|
||||
PROXY_HOST=<代理IP或域名>
|
||||
PROXY_PORT=<端口>
|
||||
PROXY_USERNAME=<可选>
|
||||
PROXY_PASSWORD=<可选>
|
||||
CAMOFOX_ALLOW_PRIVATE_NETWORK=true # 必须 true,否则服务拒绝启动
|
||||
```
|
||||
|
||||
然后重建容器:
|
||||
|
||||
```bash
|
||||
docker compose -p camofox --env-file ./env.cfg -f ./stack.yml up -d
|
||||
```
|
||||
|
||||
代理是引擎级(Camoufox context proxy),页面所有流量走代理;支持 http 与 socks5 格式。
|
||||
住宅/家宽 IP 代理能显著提高 Cloudflare 等验证码通过率(数据中心 IP 天然低信任)。
|
||||
|
||||
## 常见问题
|
||||
|
||||
| 现象 | 处理 |
|
||||
|---|---|
|
||||
| 启动即退 | 容器内 `CAMOFOX_HOST` 必须 `0.0.0.0`(默认 127.0.0.1 映射不通);AUTH disabled 时不能设 CAMOFOX_API_KEY |
|
||||
| 启用代理后拒启 | 需 `CAMOFOX_ALLOW_PRIVATE_NETWORK=true` |
|
||||
| 重型境外页 30s 超时 | 直连资源慢/挂;配代理;或换轻量目标 |
|
||||
| 端口被占用 | 修改 `stack.yml` 端口映射 + `env.cfg` 中 `CAMOFOX_PORT` 同步对齐 |
|
||||
|
||||
## 目录
|
||||
|
||||
```
|
||||
camofox/
|
||||
├── stack.yml # Docker Compose 编排
|
||||
├── env.cfg.example # 变量模板 → 复制为 env.cfg
|
||||
├── readme.md
|
||||
└── env.cfg # 真实变量(gitignore,部署时手工创建)
|
||||
```
|
||||
|
||||
数据持久化:docker managed named volume `camofox-data` 挂载到 `/home/node/.camofox`
|
||||
(profiles、引擎缓存、cookie)。复用旧 `docker run` 创建的同名卷;全新部署可改为 bind mount 到 `${Volumes_Path}`。
|
||||
Reference in New Issue
Block a user