-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
133 lines (126 loc) · 3.34 KB
/
docker-compose.yml
File metadata and controls
133 lines (126 loc) · 3.34 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# ============================================
# OwlWatch 舆情监控系统 - Docker Compose
# 使用方法: docker compose up -d
# ============================================
#
# 配置说明:
# - 所有敏感配置在 ./backend/.env 中设置
# - postgres 服务通过 env_file 读取数据库密码
# - backend 服务通过 env_file 读取所有配置,仅覆盖 Docker 特定的连接地址
# ============================================
services:
# ==================== PostgreSQL 数据库 ====================
postgres:
image: postgres:16-alpine
container_name: owlwatch-postgres
restart: unless-stopped
env_file:
- ./backend/.env
environment:
TZ: Asia/Shanghai
volumes:
- postgres_data:/var/lib/postgresql/data
networks:
- owlwatch_network
healthcheck:
test: ["CMD-SHELL", "pg_isready -U owlwatch -d owlwatch"]
interval: 10s
timeout: 5s
retries: 5
# ==================== Redis 缓存 ====================
redis:
image: redis:7-alpine
container_name: owlwatch-redis
restart: unless-stopped
environment:
TZ: Asia/Shanghai
command: redis-server --appendonly yes
volumes:
- redis_data:/data
networks:
- owlwatch_network
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
# ==================== RSSHub RSS 生成服务 ====================
rsshub:
image: diygod/rsshub:latest
container_name: owlwatch-rsshub
restart: unless-stopped
environment:
NODE_ENV: production
CACHE_TYPE: redis
REDIS_URL: redis://redis:6379/1
PUPPETEER_WS_ENDPOINT: ""
REQUEST_TIMEOUT: 30000
LOG_LEVEL: warn
TZ: Asia/Shanghai
networks:
- owlwatch_network
depends_on:
redis:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:1200/"]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
# ==================== 后端 API 服务 ====================
backend:
build:
context: ./backend
dockerfile: Dockerfile
container_name: owlwatch-backend
restart: unless-stopped
env_file:
- ./backend/.env
environment:
# Docker 环境下覆盖数据库主机名(使用 postgres 服务名)
DATABASE_HOST: postgres
REDIS_URL: redis://redis:6379/0
RSSHUB_URL: http://rsshub:1200
APP_ENV: production
DEBUG: "false"
TZ: Asia/Shanghai
networks:
- owlwatch_network
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
rsshub:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
# ==================== 前端服务 ====================
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
container_name: owlwatch-frontend
restart: unless-stopped
environment:
TZ: Asia/Shanghai
ports:
- "3080:80"
networks:
- owlwatch_network
depends_on:
backend:
condition: service_healthy
networks:
owlwatch_network:
driver: bridge
volumes:
postgres_data:
driver: local
redis_data:
driver: local