-
Notifications
You must be signed in to change notification settings - Fork 134
/
Copy pathstopping.json5
45 lines (45 loc) · 1.24 KB
/
stopping.json5
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
/*
This example shows how a user might configure a job to have a preStop
and postStop behavior
*/
{
consul: "consul:8500",
jobs: [
{
name: "app",
exec: "/bin/app",
restarts: "never",
port: 80,
health: {
exec: "/usr/bin/curl --fail -s -o /dev/null http://localhost/app",
interval: 5,
tll: 10,
}
},
{
name: "preStop",
when: {
// this job will start once 'app' has received a signal to
// shut down but before its deregistered. there's no way to
// guarantee that the job will complete before 'app' is killed
// so this kind of event should be short-lived.
source: "app",
once: "stopping"
},
exec: "/usr/local/bin/preStop-script.sh",
restart: "never",
},
{
name: "postStop",
when: {
// this job will start once 'app' has exited and been deregistered,
// which will happen if job stops without restarting. If 'app'
// has the configuration 'restarts: "unlimited"' then this event
// will only be received when we SIGHUP or shut down ContainerPilot.
source: "app",
once: "stopped"
},
exec: "/usr/local/bin/postStop-script.sh",
}
]
}