-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathprobe.nix
More file actions
128 lines (127 loc) · 3.38 KB
/
probe.nix
File metadata and controls
128 lines (127 loc) · 3.38 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
{ lib, ... }:
let
inherit (lib) types mkOption;
in
{
options = {
failure_threshold = mkOption {
type = types.ints.unsigned;
default = 3;
example = 3;
description = ''
Number of times to fail before giving up on restarting the process.
'';
};
http_get = mkOption {
description = ''
URL to determine the health of the process.
'';
type = types.nullOr (types.submodule {
options = {
host = mkOption {
type = types.str;
example = "google.com";
description = ''
The host address which `process-compose` uses to probe the process.
'';
};
scheme = mkOption {
type = types.str;
default = "http";
example = "http";
description = ''
The protocol used to probe the process listening on `host`.
'';
};
path = mkOption {
type = types.str;
default = "/";
example = "/";
description = ''
The path to the healtcheck endpoint.
'';
};
port = mkOption {
type = types.port;
example = "8080";
description = ''
Which port to probe the process on.
'';
};
headers = mkOption {
type = types.nullOr (types.attrsOf types.str);
default = null;
example = { "x-foo" = "bar"; };
description = ''
Additional headers to set on an HTTP probe
'';
};
status_code = mkOption {
type = types.nullOr types.int;
default = null;
example = 200;
description = ''
Expected status code.
'';
};
};
});
default = null;
};
exec = mkOption {
type = types.nullOr (types.submodule {
options.command = mkOption {
type = types.str;
example = "ps -ef | grep -v grep | grep my-proccess";
description = ''
The command to execute in order to check the health of the process.
'';
};
options.working_dir = mkOption {
type = types.nullOr types.str;
default = null;
example = "./directory";
description = ''
Directory in which to execute the exec probe command.
'';
};
});
default = null;
description = ''
Execution settings.
'';
};
initial_delay_seconds = mkOption {
type = types.ints.unsigned;
default = 0;
example = 0;
description = ''
Wait for `initial_delay_seconds` before starting the probe/healthcheck.
'';
};
period_seconds = mkOption {
type = types.ints.unsigned;
default = 10;
example = 10;
description = ''
Check the health every `period_seconds`.
'';
};
success_threshold = mkOption {
type = types.ints.unsigned;
default = 1;
example = 1;
description = ''
Number of successful checks before marking the process `Ready`.
'';
};
timeout_seconds = mkOption {
type = types.ints.unsigned;
default = 3;
example = 3;
description = ''
How long to wait for a given probe request.
'';
};
};
}