Commit 2861fd5d authored by Nicolas Wavrant's avatar Nicolas Wavrant

stack-monitor: apache server added to run cgi script

which show the monitor.json in a html interface
parent 333ea2ad
[buildout] [buildout]
extends = extends =
../../component/apache/buildout.cfg
../../component/dcron/buildout.cfg ../../component/dcron/buildout.cfg
../../component/openssl/buildout.cfg ../../component/openssl/buildout.cfg
../../component/nginx/buildout.cfg ../../component/nginx/buildout.cfg
...@@ -52,6 +53,14 @@ download-only = true ...@@ -52,6 +53,14 @@ download-only = true
filename = monitor.py.in filename = monitor.py.in
mode = 0644 mode = 0644
[cgi-bin]
recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/${:filename}
download-only = true
#md5sum =
filename = index.cgi
mode = 0644
[rss-bin] [rss-bin]
recipe = hexagonit.recipe.download recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/${:filename} url = ${:_profile_base_location_}/${:filename}
......
...@@ -22,6 +22,7 @@ srv = $${:home}/srv ...@@ -22,6 +22,7 @@ srv = $${:home}/srv
var = $${:home}/var var = $${:home}/var
ca-dir = $${:srv}/ssl ca-dir = $${:srv}/ssl
cgi-bin = $${:www}/cgi-bin
cron-entries = $${:etc}/cron.d cron-entries = $${:etc}/cron.d
crontabs = $${:etc}/crontabs crontabs = $${:etc}/crontabs
cronstamps = $${:etc}/cronstamps cronstamps = $${:etc}/cronstamps
...@@ -64,6 +65,15 @@ name = build-rss ...@@ -64,6 +65,15 @@ name = build-rss
frequency = * * * * * frequency = * * * * *
command = $${make-rss:output} command = $${make-rss:output}
[deploy-cgi-script]
recipe = slapos.recipe.template:jinja2
template = ${cgi-bin:location}/${cgi-bin:filename}
rendered = $${directory:cgi-bin}/index.cgi
mode = 0744
context =
key json_file monitor-parameters:json-path
key password cgi-password:passwd
[deploy-monitor-script] [deploy-monitor-script]
recipe = slapos.recipe.template:jinja2 recipe = slapos.recipe.template:jinja2
template = ${monitor-bin:location}/${monitor-bin:filename} template = ${monitor-bin:location}/${monitor-bin:filename}
...@@ -130,7 +140,7 @@ name = example.com ...@@ -130,7 +140,7 @@ name = example.com
[nginx-parameters] [nginx-parameters]
nb_workers = 2 nb_workers = 2
port = 9685 port = 9685
global-ip = $${slap-parameters:ipv6} global-ip = $${slap-parameters:ipv6-random}
# SSL # SSL
ssl-certificate = $${ca-nginx:cert-file} ssl-certificate = $${ca-nginx:cert-file}
ssl-key = $${ca-nginx:key-file} ssl-key = $${ca-nginx:key-file}
...@@ -160,3 +170,57 @@ context = ...@@ -160,3 +170,57 @@ context =
recipe = slapos.cookbook:wrapper recipe = slapos.cookbook:wrapper
wrapper-path = $${nginx-parameters:bin_launcher} wrapper-path = $${nginx-parameters:bin_launcher}
command-line = $${nginx-parameters:bin_nginx} -c $${nginx-parameters:nginx_conf} command-line = $${nginx-parameters:bin_nginx} -c $${nginx-parameters:nginx_conf}
###########
# Deploy a webserver running cgi scripts for monitoring
###########
[cgi-password]
recipe = slapos.cookbook:generate.password
storage-path = $${directory:var}/cgi-passwd
bytes = 8
# XXX could it be something lighter?
# XXX Add SSL
[cgi-httpd-configuration-file]
recipe = collective.recipe.template
input = inline:
PidFile "$${:pid-file}"
Listen [$${:listening-ip}]:$${:listening-port}
ServerAdmin someone@email
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
ScriptSock $${:cgid-pid-file}
<Directory $${:document-root}>
# XXX: security????
Options +ExecCGI
AddHandler cgi-script .cgi
DirectoryIndex $${deploy-cgi-script:rendered}
</Directory>
output = $${directory:etc}/cgi-httpd.conf
# md5sum =
listening-ip = $${slap-parameters:ipv6-random}
# XXX: randomize-me
listening-port = 9685
htdocs = $${directory:cgi-bin}
pid-file = $${directory:run}/cgi-httpd.pid
cgid-pid-file = $${directory:run}/cgi-httpd-cgid.pid
document-root = $${directory:cgi-bin}
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
wrapper-path = $${directory:service}/cgi-httpd
[publish-connection-parameter]
recipe = slapos.cookbook:publish
monitor_url = http://[$${cgi-httpd-configuration-file:listening-ip}]:$${cgi-httpd-configuration-file:listening-port}
monitor_password = $${cgi-password:passwd}
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment