-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcompose.yml
More file actions
118 lines (114 loc) · 3.45 KB
/
compose.yml
File metadata and controls
118 lines (114 loc) · 3.45 KB
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
services:
tgdb:
image: postgres:16
container_name: tgdb
labels:
- "ns.module=telegram"
- "ns.component=db"
- "ns.db_owner=telegram"
environment:
POSTGRES_USER: ${DB_USER:-telegram}
POSTGRES_PASSWORD: ${DB_PASSWORD:-telegram}
POSTGRES_DB: ${DB_NAME:-telegram}
volumes:
- ./data/postgres:/var/lib/postgresql/data
- ./db/init:/docker-entrypoint-initdb.d:ro
ports:
- "127.0.0.1:${PORT_DB_TG:-${DB_PORT:-5436}}:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-telegram}"]
interval: 5s
timeout: 3s
retries: 5
tgapi:
build:
context: .
dockerfile: api/Dockerfile
container_name: tgapi
labels:
- "ns.module=telegram"
- "ns.component=api"
env_file: .env
depends_on:
tgdb:
condition: service_healthy
environment:
DB_HOST: tgdb
DB_PORT: 5432
DB_DSN: postgresql://${DB_USER:-telegram}:${DB_PASSWORD:-telegram}@tgdb:5432/${DB_NAME:-telegram}
WEBUI_ENABLED: ${WEBUI_ENABLED:-false}
WEBUI_PUBLIC_URL: ${WEBUI_PUBLIC_URL:-}
ports:
- "127.0.0.1:${PORT_HTTP_TGAPI:-${API_PORT:-8081}}:8000"
volumes:
- ./templates:/app/templates:ro
- ./data:/app/data
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')"]
interval: 10s
timeout: 5s
retries: 3
start_period: 10s
tgmcp:
build:
context: .
dockerfile: mcp/Dockerfile
container_name: tgmcp
labels:
- "ns.module=telegram"
- "ns.component=mcp"
env_file: .env
depends_on:
tgapi:
condition: service_healthy
environment:
TELEGRAM_API_BASE: http://tgapi:8000
TELEGRAM_API_URL: http://tgapi:8000
TGWEB_URL: https://tgweb:8000
NODE_TLS_REJECT_UNAUTHORIZED: "0"
ports:
- "127.0.0.1:${PORT_MCP_TG:-${MCP_HTTP_PORT:-3335}}:3335"
healthcheck:
test: ["CMD", "node", "-e", "fetch('http://localhost:3335/health').then(r=>{if(!r.ok)process.exit(1)}).catch(()=>process.exit(1))"]
interval: 10s
timeout: 5s
retries: 3
start_period: 10s
tgweb:
build:
context: .
dockerfile: web-ui/Dockerfile
container_name: tgweb
labels:
- "ns.module=telegram"
- "ns.component=web-ui"
env_file: .env
depends_on:
tgapi:
condition: service_healthy
tgdb:
condition: service_healthy
environment:
DB_DSN: postgresql://${DB_USER:-telegram}:${DB_PASSWORD:-telegram}@tgdb:5432/${DB_NAME:-telegram}
TGAPI_URL: http://tgapi:8000
LLM_CORE_URL: ${LLM_CORE_URL:-http://llmcore:8080}
PUBLIC_URL: ${WEBUI_PUBLIC_URL:-https://tg.example.com:8443}
BOT_TOKEN: ${TELEGRAM_BOT_TOKEN}
networks:
- default
- llm
volumes:
- ${HOME}/.certbot/flat:/certs:ro
command: ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000", "--ssl-certfile", "/certs/fullchain.pem", "--ssl-keyfile", "/certs/privkey.pem"]
ports:
- "${PORT_WEBUI:-8443}:8000"
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request, ssl; ctx=ssl.create_default_context(); ctx.check_hostname=False; ctx.verify_mode=ssl.CERT_NONE; urllib.request.urlopen('https://localhost:8000/health', context=ctx)"]
interval: 10s
timeout: 5s
retries: 3
start_period: 5s
networks:
llm:
external: true
name: llm-mcp_default