-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
68 lines (63 loc) · 2.33 KB
/
docker-compose.yml
File metadata and controls
68 lines (63 loc) · 2.33 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
# ThingsVis Docker Compose
# 用法: docker-compose up -d
#
# 需要先复制环境变量文件:
# cp apps/server/.env.example .env
# 并编辑 .env 填写 AUTH_SECRET 等必要配置
services:
# ─── Database (PostgreSQL) ─────────────────────
postgres:
image: postgres:16-alpine
container_name: thingsvis-postgres
restart: unless-stopped
environment:
POSTGRES_USER: ${POSTGRES_USER:-thingsvis}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-thingsvis_password}
POSTGRES_DB: ${POSTGRES_DB:-thingsvis_db}
ports:
- "5432:5432"
volumes:
- pgdata:/var/lib/postgresql/data
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-thingsvis} -d ${POSTGRES_DB:-thingsvis_db}" ]
interval: 10s
timeout: 5s
retries: 5
# ─── API Server (Next.js) ─────────────────────────
server:
image: ghcr.io/thingspanel/thingsvis-server:latest
container_name: thingsvis-server
restart: unless-stopped
ports:
- "${SERVER_PORT:-8000}:${SERVER_PORT:-8000}"
env_file:
- .env
environment:
- NODE_ENV=production
- HOSTNAME=0.0.0.0
- AUTH_TRUST_HOST=true
- DATABASE_URL=postgresql://${POSTGRES_USER:-thingsvis}:${POSTGRES_PASSWORD:-thingsvis_password}@postgres:5432/${POSTGRES_DB:-thingsvis_db}?schema=public
depends_on:
postgres:
condition: service_healthy
healthcheck:
test: [ "CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:${SERVER_PORT:-8000}/api/health" ]
interval: 30s
timeout: 5s
retries: 3
start_period: 15s
# ─── Studio (编辑器 SPA + Nginx) ───────────────────
studio:
image: ghcr.io/thingspanel/thingsvis-studio:latest
container_name: thingsvis-studio
restart: unless-stopped
ports:
- "${STUDIO_PORT:-3000}:${STUDIO_PORT:-3000}"
depends_on:
server:
condition: service_healthy
volumes:
pgdata:
# ─── 访问地址 ─────────────────────────────────────────
# Studio (编辑器): http://localhost:${STUDIO_PORT:-3000}
# Server (API): http://localhost:${SERVER_PORT:-8000}