-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdocker-compose.yml
102 lines (102 loc) · 3.71 KB
/
docker-compose.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
services:
proxyxai-xai:
container_name: proxyxai-xai
image: proxyxai/xai
pull_policy: always
restart: always
depends_on:
proxyxai-redis:
condition: service_started
proxyxai-postgres:
condition: service_healthy
ports:
- 3443:3443
environment:
- SINGLE_MODE=true
- TZ=Asia/Shanghai
- PORT=3443
- POSTGRES_DSN=user=postgres password=pass host=proxyxai-postgres dbname=postgres port=5432 sslmode=disable TimeZone=Asia/Shanghai
- REDIS_ADDR=proxyxai-redis:6379
- REDIS_PASS=
# 100 requests per account, data saved to Redis, 100*10 requests per account, data saved to PostgreSQL
# 100次请求/账号,数据落盘Redis,100*10次请求/账号,数据落盘PostgreSQL
- STATS_INTERVAL=100
# Mandatory setting: Initial root user; format: root:email:key; note that the key must be 51 characters long, starting with sk-Xvs, and the initial username must be root
# 必选设置 初始root用户;格式 root:邮箱:管理Key;请注意管理Key为51个字符,每组内以单冒号为分割符,组外以逗号为分割符, Key 前缀必须是 sk-Xvs, 初始用户名必须是 root
- INIT_USERS=root:[email protected]:sk-Xvs9LNx8ImuIn0chuNDdi5wTs5WaoEWNcd87Z62etZZ1bz7z
# Optional setting: Enter OpenAI API Keys or AnthropicAI API Keys upon startup (can also be entered after startup via the management API), format: sk-xxx::https://api.openai.com,sk-ant-xxx::https://api.anthropic.com
# 可选设置 启动即刻录入OpenAI API Keys 或者 AnthropicAI API Keys(也可以启动后,通过管理 API 操作录入),格式 sk-xxx::https://api.openai.com,sk-ant-xxx::https://api.anthropic.com, 每组内以双冒号为分割符,组外以逗号为分割符
- INIT_KEYS=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::https://api.openai.com,sk-ant-api93-7ZHL4aOCJSGuiSPQ0a1Fj7I3RHZkXE_9DD_WS7AgnJ7rW4z6uTAUyI3jCX5oXmK68h3ik7UHcWl5768KH1O_ui-_HlrOuAa::https://api.anthropic.com
# Optional setting: Model mapping, redirect requests from model X to model Y
# 可选设置 模型映射,将请求的模型X转发请求为模型Y
- MODEL_MAPPER=gpt-3.5*=gpt-4o-mini,gpt-4-*-preview=gpt-4-turbo
networks:
- network
proxyxai-postgres:
container_name: proxyxai-postgres
image: postgres:17
pull_policy: always
restart: always
user: postgres
environment:
TZ: "Asia/Shanghai"
PGTZ: "Asia/Shanghai"
POSTGRES_USER: "postgres"
POSTGRES_PASSWORD: "pass"
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test:
[
"CMD-SHELL",
"pg_isready",
"-q",
"-d",
"postgres",
"-U",
"postgres"
]
interval: 10s
timeout: 5s
retries: 3
networks:
- network
proxyxai-redis:
container_name: proxyxai-redis
image: redis:alpine
pull_policy: always
restart: always
volumes:
- redis_data:/data
environment:
- TZ=Asia/Shanghai
networks:
- network
proxyxai-backup:
container_name: proxyxai-backup
image: postgres:17
pull_policy: always
restart: always
environment:
- TZ=Asia/Shanghai
- PGPASSWORD=pass
volumes:
- ./backups:/backups
depends_on:
proxyxai-postgres:
condition: service_healthy
networks:
- network
entrypoint: |
bash -c '
while true; do
pg_dump -h proxyxai-postgres -U postgres postgres | gzip > /backups/$$(date +%F).sql.gz
find /backups -name "*.sql.gz" -mtime +3 -delete
sleep 86400
done'
volumes:
redis_data:
postgres_data:
networks:
network:
driver: bridge