sub2api/deploy/docker-compose.tls-proxy.yml
win f5abc62fd3
Some checks failed
CI / test (push) Failing after 12s
CI / golangci-lint (push) Failing after 6s
Security Scan / backend-security (push) Failing after 5s
Security Scan / frontend-security (push) Failing after 5s
fix: 三节点部署脚本修复 + sub2api 容器代理透传
- GOST 下载 URL 修复:补全版本号 (gost_3.2.6_linux_amd64.tar.gz)
- CN 中转机服务名改为 gost-sub2api-relay,避免与现有 gost-relay 冲突
- CN 中转机监听协议改为 http(兼容 node-tls-proxy 的 HTTP CONNECT)
- 美国落地机服务名改为 gost-sub2api-exit
- sub2api 容器透传 HTTPS_PROXY/HTTP_PROXY 环境变量(解决 OAuth 超时)
- ops_cleanup 日志字段名避免触发 ERROR 误判
- 添加密码重置脚本和 SOCKS5 服务文件
2026-03-26 12:09:05 +08:00

77 lines
2.7 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# =============================================================================
# Node.js TLS Proxy Overlay
# =============================================================================
# 用法:
# docker compose -f docker-compose.yml -f docker-compose.tls-proxy.yml up -d
#
# 架构:
# Anthropic: sub2api → node-tls-proxy (Node.js TLS) → api.anthropic.com
# =============================================================================
services:
# ===========================================================================
# 覆盖 sub2api加入 internal 网络 + 启用 Node.js TLS 代理
# ===========================================================================
sub2api:
networks:
- sub2api-internal
- sub2api-network # 保留:访问 postgres/redis
environment:
# Node.js TLS 代理Anthropic
- GATEWAY_NODE_TLS_PROXY_ENABLED=true
- GATEWAY_NODE_TLS_PROXY_LISTEN_PORT=3456
- GATEWAY_NODE_TLS_PROXY_LISTEN_HOST=node-tls-proxy
- GATEWAY_NODE_TLS_PROXY_UPSTREAM_HOST=api.anthropic.com
# 全局代理OAuth/GitHub 等外部请求走 GOST 中转
- HTTPS_PROXY=${HTTPS_PROXY:-}
- HTTP_PROXY=${HTTP_PROXY:-}
- NO_PROXY=localhost,127.0.0.1,node-tls-proxy,postgres,redis
depends_on:
node-tls-proxy:
condition: service_healthy
# ===========================================================================
# Node.js TLS Forward Proxy (Anthropic)
# ===========================================================================
node-tls-proxy:
image: zfc931912343/sub2api-tls-proxy:latest
container_name: sub2api-node-tls-proxy
restart: unless-stopped
user: "1000:1000"
read_only: true
tmpfs:
- /tmp:size=10M
environment:
- PROXY_PORT=3456
- PROXY_HOST=0.0.0.0
- UPSTREAM_HOST=api.anthropic.com
- UPSTREAM_PROXY=${TLS_PROXY_UPSTREAM_PROXY:-}
- TZ=${TZ:-Asia/Shanghai}
networks:
- sub2api-internal
- sub2api-external
sysctls:
- net.ipv6.conf.all.disable_ipv6=1
- net.ipv6.conf.default.disable_ipv6=1
healthcheck:
test: ["CMD", "node", "-e", "const h=require('http');h.get('http://127.0.0.1:3456/__health',r=>{process.exit(r.statusCode===200?0:1)}).on('error',()=>process.exit(1))"]
interval: 15s
timeout: 5s
retries: 3
start_period: 5s
deploy:
resources:
limits:
memory: 256M
cpus: "1.0"
# =============================================================================
# Networks
# =============================================================================
networks:
sub2api-internal:
internal: true
driver: bridge
sub2api-external:
driver: bridge