Skip to content

Commit 71ff0ed

Browse files
committed
implement 11.12 Health check
1 parent 9aabcc2 commit 71ff0ed

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

app.js

+6
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ app.get('/version', (req, res) => {
88
res.send('2')
99
})
1010

11+
app.get('/health', (req, res) => {
12+
// eslint-disable-next-line no-constant-condition
13+
if (true) throw('error... ')
14+
res.send('ok')
15+
})
16+
1117
app.use(express.static('dist'))
1218

1319
app.listen(PORT, () => {

fly.toml

+10
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,16 @@ primary_region = 'ams'
2222
min_machines_running = 0
2323
processes = ['app']
2424

25+
[[http_service.checks]]
26+
grace_period = "10s"
27+
interval = "30s"
28+
method = "GET"
29+
timeout = "5s"
30+
path = "/health"
31+
32+
[deploy]
33+
strategy = "canary"
34+
2535
[[vm]]
2636
memory = '1gb'
2737
cpu_kind = 'shared'

0 commit comments

Comments
 (0)