Skip to content

Commit 351578a

Browse files
authored
feat(core): add healthz route for server health check (DIYgod#16450)
1 parent a42d44f commit 351578a

File tree

2 files changed

+28
-11
lines changed

2 files changed

+28
-11
lines changed

docker-compose.yml

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,45 @@ services:
66
image: diygod/rsshub
77
restart: always
88
ports:
9-
- '1200:1200'
9+
- "1200:1200"
1010
environment:
1111
NODE_ENV: production
1212
CACHE_TYPE: redis
13-
REDIS_URL: 'redis://redis:6379/'
14-
PUPPETEER_WS_ENDPOINT: 'ws://browserless:3000' # marked
13+
REDIS_URL: "redis://redis:6379/"
14+
PUPPETEER_WS_ENDPOINT: "ws://browserless:3000" # marked
15+
healthcheck:
16+
test: ["CMD", "curl", "-f", "http://localhost:1200/healthz"]
17+
interval: 30s
18+
timeout: 10s
19+
retries: 3
1520
depends_on:
1621
- redis
17-
- browserless # marked
22+
- browserless # marked
1823

19-
browserless: # marked
20-
image: browserless/chrome # marked
21-
restart: always # marked
22-
ulimits: # marked
23-
core: # marked
24-
hard: 0 # marked
25-
soft: 0 # marked
24+
browserless: # marked
25+
image: browserless/chrome # marked
26+
restart: always # marked
27+
ulimits: # marked
28+
core: # marked
29+
hard: 0 # marked
30+
soft: 0 # marked
31+
healthcheck:
32+
test: ["CMD", "curl", "-f", "http://localhost:3000/pressure"]
33+
interval: 30s
34+
timeout: 10s
35+
retries: 3
2636

2737
redis:
2838
image: redis:alpine
2939
restart: always
3040
volumes:
3141
- redis-data:/data
42+
healthcheck:
43+
test: ["CMD", "redis-cli", "ping"]
44+
interval: 30s
45+
timeout: 10s
46+
retries: 5
47+
start_period: 5s
3248

3349
volumes:
3450
redis-data:

lib/registry.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ for (const namespace in namespaces) {
100100
}
101101

102102
app.get('/', index);
103+
app.get('/healthz', (ctx) => ctx.text('ok'));
103104
app.get('/robots.txt', robotstxt);
104105
if (config.debugInfo) {
105106
// Only enable tracing in debug mode

0 commit comments

Comments
 (0)