This commit is contained in:
Hossein 2025-11-30 18:33:39 +03:30
parent aedb21ad75
commit 41fe8c2f3d
2 changed files with 153 additions and 9 deletions

View File

@ -1,6 +1,23 @@
version: '3.8' version: "3.8"
services: 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: aifit-fastapi:
build: build:
context: . context: .
@ -8,21 +25,32 @@ services:
container_name: aifit-fastapi container_name: aifit-fastapi
ports: ports:
- "8000:8000" - "8000:8000"
# For local dev hot-reload; remove in production if you want
volumes: volumes:
- .:/app # hot-reload for dev; remove in prod - .:/app
env_file: env_file:
- .env # must contain GEMINI_API_KEY=... - .env # should contain GEMINI_API_KEY, AIFIT_AUTH_KEY, AIFIT_PROXY_URL (optional)
environment: environment:
- PYTHONPATH=/app PYTHONPATH: /app
- FFMPEG_BIN=/usr/bin/ffmpeg FFMPEG_BIN: /usr/bin/ffmpeg
- FFPROBE_BIN=/usr/bin/ffprobe 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} # 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 restart: unless-stopped
healthcheck: healthcheck:
test: ["CMD", "curl", "-fsS", "http://localhost:8000/health"] test: ["CMD", "curl", "-fsS", "http://localhost:8000/health"]
interval: 30s interval: 30s
timeout: 10s timeout: 10s
retries: 3 retries: 3
start_period: 40s start_period: 40s

116
xray-config.json Normal file
View File

@ -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"]
}
]
}
}