/
schema.pan
283 lines (253 loc) · 6.97 KB
/
schema.pan
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
declaration template metaconfig/haproxy/schema;
include 'pan/types';
@documentation {
list of syslog facilities
}
type haproxy_service_global_logs = {
'{/dev/log}' ? string[] = list('local0' , 'notice')
'{127.0.0.1}' ? string[] = list('local2')
};
@documentation {
Define the Global config options
}
type haproxy_service_global_config = {
'tune.ssl.default-dh-param' ? long
'user' : string = 'haproxy'
'group' : string = 'haproxy'
'maxconn' : long = 4000
'daemon' : string = ''
'pidfile' : string = '/var/run/haproxy.pid'
'chroot' : string = '/var/lib/haproxy'
'log-send-hostname' ? string
'ssl-default-bind-ciphers' ? string_non_whitespace[]
'ssl-default-bind-options' ? string[]
'ssl-default-bind-ciphersuites' ? string_non_whitespace[]
'ssl-default-server-ciphers' ? string_non_whitespace[]
'ssl-default-server-options' ? string[]
'ssl-default-server-ciphersuites' ? string_non_whitespace[]
'ssl-dh-param-file' ? absolute_file_path
};
@documentation {
options for the stats line in the Global section
}
type haproxy_service_global_stats = {
'socket' : string = '/var/lib/haproxy/stats'
};
@documentation {
The global section
}
type haproxy_service_global = {
'logs' : haproxy_service_global_logs
'config' : haproxy_service_global_config
'stats' : haproxy_service_global_stats
};
@documentation {
Configuration in the Default section
}
type haproxy_service_defaults_config = {
'log' : string = 'global'
'mode' ? choice("http", "tcp")
'retries' : long = 3
'maxconn' : long = 4000
'option' ? string
};
@documentation {
Timeouts in ms
}
type haproxy_service_timeouts = {
'check' : long = 3500
'queue' : long = 3500
'connect' : long = 3500
'client' : long = 10000
'server' : long = 10000
'client-fin' ? long(4000..)
'server-fin' ? long(4000..)
'tunnel' ? long(4000..)
};
@documentation {
The Default Section
}
type haproxy_service_defaults = {
'config' : haproxy_service_defaults_config
'timeouts' : haproxy_service_timeouts
};
@documentation {
options in the stats section
}
type haproxy_service_stats_options = {
'enabled' ? string = ''
'hide-version' : string = ''
'uri' : string = '/'
'refresh' : long = 5
};
@documentation {
configuration in the stats section
}
type haproxy_service_stats = {
'mode' : string = 'http'
'options' ? haproxy_service_stats_options
};
@documentation {
per proxy configuration
}
type haproxy_service_proxy_config = {
'mode' : string
'capture' ? string
'cookie' ? string
'rspidel' ? string
'balance' : string
};
@documentation {
options against the default server line in the proxy
}
type haproxy_service_proxy_defaultoptions = {
'inter' : long = 2
'downinter' : long = 5
'rise' : long = 3
'fall' : long = 2
'slowstart' : long = 60
'maxqueue' : long = 128
'weight' : long = 100
};
@documentation {
options to be added to each server in the proxy
}
type haproxy_service_proxy_serveroptions = {
'cookie' ? string
};
@documentation {
configuration of a proxy
}
type haproxy_service_proxy = {
'name' : string
'port' : type_port
'binds' : string[]
'config' : haproxy_service_proxy_config
'options' ? string[]
'defaultoptions' : haproxy_service_proxy_defaultoptions
'servers' : dict
'serveroptions' ? haproxy_service_proxy_serveroptions
'timeouts' ? haproxy_service_timeouts
};
@documentation {
configuration of a peer
}
type haproxy_service_peer = {
@{Name of the peer host. Preferably in FQDN.}
'name' : string
@{Port to use to connect to peer.}
'port' : type_port
@{IP address of the peer.}
'ip' : type_ip
};
@documentation {
configuration of peers
}
type haproxy_service_peers = {
'peers': haproxy_service_peer[]
};
@documentation {
configuration of stick table
}
type haproxy_service_stick_table = {
'type' : string
'size' : string
'peers' ? string
};
type haproxy_service_reqrep = {
'pattern' : string
'replace' : string
};
type haproxy_service_bind_server_params = {
'ssl' ? boolean
'ca-file' ? absolute_file_path
@{combined cert and key in pem format}
'crt' ? absolute_file_path
@{interface to bind on}
'interface' ? string
@{enable the TLS ALPN extension}
'alpn' ? string = "h2,http/1.1"
@{interval in milliseconds between healthchecks}
'inter' ? long
};
type haproxy_service_server_params = {
include haproxy_service_bind_server_params
@{enable health check}
'check' ? boolean
@{different health check port}
'port' ? type_port
};
type haproxy_service_bind_params = {
include haproxy_service_bind_server_params
};
type haproxy_service_bind = {
'bind' : string with SELF == '*' || is_hostname(SELF) || is_absolute_file_path(SELF)
'params' ? haproxy_service_bind_params
'port' ? type_port
};
type haproxy_service_frontend_errorfile = {
'code' : long(200..600)
'filename' : absolute_file_path
};
type haproxy_service_frontend = {
'acl' ? dict()
'bind' : haproxy_service_bind[]
'default_backend' : string
'use_backend' ? string_trimmed[]
'mode' ? choice("tcp", "http")
'tcp-request' ? string[]
'http-request' ? string[]
'errorfile' ? haproxy_service_frontend_errorfile[]
};
type haproxy_service_backend_server = {
'name' : string
'ip' : type_ip
'port' ? type_port
'params' ? haproxy_service_server_params
};
@{configure 'http-check expect [!] match pattern'}
type haproxy_service_http_check = {
'inverse' ? boolean
'match' : choice('status', 'rstatus', 'string', 'rstring')
'pattern' : string
};
type haproxy_service_backend = {
'balance' ? choice('roundrobin', 'static-rr', 'leastconn', 'first', 'source', 'uri', 'url_param')
'mode' ? choice("tcp", "http")
'options' ? string[]
'httpcheck' ? haproxy_service_http_check
'tcpchecks' ? string[]
'sticktable' ? haproxy_service_stick_table
'stick' ? string
'servers' : haproxy_service_backend_server[]
'reqrep' ? haproxy_service_reqrep[]
'http-request' ? string[]
'acl' ? dict()
};
@documentation {
haproxy config
see documentation on www.haproxy.org
}
type haproxy_service = {
'global' : haproxy_service_global
'defaults' : haproxy_service_defaults
'stats' ? haproxy_service_stats
'peers' ? haproxy_service_peers{}
'proxys' ? haproxy_service_proxy[]
'frontends' ? haproxy_service_frontend{}
'backends' ? haproxy_service_backend{}
} with {
if (exists(SELF['frontends'])) {
if (!exists(SELF['backends'])) {
error('haproxy backends must be defined when frontends are defined');
};
foreach (fr; frd; SELF['frontends']) {
if (exists(frd['default_backend'])) {
if (!exists(SELF['backends'][frd['default_backend']])) {
error('default backend for frontend %s (data %s) does not exist', fr, frd);
};
};
};
};
true;
};