From 41fe8c2f3d75193153ac2ae4280a1b7f34c24a07 Mon Sep 17 00:00:00 2001 From: Hossein Date: Sun, 30 Nov 2025 18:33:39 +0330 Subject: [PATCH] update --- docker-compose.yml | 46 ++++++++++++++---- xray-config.json | 116 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 153 insertions(+), 9 deletions(-) create mode 100644 xray-config.json diff --git a/docker-compose.yml b/docker-compose.yml index ce78c2a..c9330a0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,23 @@ -version: '3.8' +version: "3.8" services: + # ------------------------- + # XRAY / V2RAY PROXY + # ------------------------- + xray: + image: ghcr.io/xtls/xray-core:latest + container_name: xray + volumes: + # Your JSON config with "listen": "0.0.0.0" on the inbound + - ./xray-config.json:/etc/xray/config.json:ro + command: ["xray", "-config=/etc/xray/config.json"] + ports: + - "10808:10808" # optional: expose to host for debugging + restart: unless-stopped + + # ------------------------- + # AIFIT FASTAPI SERVICE + # ------------------------- aifit-fastapi: build: context: . @@ -8,21 +25,32 @@ services: container_name: aifit-fastapi ports: - "8000:8000" + # For local dev hot-reload; remove in production if you want volumes: - - .:/app # hot-reload for dev; remove in prod + - .:/app env_file: - - .env # must contain GEMINI_API_KEY=... + - .env # should contain GEMINI_API_KEY, AIFIT_AUTH_KEY, AIFIT_PROXY_URL (optional) environment: - - PYTHONPATH=/app - - FFMPEG_BIN=/usr/bin/ffmpeg - - FFPROBE_BIN=/usr/bin/ffprobe - # Explicitly pass GEMINI_API_KEY from .env (fallback if env_file doesn't work) - - GEMINI_API_KEY=${GEMINI_API_KEY} + PYTHONPATH: /app + FFMPEG_BIN: /usr/bin/ffmpeg + FFPROBE_BIN: /usr/bin/ffprobe + + # Explicitly pass sensitive vars from .env (so they are available even if env_file is ignored) + GEMINI_API_KEY: ${GEMINI_API_KEY} + AIFIT_AUTH_KEY: ${AIFIT_AUTH_KEY} + + # Proxy URL for Gemini client. + # In .env you can set: AIFIT_PROXY_URL=socks5://xray:10808 + # The default here is also socks5://xray:10808 if env is missing. + AIFIT_PROXY_URL: ${AIFIT_PROXY_URL:-socks5://xray:10808} + + depends_on: + - xray restart: unless-stopped + healthcheck: test: ["CMD", "curl", "-fsS", "http://localhost:8000/health"] interval: 30s timeout: 10s retries: 3 start_period: 40s - diff --git a/xray-config.json b/xray-config.json new file mode 100644 index 0000000..43c5a24 --- /dev/null +++ b/xray-config.json @@ -0,0 +1,116 @@ +{ + "log": { + "loglevel": "warning" + }, + + "dns": { + "servers": [ + "1.1.1.1", + "8.8.8.8", + "https://dns.google/dns-query" + ] + }, + + "inbounds": [ + { + "tag": "socks", + "port": 10808, + "listen": "0.0.0.0", + "protocol": "socks", + "sniffing": { + "enabled": true, + "destOverride": ["http", "tls"] + }, + "settings": { + "auth": "noauth", + "udp": true + } + } + ], + + "outbounds": [ + { + "tag": "proxy", + "protocol": "vmess", + "settings": { + "vnext": [ + { + "address": "s2.sooxy.xyz", + "port": 8083, + "users": [ + { + "id": "6c7db735-1e03-49f5-af1b-07f02ad30eb3", + "alterId": 0, + "email": "t@t.tt", + "security": "auto" + } + ] + } + ] + }, + "streamSettings": { + "network": "tcp", + "tcpSettings": { + "header": { + "type": "http", + "request": { + "version": "1.1", + "method": "GET", + "path": ["/"], + "headers": { + "Host": ["google.com"], + "User-Agent": [], + "Accept-Encoding": ["gzip, deflate"], + "Connection": ["keep-alive"], + "Pragma": "no-cache" + } + } + } + } + }, + "mux": { + "enabled": false + } + }, + + { + "tag": "direct", + "protocol": "freedom" + }, + + { + "tag": "block", + "protocol": "blackhole" + } + ], + + "routing": { + "domainStrategy": "AsIs", + "rules": [ + { + "type": "field", + "outboundTag": "proxy", + "domain": [ + "domain:googleapis.cn", + "domain:gstatic.com", + "geosite:geolocation-!cn" + ] + }, + { + "type": "field", + "outboundTag": "block", + "domain": ["geosite:category-ads-all"] + }, + { + "type": "field", + "outboundTag": "direct", + "ip": ["geoip:private"] + }, + { + "type": "field", + "outboundTag": "direct", + "domain": ["geosite:cn"] + } + ] + } +}