Commit 8b95faef authored by Nicolas Wavrant's avatar Nicolas Wavrant

stack-monitor: httpd replaces nginx for providing rss feed

and rss feed now give weblink to cgi web interface
parent 55dbc649
...@@ -76,14 +76,6 @@ output = $${directory:services}/crond ...@@ -76,14 +76,6 @@ output = $${directory:services}/crond
mode = 0700 mode = 0700
logfile = $${directory:log}/crond.log logfile = $${directory:log}/crond.log
[template-nginx-conf]
recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/${:filename}
download-only = true
#md5sum =
filename = nginx_rss.conf.in
mode = 0644
[eggs] [eggs]
recipe = z3c.recipe.scripts recipe = z3c.recipe.scripts
eggs = eggs =
......
#!/usr/bin/python #!{{ python_executable }}
import cgi import cgi
import cgitb import cgitb
...@@ -21,7 +21,7 @@ if "password" not in form: ...@@ -21,7 +21,7 @@ if "password" not in form:
<body> <body>
<h1>This is the monitoring interface</h1> <h1>This is the monitoring interface</h1>
<p>Please enter the monitor_password in the next field to access the data</p> <p>Please enter the monitor_password in the next field to access the data</p>
<form action="/" method="post"> <form action="/index.cgi" method="post">
Password : <input type="password" name="password"> Password : <input type="password" name="password">
<input type="submit" value="Access"> <input type="submit" value="Access">
</form></body></html>""" </form></body></html>"""
......
...@@ -6,4 +6,4 @@ PYTHON=${buildout:directory}/bin/${extra-eggs:interpreter} ...@@ -6,4 +6,4 @@ PYTHON=${buildout:directory}/bin/${extra-eggs:interpreter}
STATUS2RSS=${rss-bin:location}/${rss-bin:filename} STATUS2RSS=${rss-bin:location}/${rss-bin:filename}
NAME=`basename $STATUS` NAME=`basename $STATUS`
cat $STATUS/* | $PYTHON $STATUS2RSS "Monitoring RSS feed" "http://[$${slap-parameters:ipv6-random}]/feed" > $RSS_FILE cat $STATUS/* | $PYTHON $STATUS2RSS "Monitoring RSS feed" "https://[$${slap-parameters:ipv6-random}]:$${cgi-httpd-configuration-file:listening-port}/$${deploy-cgi-script:filename}" > $RSS_FILE
\ No newline at end of file \ No newline at end of file
...@@ -11,7 +11,7 @@ monitor-dir = $${directory:monitor-result} ...@@ -11,7 +11,7 @@ monitor-dir = $${directory:monitor-result}
result-dir = $${:monitor-dir}/bool result-dir = $${:monitor-dir}/bool
json-filename = monitor.json json-filename = monitor.json
json-path = $${:monitor-dir}/$${:json-filename} json-path = $${:monitor-dir}/$${:json-filename}
rss-path = $${directory:www}/monitor.html rss-path = $${directory:www}/index.html
executable = $${directory:bin}/monitor.py executable = $${directory:bin}/monitor.py
[directory] [directory]
...@@ -22,7 +22,6 @@ srv = $${:home}/srv ...@@ -22,7 +22,6 @@ 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
...@@ -68,11 +67,13 @@ command = $${make-rss:output} ...@@ -68,11 +67,13 @@ command = $${make-rss:output}
[deploy-cgi-script] [deploy-cgi-script]
recipe = slapos.recipe.template:jinja2 recipe = slapos.recipe.template:jinja2
template = ${cgi-bin:location}/${cgi-bin:filename} template = ${cgi-bin:location}/${cgi-bin:filename}
rendered = $${directory:cgi-bin}/index.cgi rendered = $${directory:www}/$${:filename}
filename = index.cgi
mode = 0744 mode = 0744
context = context =
key json_file monitor-parameters:json-path key json_file monitor-parameters:json-path
key password cgi-password:passwd key password cgi-password:passwd
raw python_executable ${buildout:executable}
[deploy-monitor-script] [deploy-monitor-script]
recipe = slapos.recipe.template:jinja2 recipe = slapos.recipe.template:jinja2
...@@ -83,6 +84,7 @@ context = ...@@ -83,6 +84,7 @@ context =
section directory directory section directory directory
key monitoring_file_json monitor-parameters:json-path key monitoring_file_json monitor-parameters:json-path
key monitoring_folder_bool monitor-parameters:result-dir key monitoring_folder_bool monitor-parameters:result-dir
raw python_executable ${buildout:executable}
[deploy-rss-script] [deploy-rss-script]
recipe = hexagonit.recipe.download recipe = hexagonit.recipe.download
...@@ -100,14 +102,6 @@ output = $${directory:bin}/make-rss.sh ...@@ -100,14 +102,6 @@ output = $${directory:bin}/make-rss.sh
#md5sum = #md5sum =
mode = 0744 mode = 0744
[tempdirectory]
recipe = slapos.cookbook:mkdirectory
client_body_temp_path = $${directory:tmp}/client_body_temp_path
proxy_temp_path = $${directory:tmp}/proxy_temp_path
fastcgi_temp_path = $${directory:tmp}/fastcgi_temp_path
uwsgi_temp_path = $${directory:tmp}/uwsgi_temp_path
scgi_temp_path = $${directory:tmp}/scgi_temp_path
[cadirectory] [cadirectory]
recipe = slapos.cookbook:mkdirectory recipe = slapos.cookbook:mkdirectory
requests = $${directory:ca-dir}/requests/ requests = $${directory:ca-dir}/requests/
...@@ -127,16 +121,6 @@ ca-certs = $${cadirectory:certs} ...@@ -127,16 +121,6 @@ ca-certs = $${cadirectory:certs}
ca-newcerts = $${cadirectory:newcerts} ca-newcerts = $${cadirectory:newcerts}
ca-crl = $${cadirectory:crl} ca-crl = $${cadirectory:crl}
[ca-nginx]
<= certificate-authority
recipe = slapos.cookbook:certificate_authority.request
key-file = $${cadirectory:certs}/nginx_rss.key
cert-file = $${cadirectory:certs}/nginx_rss.crt
executable = $${nginx-parameters:bin_launcher}
wrapper = $${directory:service}/nginx-rss
# Put domain name
name = example.com
[ca-httpd] [ca-httpd]
<= certificate-authority <= certificate-authority
recipe = slapos.cookbook:certificate_authority.request recipe = slapos.cookbook:certificate_authority.request
...@@ -147,40 +131,6 @@ wrapper = $${directory:service}/cgi-httpd ...@@ -147,40 +131,6 @@ wrapper = $${directory:service}/cgi-httpd
# Put domain name # Put domain name
name = example.com name = example.com
[nginx-parameters]
nb_workers = 2
port = 9685
global-ip = $${slap-parameters:ipv6-random}
# SSL
ssl-certificate = $${ca-nginx:cert-file}
ssl-key = $${ca-nginx:key-file}
# Log
path_pid = $${directory:run}/nginx-rss.pid
path_log = $${directory:log}/nginx.log
path_access_log = $${directory:log}/nginx.access.log
path_error_log = $${directory:log}/nginx.error.log
path_tmp = $${directory:tmp}
# Config files
nginx_conf = $${nginx-conf:rendered}
# Executables
bin_nginx = ${nginx:location}/sbin/nginx
bin_launcher = $${directory:bin}/nginx-launcher
rss_feed = $${monitor-parameters:rss-path}
www = $${directory:www}
[nginx-conf]
recipe = slapos.recipe.template:jinja2
template = ${template-nginx-conf:location}/${template-nginx-conf:filename}
rendered = $${directory:etc}/nginx_rss.conf
context =
section param_nginx nginx-parameters
section param_tempdir tempdirectory
[nginx-service]
recipe = slapos.cookbook:wrapper
wrapper-path = $${nginx-parameters:bin_launcher}
command-line = $${nginx-parameters:bin_nginx} -c $${nginx-parameters:nginx_conf}
########### ###########
# Deploy a webserver running cgi scripts for monitoring # Deploy a webserver running cgi scripts for monitoring
########### ###########
...@@ -190,7 +140,6 @@ storage-path = $${directory:var}/cgi-passwd ...@@ -190,7 +140,6 @@ storage-path = $${directory:var}/cgi-passwd
bytes = 8 bytes = 8
# XXX could it be something lighter? # XXX could it be something lighter?
# XXX Add SSL
[cgi-httpd-configuration-file] [cgi-httpd-configuration-file]
recipe = collective.recipe.template recipe = collective.recipe.template
input = inline: input = inline:
...@@ -227,17 +176,17 @@ input = inline: ...@@ -227,17 +176,17 @@ input = inline:
# XXX: security???? # XXX: security????
Options +ExecCGI Options +ExecCGI
AddHandler cgi-script .cgi AddHandler cgi-script .cgi
DirectoryIndex $${deploy-cgi-script:rendered} DirectoryIndex $${monitor-parameters:rss-path}
</Directory> </Directory>
output = $${directory:etc}/cgi-httpd.conf output = $${directory:etc}/cgi-httpd.conf
# md5sum = # md5sum =
listening-ip = $${slap-parameters:ipv6-random} listening-ip = $${slap-parameters:ipv6-random}
# XXX: randomize-me # XXX: randomize-me
listening-port = 9685 listening-port = 9685
htdocs = $${directory:cgi-bin} htdocs = $${directory:www}
pid-file = $${directory:run}/cgi-httpd.pid pid-file = $${directory:run}/cgi-httpd.pid
cgid-pid-file = $${directory:run}/cgi-httpd-cgid.pid cgid-pid-file = $${directory:run}/cgi-httpd-cgid.pid
document-root = $${directory:cgi-bin} document-root = $${directory:www}
error-log = $${directory:log}/cgi-httpd-error-log error-log = $${directory:log}/cgi-httpd-error-log
[cgi-httpd-wrapper] [cgi-httpd-wrapper]
......
#!${buildout:executable} #!{{ python_executable }}
import datetime import datetime
import json import json
......
worker_processes {{ param_nginx['nb_workers'] }};
pid {{ param_nginx['path_pid'] }};
error_log {{ param_nginx['path_error_log'] }};
daemon off;
events {
worker_connections 1024;
accept_mutex off;
}
http {
default_type application/octet-stream;
access_log {{ param_nginx['path_access_log'] }} combined;
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
server {
listen [{{ param_nginx['global-ip'].pop() }}]:{{ param_nginx['port'] }} ssl;
server_name _;
ssl_certificate {{ param_nginx['ssl-certificate'] }};
ssl_certificate_key {{ param_nginx['ssl-key'] }};
ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!MD5;
keepalive_timeout 90s;
client_body_temp_path {{ param_tempdir['client_body_temp_path'] }};
proxy_temp_path {{ param_tempdir['proxy_temp_path'] }};
fastcgi_temp_path {{ param_tempdir['fastcgi_temp_path'] }};
uwsgi_temp_path {{ param_tempdir['uwsgi_temp_path'] }};
scgi_temp_path {{ param_tempdir['scgi_temp_path'] }};
location / {
root {{ param_nginx['www'] }};
}
location /feed {
root {{ param_nginx['www'] }};
index {{ param_nginx['rss_feed'] }};
}
}
}
\ 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