monitor.cfg.in 7.81 KB
Newer Older
1 2 3 4 5 6 7 8
[slap-parameters]
recipe = slapos.cookbook:slapconfiguration
computer = $${slap-connection:computer-id}
partition = $${slap-connection:partition-id}
url = $${slap-connection:server-url}
key = $${slap-connection:key-file}
cert = $${slap-connection:cert-file}

9
[monitor-parameters]
10
monitor-dir = $${directory:var}/monitor
11 12 13
result-dir = $${:monitor-dir}/bool
json-filename = monitor.json
json-path = $${:monitor-dir}/$${:json-filename}
14
rss-path = $${:monitoring-cgi}/$${:rss-filename}
15
rss-filename = rssfeed.html
16
executable = $${directory:bin}/monitor.py
17 18 19
cgi-bin = $${directory:cgi-bin}
monitoring-cgi = $${directory:monitoring-cgi}
knowledge0-cgi = $${directory:knowledge0-cgi}
20
port = 9685
21

22 23 24 25
[directory]
home = $${buildout:directory}
etc = $${:home}/etc
bin = $${:home}/bin
26
srv = $${:home}/srv
27
var = $${:home}/var
28

29
ca-dir = $${:srv}/ssl
30 31 32
cgi-bin = $${:var}/cgi-bin
monitoring-cgi = $${:cgi-bin}/monitoring
knowledge0-cgi = $${:cgi-bin}/zero-knowledge
33 34 35 36 37
cron-entries = $${:etc}/cron.d
crontabs = $${:etc}/crontabs
cronstamps = $${:etc}/cronstamps
log = $${:var}/log
monitor = $${:etc}/monitor
38
monitor-result = $${monitor-parameters:monitor-dir}
39
monitor-result-bool = $${monitor-parameters:result-dir}
40
promise = $${:etc}/promise
41
run = $${:var}/run
42 43 44
service = $${:etc}/service/
tmp = $${:home}/tmp
www = $${:var}/www
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64

[cron]
recipe = slapos.cookbook:cron
dcrond-binary = ${dcron:location}/sbin/crond
cron-entries = $${directory:cron-entries}
crontabs = $${directory:crontabs}
cronstamps = $${directory:cronstamps}
catcher = $${cron-simplelogger:wrapper}
binary = $${directory:service}/crond

# Add log to cron
[cron-simplelogger]
recipe = slapos.cookbook:simplelogger
wrapper = $${directory:bin}/cron_simplelogger
log = $${directory:log}/cron.log

[cron-entry-monitor]
<= cron
recipe = slapos.cookbook:cron.d
name = launch-monitor
65
frequency = */5 * * * *
66
command = $${monitor-parameters:executable} -a
67 68 69 70 71

[cron-entry-rss]
<= cron
recipe = slapos.cookbook:cron.d
name = build-rss
72
frequency = */5 * * * *
73 74
command = $${make-rss:output}

75 76 77 78 79 80 81 82 83
[setup-static-files]
recipe = hexagonit.recipe.download
url = ${download-static-files:destination}/${download-static-files:filename}
#md5sum = 628072e7212db1e8cdacb22b21752cda
filename = static
destination = $${directory:www}
ignore-existing = true
mode = 0644

84
[deploy-index]
85
recipe = slapos.recipe.template:jinja2
86
template = ${index:location}/${index:filename}
87
rendered = $${directory:www}/$${:filename}
88
filename = index.cgi
89 90
mode = 0744
context =
91 92 93 94 95 96 97 98 99 100 101 102 103
  key cgi_directory monitor-parameters:cgi-bin
  raw index_template $${deploy-index-template:location}/$${deploy-index-template:filename}
  key password zero-parameters:monitor-password
  raw extra_eggs_interpreter ${buildout:directory}/bin/${extra-eggs:interpreter}

[deploy-index-template]
recipe = hexagonit.recipe.download
url = ${index-template:location}/$${:filename}
destination = $${directory:www}
filename = ${index-template:filename}
download-only = true
#md5sum = 
mode = 0644
104 105 106 107

[deploy-status-cgi]
recipe = slapos.recipe.template:jinja2
template = ${status-cgi:location}/${status-cgi:filename}
108
rendered = $${monitor-parameters:monitoring-cgi}/$${:filename}
109
filename = status.cgi
110 111 112
mode = 0744
context =
  key json_file monitor-parameters:json-path
113
  raw python_executable ${buildout:executable}
114

115
[deploy-settings-cgi]
116
recipe = slapos.recipe.template:jinja2
117
template = ${settings-cgi:location}/${settings-cgi:filename}
118
rendered = $${monitor-parameters:knowledge0-cgi}/$${:filename}
119
filename = settings.cgi
120 121 122 123
mode = 0744
context =
  raw config_cfg $${buildout:directory}/knowledge0.cfg
  raw python_executable ${buildout:executable}
124
  key pwd monitor-parameters:knowledge0-cgi
125
  key this_file :filename
126

127 128 129
[deploy-monitor-script]
recipe = slapos.recipe.template:jinja2
template = ${monitor-bin:location}/${monitor-bin:filename}
130
rendered = $${monitor-parameters:executable}
131 132 133
mode = 0744
context =
  section directory directory
134 135
  key monitoring_file_json monitor-parameters:json-path
  key monitoring_folder_bool monitor-parameters:result-dir
136
  raw python_executable ${buildout:executable}
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151
  
[deploy-rss-script]
recipe = hexagonit.recipe.download
url = ${rss-bin:destination}/${rss-bin:filename}
destination = $${directory:bin}
filename = ${rss-bin:filename}
#md5sum =
mode = 0744
download-only = true

[make-rss]
recipe = slapos.recipe.template
url = ${make-rss-script:output}
output = $${directory:bin}/make-rss.sh
#md5sum = 
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172
mode = 0744

[cadirectory]
recipe = slapos.cookbook:mkdirectory
requests = $${directory:ca-dir}/requests/
private = $${directory:ca-dir}/private/
certs = $${directory:ca-dir}/certs/
newcerts = $${directory:ca-dir}/newcerts/
crl = $${directory:ca-dir}/crl/

[certificate-authority]
recipe = slapos.cookbook:certificate_authority
openssl-binary = ${openssl:location}/bin/openssl
ca-dir = $${directory:ca-dir}
requests-directory = $${cadirectory:requests}
wrapper = $${directory:service}/certificate_authority
ca-private = $${cadirectory:private}
ca-certs = $${cadirectory:certs}
ca-newcerts = $${cadirectory:newcerts}
ca-crl = $${cadirectory:crl}

173 174 175 176 177
[ca-httpd]
<= certificate-authority
recipe = slapos.cookbook:certificate_authority.request
key-file = $${cadirectory:certs}/httpd.key
cert-file = $${cadirectory:certs}/httpd.crt
178
executable = $${directory:bin}/cgi-httpd
179 180 181 182
wrapper = $${directory:service}/cgi-httpd
# Put domain name
name = example.com

183 184 185
###########
# Deploy a webserver running cgi scripts for monitoring
###########
186 187 188
[public]
recipe = slapos.cookbook:zeroknown.write
filename = knowledge0.cfg
189
monitor-password = passwordtochange
190 191 192 193

[zero-parameters]
recipe = slapos.cookbook:zeroknown.read
filename = $${public:filename}
194 195 196 197 198 199

# XXX could it be something lighter?
[cgi-httpd-configuration-file]
recipe = collective.recipe.template
input = inline:
  PidFile "$${:pid-file}"
200
  ServerName example.com
201
  ServerAdmin someone@email
202 203 204 205
  <IfDefine !MonitorPort>
  Listen [$${:listening-ip}]:$${:listening-port}
  Define MonitorPort
  </IfDefine>
206 207 208 209 210 211 212 213 214
  DocumentRoot "$${:document-root}"
  ErrorLog "$${:error-log}"
  LoadModule unixd_module modules/mod_unixd.so
  LoadModule access_compat_module modules/mod_access_compat.so
  LoadModule authz_core_module modules/mod_authz_core.so
  LoadModule authz_host_module modules/mod_authz_host.so
  LoadModule mime_module modules/mod_mime.so
  LoadModule cgid_module modules/mod_cgid.so
  LoadModule dir_module modules/mod_dir.so
215 216
  LoadModule ssl_module modules/mod_ssl.so
  # SSL Configuration
217 218
  <IfDefine !SSLConfigured>
  Define SSLConfigured
219 220 221 222 223 224 225 226 227
  SSLCertificateFile $${ca-httpd:cert-file}
  SSLCertificateKeyFile $${ca-httpd:key-file}
  SSLRandomSeed startup builtin
  SSLRandomSeed connect builtin
  SSLRandomSeed startup /dev/urandom 256
  SSLRandomSeed connect builtin
  SSLProtocol -ALL +SSLv3 +TLSv1
  SSLHonorCipherOrder On
  SSLCipherSuite RC4-SHA:HIGH:!ADH
228
  </IfDefine> 
229
  SSLEngine   On
230 231
  ScriptSock $${:cgid-pid-file}
  <Directory $${:document-root}>
232 233 234
    SSLVerifyDepth    1
    SSLRequireSSL
    SSLOptions        +StrictRequire
235 236 237
    # XXX: security????
    Options +ExecCGI
    AddHandler cgi-script .cgi
238
    DirectoryIndex $${deploy-index:rendered}
239 240 241 242 243 244
  </Directory>
output = $${directory:etc}/cgi-httpd.conf
# md5sum =
listening-ip = $${slap-parameters:ipv6-random}
# XXX: randomize-me
listening-port = 9685
245
htdocs = $${directory:www}
246 247
pid-file = $${directory:run}/cgi-httpd.pid
cgid-pid-file = $${directory:run}/cgi-httpd-cgid.pid
248
document-root = $${directory:www}
249 250 251 252 253 254
error-log = $${directory:log}/cgi-httpd-error-log

[cgi-httpd-wrapper]
recipe = slapos.cookbook:wrapper
apache-executable = ${apache:location}/bin/httpd
command-line = $${:apache-executable} -f $${cgi-httpd-configuration-file:output} -DFOREGROUND
255
wrapper-path = $${ca-httpd:executable}
256

257
[publish-connection-informations]
258
recipe = slapos.cookbook:publish
259
monitor_url = https://[$${cgi-httpd-configuration-file:listening-ip}]:$${cgi-httpd-configuration-file:listening-port}/index.cgi
260
IMPORTANT_monitor_info = change the monitor_password as soon as possible ! Default is : $${public:monitor-password}