Commit 72a7235a authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

Merge branch 'erp5-component' into erp5

parents b0800ffc 889e20fa
......@@ -12,8 +12,8 @@ parts =
[curl]
recipe = slapos.recipe.cmmi
url = http://curl.haxx.se/download/curl-7.36.0.tar.bz2
md5sum = e6d1f9d1b59da5062109ffe14e0569a4
url = http://curl.haxx.se/download/curl-7.37.0.tar.bz2
md5sum = 7dda0cc2e4136f78d5801ac347be696b
configure-options =
--disable-static
--disable-ldap
......
......@@ -15,8 +15,8 @@ parts =
[git]
recipe = slapos.recipe.cmmi
url = https://www.kernel.org/pub/software/scm/git/git-1.9.3.tar.xz
md5sum = 560200d1db05a2dd2b8a2b3718655463
url = https://www.kernel.org/pub/software/scm/git/git-2.0.0.tar.xz
md5sum = 0646202ae979e4339f3e47f2375b5773
configure-options =
--with-curl=${curl:location}
--with-openssl=${openssl:location}
......
......@@ -11,9 +11,9 @@ extends =
[groonga]
recipe = slapos.recipe.cmmi
version = 4.0.1
version = 4.0.2
url = http://packages.groonga.org/source/groonga/groonga-${:version}.tar.gz
md5sum = 7bfd1c78fe6506424d3f6e4a689a4619
md5sum = eff2c4cf8e26f57fee66fc843be504d9
configure-options =
--disable-static
--disable-glibtest
......
......@@ -12,11 +12,11 @@ find-links =
[libreoffice-bin]
recipe = slapos.recipe.build
# here, two %s are used, first one is for directory name (eg. x86_64), and second one is for filename (eg. x86-64).
version = 4.2.3.3
version = 4.2.4.2
url = http://downloadarchive.documentfoundation.org/libreoffice/old/${:version}/rpm/%s/LibreOffice_${:version}_Linux_%s_rpm.tar.gz
# supported architectures md5sums
md5sum_x86 = 2744ff6f5bd2bca773d6fec8b0558a5f
md5sum_x86-64 = 25f1315fa6a22aefde116302a4146e46
md5sum_x86 = 2f58aafdbfc7e29ae3ed077463a9a329
md5sum_x86-64 = 8d6617a8a5a9e4a7655d25c8660386d4
# where office code can be found?
officedir = libreoffice4.2
......
......@@ -2,7 +2,7 @@
parts =
libuuid
extenrs =
extends =
../perl/buildout.cfg
[libuuid]
......
......@@ -8,7 +8,7 @@ parts =
lxml-python
[lxml-python-env]
PATH = ${libxslt:location}/bin:%(PATH)s
XSLT_CONFIG = ${libxslt:location}/bin/xslt-config
[lxml-python]
recipe = zc.recipe.egg:custom
......
......@@ -56,8 +56,8 @@ environment =
# mroonga - a storage engine for MySQL. It provides fast fulltext search feature to all MySQL users.
# http://mroonga.github.com/
recipe = slapos.recipe.cmmi
url = http://packages.groonga.org/source/mroonga/mroonga-4.02.tar.gz
md5sum = aebd30a3cec90182ee474693216ac1dc
url = http://packages.groonga.org/source/mroonga/mroonga-4.03.tar.gz
md5sum = 19ab2721d2d41c234e018a879f392990
configure-options =
--with-mysql-source=${mariadb:location}__compile__/mariadb-${mariadb:version}
--with-mysql-config=${mariadb:location}/bin/mysql_config
......
......@@ -16,8 +16,8 @@ parts =
[openssl]
recipe = slapos.recipe.cmmi
url = https://www.openssl.org/source/openssl-1.0.1g.tar.gz
md5sum = de62b43dfcd858e66a74bee1c834e959
url = https://www.openssl.org/source/openssl-1.0.1h.tar.gz
md5sum = 8d6d684a9430d5cc98a62a5d8fbda8cf
depends =
${ca-certificates:version}
patch-binary = ${patch:location}/bin/patch
......
......@@ -10,8 +10,8 @@ parts =
recipe = slapos.recipe.cmmi
depends =
${perl:version}
version = 2.2.7
version = 2.2.8
url = http://www.percona.com/redir/downloads/percona-toolkit/${:version}/percona-toolkit-${:version}.tar.gz
md5sum = 7514af32e0edff70c4934da2e5e36303
md5sum = c7fe343308898ad7f0c456c8394f2cbf
configure-command =
${perl:location}/bin/perl Makefile.PL
......@@ -9,15 +9,15 @@ parts =
recipe = slapos.recipe.cmmi
depends =
${gdbm:version}
version = 5.18.2
version = 5.20.0
# increase revision when we need to rebuild binary libraries.
revision = 1
url = http://www.cpan.org/src/5.0/perl-${:version}.tar.bz2
md5sum = d549b16ee4e9210988da39193a9389c1
md5sum = 20cbecd4e9e880ee7a50a136c8b1484e
siteprefix = ${buildout:parts-directory}/site_${:_buildout_section_name_}
patch-options = -p1
patches =
${:_profile_base_location_}/perl-keep-linker-flags-in-ldflags.patch#9873a89c969bd5a478434c3b8b2d57d8
${:_profile_base_location_}/perl-keep-linker-flags-in-ldflags.patch#4e8e0c59d7176eafb0c7402dea17bef1
configure-command =
sh Configure -des \
-Dprefix=${buildout:parts-directory}/${:_buildout_section_name_} \
......
--- perl-5.12.3/Configure.orig 2011-01-09 21:20:52.000000000 +0100
+++ perl-5.12.3/Configure 2011-01-26 19:33:33.106561007 +0100
@@ -8092,16 +8092,7 @@
--- perl-5.20.0/Configure.orig 2014-05-28 15:27:22.865060361 +0200
+++ perl-5.20.0/Configure 2014-05-28 15:32:14.297064994 +0200
@@ -8277,16 +8277,7 @@
case "$dflt" in
none) dflt='' ;;
none) dflt='' ;;
esac
- for thisflag in $ldflags; do
- case "$thisflag" in
- case "$thisflag" in
- -L*|-R*|-Wl,-R*)
- case " $dflt " in
- case " $dflt " in
- *" $thisflag "*) ;;
- *) dflt="$dflt $thisflag" ;;
- esac
- ;;
- esac
- esac
- ;;
- esac
- done
+ dflt="$dflt $ldflags"
case "$dflt" in
''|' ') dflt='none' ;;
''|' ') dflt='none' ;;
......@@ -135,7 +135,7 @@ mr.developer = 1.30
netaddr = 0.7.11
pyparsing = 2.0.2
six = 1.6.1
slapos.core = 1.0.5
slapos.core = 1.1.2
slapos.libnetworkcache = 0.14.1
slapos.recipe.cmmi = 0.2
stevedore = 0.15
......@@ -143,25 +143,25 @@ xml-marshaller = 0.9.7
z3c.recipe.scripts = 1.0.1
# Required by:
# slapos.core==1.0.5
# slapos.core==1.1.2
Flask = 0.10.1
# Required by:
# slapos.core==1.0.5
# slapos.core==1.1.2
cliff = 1.6.1
# Required by:
# slapos.core==1.0.5
# slapos.core==1.1.2
netifaces = 0.10.3
# Required by:
# slapos.core==1.0.5
# slapos.core==1.1.2
requests = 2.3.0
# Required by:
# slapos.core==1.0.5
# slapos.core==1.1.2
supervisor = 3.0
# Required by:
# slapos.core==1.0.5
# slapos.core==1.1.2
zope.interface = 4.1.1
......@@ -9,8 +9,8 @@ extends =
[squid]
recipe = hexagonit.recipe.cmmi
url = http://www.squid-cache.org/Versions/v3/3.2/squid-3.2.1.tar.gz
md5sum = 3fb81acc6b70a432e3f0d8a0491056dc
url = http://www1.at.squid-cache.org/Versions/v3/3.4/squid-3.4.4.tar.gz
md5sum = b36ab3696485a86b43d9194ac9b6b7fe
configure-options =
--disable-dependency-tracking
--disable-translation
......
......@@ -162,7 +162,6 @@ class Recipe(GenericBaseRecipe):
for pt_script_name in (
'pt-align',
'pt-archiver',
'pt-collect',
'pt-config-diff',
'pt-deadlock-logger',
'pt-diskstats',
......@@ -175,12 +174,10 @@ class Recipe(GenericBaseRecipe):
'pt-index-usage',
'pt-ioprofile',
'pt-kill',
'pt-log-player',
'pt-mext',
'pt-mysql-summary',
'pt-online-schema-change',
'pt-pmp',
'pt-query-advisor',
'pt-query-digest',
'pt-show-grants',
'pt-sift',
......@@ -192,8 +189,6 @@ class Recipe(GenericBaseRecipe):
'pt-table-checksum',
'pt-table-sync',
'pt-table-usage',
'pt-tcp-model',
'pt-trend',
'pt-upgrade',
'pt-variable-advisor',
'pt-visual-explain',
......
......@@ -4,6 +4,7 @@ extends =
../../component/git/buildout.cfg
../../stack/slapos.cfg
../../component/dash/buildout.cfg
../../component/binutils/buildout.cfg
../../component/lxml-python/buildout.cfg
../../component/apache/buildout.cfg
......@@ -13,10 +14,13 @@ extends =
../../component/logrotate/buildout.cfg
../../component/rdiff-backup/buildout.cfg
../../component/squid/buildout.cfg
# Monitoring stack
../../stack/monitor/buildout.cfg
parts +=
slapos-cookbook
slapos-toolbox
eggs
template
template-apache-frontend
template-apache-replicate
......@@ -36,12 +40,16 @@ recipe = zc.recipe.egg
eggs =
${lxml-python:egg}
slapos.toolbox
plone.recipe.command
scripts =
killpidfromfile
onetimedownload
[eggs]
recipe = zc.recipe.egg
eggs =
plone.recipe.command
[check-recipe]
recipe = plone.recipe.command
stop-on-error = true
......@@ -59,20 +67,20 @@ mode = 0644
[template-apache-frontend]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-apache-frontend.cfg
md5sum = f0a507fed2b1dcab5530c892adce8327
md5sum = f5ec3d3b29d20ccdb00e3b64aa588fa5
output = ${buildout:directory}/template-apache-frontend.cfg
mode = 0644
[template-apache-replicate]
recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/instance-apache-replicate.cfg.in
md5sum = 02658d39fa429fef7faba9658e4f1474
md5sum = 82c88a4b4856bfffec3d7ef24e372f38
mode = 0644
[template-slave-list]
recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/templates/apache-custom-slave-list.cfg.in
md5sum = f002a8fc8fc5d18adbd8ac1ee054e852
md5sum = 5c49a66a0fe4b92ab21ef7148ea4e5ff
mode = 640
[template-slave-configuration]
......@@ -90,7 +98,7 @@ mode = 640
[template-apache-frontend-configuration]
recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/templates/apache.conf.in
md5sum = bae89ebc6c5e75b12535fbd6c37f647d
md5sum = 72922908c1f4e72c92bb03e072660c7c
mode = 640
[template-apache-cached-configuration]
......@@ -121,7 +129,7 @@ mode = 640
[template-default-virtualhost]
recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/templates/000.conf.in
md5sum = c2bbf029e6adc432de0884fb5cf5d2ab
md5sum = b40ffdab93a80b40046e3bbb2f7a58bc
mode = 640
[template-default-slave-virtualhost]
......@@ -139,11 +147,18 @@ mode = 640
[template-squid-configuration]
recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/templates/squid.conf.jinja2
md5sum = 9f70474181372d34c8cd203f24ab546e
md5sum = f17753fa87da074bc949b2967a330099
mode = 640
[template-empty]
recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/templates/empty.in
md5sum = c2314c3a9c3412a38d14b312d3df83c1
mode = 640
\ No newline at end of file
mode = 640
[template-wrapper]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/templates/wrapper.in
output = ${buildout:directory}/template-wrapper.cfg
mode = 0644
md5sum = 8cde04bfd0c0e9bd56744b988275cfd8
......@@ -21,11 +21,33 @@ parts =
promise-squid
dynamic-template-default-vh
not-found-html
promise-frontend-apache-configuration
promise-cached-apache-configuration
promise-apache-frontend-v4-https
promise-apache-frontend-v4-http
promise-apache-frontend-v6-https
promise-apache-frontend-v6-http
promise-apache-cached
## Monitoring part
###Parts to add for monitoring
certificate-authority
cron-entry-monitor
cron-entry-rss
deploy-index
deploy-settings-cgi
deploy-status-cgi
setup-static-files
certificate-authority
zero-parameters
public-symlink
cgi-httpd-wrapper
cgi-httpd-graceful-wrapper
monitor-promise
monitor-instance-log-access
## Monitor for apache
monitor-current-log-access
monitor-backup-log-access
extends = ${monitor-template:output}
eggs-directory = ${buildout:eggs-directory}
......@@ -95,6 +117,14 @@ apache-directory = ${apache-2.2:location}
apache-ipv6 = $${instance-parameter:ipv6-random}
apache-https-port = $${instance-parameter:configuration.port}
[monitor-current-log-access]
< = monitor-directory-access
source = $${directory:log}
[monitor-backup-log-access]
< = monitor-directory-access
source = $${directory:logrotate-backup}
[jinja2-template-base]
recipe = slapos.recipe.template:jinja2
rendered = $${buildout:directory}/$${:filename}
......@@ -140,6 +170,7 @@ extra-context =
section logrotate_dict logrotate
section frontend_configuration frontend-configuration
section apache_configuration apache-configuration
section connection_information_dict publish-connection-informations
[dynamic-custom-group-template-slave-list]
< = jinja2-template-base
......@@ -292,6 +323,10 @@ pid-file = $${directory:run}/httpd.pid
protected-path = /
access-control-string = none
cached-rewrite-file = $${directory:etc}/apache_rewrite_cached.txt
frontend-configuration-verification = ${apache-2.2:location}/bin/httpd -Sf $${:frontend-configuration}
frontend-graceful-command = $${:frontend-configuration-verification}; if [ $? -eq 0 ]; then kill -USR1 $(cat $${:pid-file}); fi
cached-configuration-verification = ${apache-2.2:location}/bin/httpd -Sf $${:cached-configuration}
cached-graceful-command = $${:cached-configuration-verification}; if [ $? -eq 0 ]; then kill -USR1 $(cat $${apache-configuration:cache-pid-file}); fi
# Apache for cache configuration
cache-access-log = $${directory:log}/frontend-apache-access-cached.log
......@@ -381,7 +416,7 @@ name = apache
log = $${apache-configuration:error-log} $${apache-configuration:access-log}
frequency = daily
rotatep-num = 30
post = ${buildout:bin-directory}/killpidfromfile $${apache-configuration:pid-file} SIGUSR1
post = $${apache-configuration:frontend-graceful-command}
sharedscripts = true
notifempty = true
create = true
......@@ -393,7 +428,7 @@ name = apache-cached
log = $${apache-configuration:cache-error-log} $${apache-configuration:cache-access-log}
frequency = daily
rotatep-num = 30
post = ${buildout:bin-directory}/killpidfromfile $${apache-configuration:cache-pid-file} SIGUSR1
post = $${apache-configuration:cached-graceful-command}
sharedscripts = true
notifempty = true
create = true
......@@ -470,15 +505,39 @@ port = $${apache-configuration:cache-port}
# End of Squid part
### Apaches Graceful and promises
[frontend-apache-graceful]
recipe = slapos.cookbook:wrapper
command-line = ${buildout:bin-directory}/killpidfromfile $${apache-configuration:pid-file} SIGUSR1
wrapper-path = $${directory:etc-run}/frontend-apache-graceful
< = jinja2-template-base
template = ${template-wrapper:output}
rendered = $${directory:etc-run}/frontend-apache-safe-graceful
mode = 0700
extra-context =
key content apache-configuration:frontend-graceful-command
[cached-apache-graceful]
recipe = slapos.cookbook:wrapper
command-line = ${buildout:bin-directory}/killpidfromfile $${apache-configuration:cache-pid-file} SIGUSR1
wrapper-path = $${directory:etc-run}/cached-apache-graceful
< = jinja2-template-base
template = ${template-wrapper:output}
rendered = $${directory:etc-run}/cached-apache-safe-graceful
mode = 0700
extra-context =
key content apache-configuration:cached-graceful-command
# Promises checking configuration:
[promise-frontend-apache-configuration]
< = jinja2-template-base
template = ${template-wrapper:output}
rendered = $${directory:promise}/frontend-apache-configuration-promise
mode = 0700
extra-context =
key content apache-configuration:frontend-configuration-verification
[promise-cached-apache-configuration]
< = jinja2-template-base
template = ${template-wrapper:output}
rendered = $${directory:promise}/cached-apache-configuration-promise
mode = 0700
extra-context =
key content apache-configuration:cached-configuration-verification
[promise-apache-frontend-v4-https]
recipe = slapos.cookbook:check_port_listening
......
......@@ -59,20 +59,24 @@ sla-{{ parameter }} = {{ slapparameter_dict.pop( sla_key + parameter ) }}
[replicate]
<= slap-connection
recipe = slapos.cookbook:request
recipe = slapos.cookbook:requestoptional
software-url = ${slap-connection:software-release-url}
software-type = {{frontend_type}}
return = private-ipv4 public-ipv4 slave-instance-information-list
return = private-ipv4 public-ipv4 slave-instance-information-list monitor_url
config = {{ ' '.join(slapparameter_dict.keys()) + ' ' + slave_list_name }}
{% for parameter, value in slapparameter_dict.iteritems() -%}
config-{{parameter}} = {{ value }}
{% endfor -%}
config-{{ slave_list_name }} = {{ json_module.dumps(slave_instance_list) }}
connection-monitor_url =
[publish-information]
recipe = slapos.cookbook:publish
domain = {{ slapparameter_dict.get('domain') }}
slave-amount = {{ slave_instance_list | length }}
{% for frontend in frontend_section_list %}
{{ frontend }}-monitor-url = {{ '${' + frontend + ':connection-monitor_url}' }}
{% endfor -%}
{% for frontend in frontend_list -%}
#{{frontend}}-private-ipv4 = ${request-{{frontend}}:private-ipv4}
{% endfor -%}
......
......@@ -2,120 +2,105 @@
extends = common.cfg
[versions]
Jinja2 = 2.6
Werkzeug = 0.8.3
apache-libcloud = 0.12.3
Jinja2 = 2.7.2
MarkupSafe = 0.23
PyRSS2Gen = 1.1
Werkzeug = 0.9.4
apache-libcloud = 0.14.1
async = 0.6.1
buildout-versions = 1.7
gitdb = 0.5.4
hexagonit.recipe.cmmi = 2.0
meld3 = 0.6.10
pycrypto = 2.6
rdiff-backup = 1.0.5
slapos.recipe.build = 0.11.6
slapos.recipe.cmmi = 0.1.1
slapos.recipe.template = 2.4.2
slapos.toolbox = 0.34.0
smmap = 0.8.2
z3c.recipe.scripts = 1.0.1
cliff = 1.4.4
cmd2 = 0.6.5.1
prettytable = 0.7.2
requests = 1.2.3
slapos.cookbook = 0.82
cffi = 0.8.2
cmd2 = 0.6.7
cns.recipe.symlink = 0.2.3
collective.recipe.template = 1.11
cryptography = 0.4
gitdb = 0.5.4
hexagonit.recipe.cmmi = 2.0
inotifyx = 0.2.0-1
itsdangerous = 0.24
lxml = 3.3.5
meld3 = 1.0.0
mr.developer = 1.30
netaddr = 0.7.11
plone.recipe.command = 1.1
pyOpenSSL = 0.14
pycrypto = 2.6.1
pyparsing = 2.0.2
pytz = 2014.3
rdiff-backup = 1.0.5
six = 1.6.1
slapos.cookbook = 0.87
slapos.recipe.build = 0.12
slapos.recipe.cmmi = 0.2
slapos.recipe.template = 2.5
slapos.toolbox = 0.39.2
smmap = 0.8.2
stevedore = 0.15
# Required by:
# cffi==0.8.2
pycparser = 2.10
# Required by:
# slapos.cookbook==0.82
lock-file = 2.0
# Required by:
# slapos.core==0.35.1
# slapos.toolbox==0.34.0
Flask = 0.9
# slapos.core==1.0.5
# slapos.toolbox==0.39.2
Flask = 0.10.1
# Required by:
# slapos.toolbox==0.34.0
# slapos.toolbox==0.39.2
GitPython = 0.3.2.RC1
# Required by:
# slapos.toolbox==0.34.0
atomize = 0.1.1
# Required by:
# slapos.toolbox==0.34.0
feedparser = 5.1.3
# slapos.toolbox==0.39.2
atomize = 0.2.0
# Required by:
# slapos.cookbook==0.82
inotifyx = 0.2.0
# slapos.core==1.0.5
cliff = 1.6.1
# Required by:
# slapos.cookbook==0.82
# slapos.core==0.35.1
# xml-marshaller==0.9.7
lxml = 3.1.2
# paramiko==1.14.0
ecdsa = 0.11
# Required by:
# slapos.cookbook==0.82
netaddr = 0.7.10
# Required by:
# slapos.core==0.35.1
netifaces = 0.10.3
# slapos.toolbox==0.39.2
feedparser = 5.1.3
# Required by:
# slapos.toolbox==0.34.0
paramiko = 1.10.1
# slapos.cookbook==0.87
lock-file = 2.0
# Required by:
# slapos.toolbox==0.34.0
psutil = 0.7.0
# slapos.core==1.0.5
netifaces = 0.10.4
# Required by:
# slapos.core==0.35.1
pyflakes = 0.7
# slapos.toolbox==0.39.2
paramiko = 1.14.0
# Required by:
# slapos.cookbook==0.82
pytz = 2013b
# slapos.toolbox==0.39.2
psutil = 2.1.1
# Required by:
# slapos.cookbook==0.82
# slapos.core==0.35.1
# slapos.toolbox==0.34.0
# zc.buildout==1.6.0-dev-SlapOS-010
# zc.recipe.egg==1.3.2
setuptools = 0.6c12dev-r88846
# cffi==0.8.2
pycparser = 2.10
# Required by:
# slapos.cookbook==0.82
# slapos.toolbox==0.34.0
slapos.core = 0.35.1
# slapos.core==1.0.5
requests = 2.3.0
# Required by:
# slapos.core==0.35.1
supervisor = 3.0b1
# slapos.toolbox==0.39.2
slapos.core = 1.0.5
# Required by:
# slapos.core==0.35.1
unittest2 = 0.5.1
# slapos.core==1.0.5
supervisor = 3.0
# Required by:
# slapos.cookbook==0.82
# slapos.toolbox==0.34.0
# slapos.toolbox==0.39.2
xml-marshaller = 0.9.7
# Required by:
# slapos.core==0.35.1
zope.interface = 4.0.5
# slapos.core==1.0.5
zope.interface = 4.1.1
[networkcache]
# signature certificates of the following uploaders.
......
......@@ -2,9 +2,7 @@
ServerName www.example.org
SSLEngine on
SSLProxyEngine on
SSLProtocol -ALL +SSLv3 +TLSv1
SSLHonorCipherOrder On
SSLCipherSuite RC4-SHA:HIGH:!ADH
SSLProtocol ALL -SSLv2
# Rewrite part
ProxyVia On
......
......@@ -53,7 +53,7 @@ log = {{slave_parameter_dict.get('access_log')}} {{slave_parameter_dict.get('err
backup = {{ '${' + slave_directory_section + ':log-folder}' }}
frequency = daily
rotatep-num = 30
post = ${buildout:bin-directory}/killpidfromfile {{ apache_configuration.get('pid-file') }} SIGUSR1
post = {{ apache_configuration.get('frontend-graceful-command') }}
sharedscripts = true
notifempty = true
create = true
......@@ -172,6 +172,10 @@ private-ipv4 = {{ local_ipv4 }}
{% if extra_slave_instance_list -%}
slave-instance-information-list = {{ json_module.dumps(slave_instance_information_list) }}
{% endif -%}
{% do connection_information_dict.pop('recipe') %}
{% for key, value in connection_information_dict.iteritems() -%}
{{ key }} = {{ value }}
{% endfor %}
{% do part_list.append('cached-rewrite-rules') -%}
[cached-rewrite-rules]
......
......@@ -120,9 +120,7 @@ SSLSessionCache shmcb:/{{ httpd_mod_ssl_cache_directory }}/ssl_scache(512000)
SSLSessionCacheTimeout 300
SSLRandomSeed startup /dev/urandom 256
SSLRandomSeed connect builtin
SSLProtocol -ALL +SSLv3 +TLSv1
SSLHonorCipherOrder On
SSLCipherSuite RC4-SHA:HIGH:!ADH
SSLProtocol ALL -SSLv2
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
......
......@@ -23,6 +23,8 @@ header_replace X-Forwarded-For
follow_x_forwarded_for allow all
forwarded_for on
cache_dir aufs {{ cache_path }} 5000 16 256
# Use 1Go of RAM
cache_mem 1024 MB
# But do not keep big object in RAM
......
#!${dash-output:dash}
{{ content }}
\ No newline at end of file
......@@ -60,6 +60,7 @@ cryptography = 0.4
itsdangerous = 0.24
meld3 = 1.0.0
mr.developer = 1.30
plone.recipe.command = 1.1
pyOpenSSL = 0.14
pyparsing = 2.0.2
six = 1.6.1
......@@ -70,11 +71,11 @@ slapos.recipe.template = 2.5
stevedore = 0.15
# Required by:
# slapos.core==1.0.5
# slapos.core==1.1.2
Flask = 0.10.1
# Required by:
# slapos.core==1.0.5
# slapos.core==1.1.2
cliff = 1.6.1
# Required by:
......@@ -87,7 +88,7 @@ lock-file = 2.0
# Required by:
# slapos.cookbook==0.87
# slapos.core==1.0.5
# slapos.core==1.1.2
# xml-marshaller==0.9.7
lxml = 3.3.5
......@@ -96,8 +97,12 @@ lxml = 3.3.5
netaddr = 0.7.11
# Required by:
# slapos.core==1.0.5
netifaces = 0.10.3
# slapos.core==1.1.2
netifaces = 0.10.4
# Required by:
# slapos.core==1.1.2
psutil = 2.1.1
# Required by:
# cffi==0.8.2
......@@ -105,18 +110,18 @@ pycparser = 2.10
# Required by:
# slapos.cookbook==0.87
pytz = 2014.2
pytz = 2014.3
# Required by:
# slapos.core==1.0.5
# slapos.core==1.1.2
requests = 2.3.0
# Required by:
# slapos.cookbook==0.87
slapos.core = 1.0.5
slapos.core = 1.1.2
# Required by:
# slapos.core==1.0.5
# slapos.core==1.1.2
supervisor = 3.0
# Required by:
......@@ -124,7 +129,7 @@ supervisor = 3.0
xml-marshaller = 0.9.7
# Required by:
# slapos.core==1.0.5
# slapos.core==1.1.2
zope.interface = 4.1.1
[networkcache]
......
......@@ -6,7 +6,7 @@
"type": "string"
},
"instance-amount": {
"description": "number of slappart to deploy inside the runner",
"description": "number of slappart to deploy inside the runner. Needs instance to be restarted.",
"type": "integer",
"default": 10
},
......@@ -14,7 +14,7 @@
"description": "a relative path from the slapos git repo to a folder containing a software release, which will be automaticaly deployed while the runner instanciation, and only if the parameter auto-deploy is set to 'true'. For example: 'software/helloworld",
"type": "string"
},
"auto-deploy": { "description": "authorizes the software declared with 'slapos-software' to be automatically deployed, or not",
"auto-deploy": { "description": "authorizes the software declared with 'slapos-software' to be automatically deployed, or not. Needs instance to be restarted.",
"type": "boolean",
"default": "false"
},
......@@ -29,12 +29,12 @@
"default": "master"
},
"auto-deploy-instance": {
"description": "prevent the runner from deploying and starting instances",
"description": "prevent the runner from deploying and starting instances. Needs instance to be restarted.",
"type": "boolean",
"default": "true, but is set to false for instances of type 'import' in resiliency"
},
"autorun": {
"description": "let automaticaly build and run a declared software with 'slapos-software'. Only works if 'slapos-software' is set, and 'auto-deploy' is true",
"description": "let automaticaly build and run a declared software with 'slapos-software'. Only works if 'slapos-software' is set, and 'auto-deploy' is true. Needs instance to be restarted.",
"type": "boolean",
"default": "false"
},
......
......@@ -11,22 +11,6 @@ allowed-eggs-from-site-packages =
include-site-packages = false
exec-sitecustomize = false
# Use only quite well working sites.
allow-hosts =
*.nexedi.org
*.python.org
*.sourceforge.net
alastairs-place.net
dist.repoze.org
effbot.org
github.com
peak.telecommunity.com
psutil.googlecode.com
www.dabeaz.com
www.owlfish.com
launchpad.net
bitbucket.org
extends =
../component/cups/buildout.cfg
../component/dbus/buildout.cfg
......@@ -109,17 +93,16 @@ lxml = 3.3.5
meld3 = 1.0.0
mr.developer = 1.30
netaddr = 0.7.11
netifaces = 0.10.3
netifaces = 0.10.4
plone.recipe.command = 1.1
psutil = 2.1.1
pyOpenSSL = 0.14
pyparsing = 2.0.2
python-magic = 0.4.6
pytz = 2014.2
pytz = 2014.3
rdiff-backup = 1.0.5
requests = 2.3.0
six = 1.6.1
slapos.core = 1.0.5
slapos.core = 1.1.2
slapos.recipe.build = 0.12
slapos.recipe.cmmi = 0.2
slapos.recipe.template = 2.5
......@@ -128,7 +111,7 @@ supervisor = 3.0
xml-marshaller = 0.9.7
# Required by:
# slapos.core==1.0.5
# slapos.core==1.1.2
Flask = 0.10.1
# Required by:
......@@ -138,7 +121,7 @@ PasteDeploy = 1.5.2
# Required by:
# cloudooo==1.2.5-dev
argparse = 1.1
argparse = 1.2.1
# Required by:
# cloudooo==1.2.5-dev
......@@ -148,11 +131,15 @@ erp5.util = 0.4.38
# slapos.cookbook==0.87
lock-file = 2.0
# Required by:
# slapos.core==1.1.2
psutil = 2.1.1
# Required by:
# cffi==0.8.2
pycparser = 2.10
# Required by:
# cloudooo==1.2.5-dev
# slapos.core==1.0.5
# slapos.core==1.1.2
zope.interface = 4.1.1
......@@ -172,7 +172,7 @@ context =
[template-mariadb]
< = template-jinja2-base
filename = instance-mariadb.cfg
md5sum = 49ae6f1bf97d3755978fe08b8e29fb5a
md5sum = e0c923a8195b5a36c7df766c1fb4bfdb
extra-context =
key coreutils_location coreutils:location
key dcron_location dcron:location
......@@ -590,9 +590,6 @@ Products.PluggableAuthService = 1.9.0
# --library-dirs, so we use our modified version
pysvn = 1.7.4nxd006
# use newest version of pytz
pytz =
# we are still using this old stable version.
rdiff-backup = 1.0.5
......@@ -600,7 +597,7 @@ rdiff-backup = 1.0.5
slapos.cookbook =
# we need to define an explicit version of slapos.core that is propagated to instances
slapos.core = 1.0.3
slapos.core = 1.1.2
# modified version that works fine for buildout installation
SOAPpy = 0.12.0nxd001
......@@ -622,8 +619,6 @@ zope.app.publication = 3.14.0
zope.app.testing = 3.8.1
# Pinned versions
Flask = 0.10.1
GitPython = 0.3.2.RC1
MarkupSafe = 0.23
MySQL-python = 1.2.5
PIL = 1.1.7
......@@ -635,8 +630,7 @@ Products.LongRequestLogger = 1.1.0
Products.MimetypesRegistry = 2.0.5
Products.PluginRegistry = 1.3
Products.TIDStorage = 5.4.9
Products.ZSQLMethods = 2.13.4
PyPDF2 = 1.21
PyPDF2 = 1.22
PyXML = 0.8.5
Pympler = 0.3.1
StructuredText = 2.11.1
......@@ -645,50 +639,35 @@ Werkzeug = 0.9.4
apache-libcloud = 0.14.1
astroid = 1.1.1
async = 0.6.1
atomize = 0.2.0
buildout-versions = 1.7
chardet = 2.2.1
cliff = 1.6.1
cmd2 = 0.6.7
csp-eventlet = 0.7.0
ecdsa = 0.11
elementtree = 1.2.7-20070827-preview
erp5.recipe.cmmiforcei686 = 0.1.3
erp5.util = 0.4.38
erp5diff = 0.8.1.5
eventlet = 0.14.0
feedparser = 5.1.3
five.formlib = 1.0.4
five.localsitemanager = 2.0.5
fpconst = 0.7.2
gitdb = 0.5.4
greenlet = 0.4.2
hexagonit.recipe.cmmi = 2.0
http-parser = 0.8.3
httplib2 = 0.9
iniparse = 0.4
inotifyx = 0.2.0-1
interval = 1.0.0
ipdb = 0.8
ipython = 2.0.0
ipython = 2.1.0
itsdangerous = 0.24
lock-file = 2.0
logilab-common = 0.61.0
meld3 = 1.0.0
minitage = 2.0.67
minitage.core = 2.0.57
minitage.paste = 1.4.6
minitage.recipe.common = 1.90
minitage.recipe.egg = 1.107
netaddr = 0.7.11
netifaces = 0.10.3
ordereddict = 1.1
paramiko = 1.14.0
plone.recipe.command = 1.1
ply = 3.4
polib = 1.0.4
pprofile = 1.7.2
psutil = 2.1.1
pycountry = 1.6
pyflakes = 0.8.1
pylint = 1.2.1
......@@ -696,11 +675,10 @@ pyparsing = 2.0.2
python-ldap = 2.4.15
python-magic = 0.4.6
python-memcached = 1.53
pytz = 2014.4
qrcode = 4.0.4
requests = 2.3.0
restkit = 4.2.2
rtjp-eventlet = 0.3.2
six = 1.6.1
slapos.recipe.build = 0.12
slapos.recipe.cmmi = 0.2
slapos.recipe.template = 2.5
......@@ -710,14 +688,113 @@ socketpool = 0.5.3
spyne = 2.10.10
stevedore = 0.15
suds = 0.4
supervisor = 3.0
threadframe = 0.2
timerserver = 2.0.2
urlnorm = 1.1.2
uuid = 1.30
validictory = 0.9.3
xml-marshaller = 0.9.7
xupdate-processor = 0.4
# Required by:
# slapos.core==1.1.2
# slapos.toolbox==0.39.2
Flask = 0.10.1
# Required by:
# slapos.toolbox==0.39.2
GitPython = 0.3.2.RC1
# Required by:
# Products.CMFCore==2.2.8
Products.ZSQLMethods = 2.13.4
# Required by:
# slapos.toolbox==0.39.2
atomize = 0.2.0
# Required by:
# slapos.core==1.1.2
cliff = 1.6.1
# Required by:
# paramiko==1.14.0
ecdsa = 0.11
# Required by:
# cloudooo==1.2.5-dev
erp5.util = 0.4.38
# Required by:
# slapos.toolbox==0.39.2
feedparser = 5.1.3
# Required by:
# SOAPpy==0.12.0nxd001
fpconst = 0.7.2
# Required by:
# erp5.recipe.cmmiforcei686==0.1.3
hexagonit.recipe.cmmi = 2.0
# Required by:
# minitage.recipe.egg==1.107
iniparse = 0.4
# Required by:
# minitage.core==2.0.57
minitage = 2.0.67
# Required by:
# minitage.recipe.common==1.90
# minitage.recipe.egg==1.107
minitage.core = 2.0.57
# Required by:
# minitage.recipe.egg==1.107
minitage.recipe.common = 1.90
# Required by:
# slapos.core==1.1.2
netifaces = 0.10.4
# Required by:
# minitage.recipe.egg==1.107
ordereddict = 1.1
# Required by:
# slapos.toolbox==0.39.2
paramiko = 1.14.0
# Required by:
# slapos.core==1.1.2
# slapos.toolbox==0.39.2
psutil = 2.1.1
# Required by:
# slapos.core==1.1.2
requests = 2.3.0
# Required by:
# qrcode==4.0.4
six = 1.6.1
# Required by:
# slapos.core==1.1.2
supervisor = 3.0
# Required by:
# slapos.toolbox==0.39.2
xml-marshaller = 0.9.7
# Required by:
# zope.app.testing==3.8.1
zope.app.debug = 3.4.1
# Required by:
# zope.app.testing==3.8.1
zope.app.dependable = 3.5.1
# Required by:
# Products.CMFCalendar==2.2.3
# five.formlib==1.0.4
zope.app.form = 4.0.2
......@@ -64,7 +64,6 @@ mysql-upgrade-binary = {{ mariadb_location }}/bin/mysql_upgrade
mysqld-binary = {{ mariadb_location }}/bin/mysqld
pt-align-binary = {{ perl_siteprefix }}/bin/pt-align
pt-archiver-binary = {{ perl_siteprefix }}/bin/pt-archiver
pt-collect-binary = {{ perl_siteprefix }}/bin/pt-collect
pt-config-diff-binary = {{ perl_siteprefix }}/bin/pt-config-diff
pt-deadlock-logger-binary = {{ perl_siteprefix }}/bin/pt-deadlock-logger
pt-diskstats-binary = {{ perl_siteprefix }}/bin/pt-diskstats
......@@ -77,12 +76,10 @@ pt-heartbeat-binary = {{ perl_siteprefix }}/bin/pt-heartbeat
pt-index-usage-binary = {{ perl_siteprefix }}/bin/pt-index-usage
pt-ioprofile-binary = {{ perl_siteprefix }}/bin/pt-ioprofile
pt-kill-binary = {{ perl_siteprefix }}/bin/pt-kill
pt-log-player-binary = {{ perl_siteprefix }}/bin/pt-log-player
pt-mext-binary = {{ perl_siteprefix }}/bin/pt-mext
pt-mysql-summary-binary = {{ perl_siteprefix }}/bin/pt-mysql-summary
pt-online-schema-change-binary = {{ perl_siteprefix }}/bin/pt-online-schema-change
pt-pmp-binary = {{ perl_siteprefix }}/bin/pt-pmp
pt-query-advisor-binary = {{ perl_siteprefix }}/bin/pt-query-advisor
pt-query-digest-binary = {{ perl_siteprefix }}/bin/pt-query-digest
pt-show-grants-binary = {{ perl_siteprefix }}/bin/pt-show-grants
pt-sift-binary = {{ perl_siteprefix }}/bin/pt-sift
......@@ -94,8 +91,6 @@ pt-summary-binary = {{ perl_siteprefix }}/bin/pt-summary
pt-table-checksum-binary = {{ perl_siteprefix }}/bin/pt-table-checksum
pt-table-sync-binary = {{ perl_siteprefix }}/bin/pt-table-sync
pt-table-usage-binary = {{ perl_siteprefix }}/bin/pt-table-usage
pt-tcp-model-binary = {{ perl_siteprefix }}/bin/pt-tcp-model
pt-trend-binary = {{ perl_siteprefix }}/bin/pt-trend
pt-upgrade-binary = {{ perl_siteprefix }}/bin/pt-upgrade
pt-variable-advisor-binary = {{ perl_siteprefix }}/bin/pt-variable-advisor
pt-visual-explain-binary = {{ perl_siteprefix }}/bin/pt-visual-explain
......
......@@ -6,41 +6,35 @@ extends =
../../component/dash/buildout.cfg
../../component/dcron/buildout.cfg
../../component/openssl/buildout.cfg
../../component/nginx/buildout.cfg
parts +=
backup-script-template
collective.recipe.template-egg
parts =
slapos-cookbook
dcron
download-static-files
eggs
monitor-eggs
extra-eggs
make-rss
monitor-bin
monitor-template
nginx
rss-bin
slapos-cookbook
static-folder
template-nginx-conf
[collective.recipe.template-egg]
[monitor-eggs]
recipe = zc.recipe.egg
eggs = collective.recipe.template
PyRSS2Gen
eggs =
collective.recipe.template
cns.recipe.symlink
[extra-eggs]
recipe = zc.recipe.egg
interpreter = pythonwitheggs
eggs =
PyRSS2Gen
Jinja2
[make-rss-script]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/make-rss.sh.in
md5sum = 8d3a4b212784b591316b8b93d6bd163e
output = ${buildout:directory}/make-rss.sh.in
md5sum = 98c8f6fd81e405b0ad10db07c3776321
output = ${buildout:directory}/template-make-rss.sh.in
mode = 0644
[monitor-template]
......@@ -48,14 +42,15 @@ recipe = slapos.recipe.template
url = ${:_profile_base_location_}/monitor.cfg.in
output = ${buildout:directory}/monitor.cfg
filename = monitor.cfg
md5sum = 4db2be5e8cabb5dd1d23743e0db5b02a
md5sum = bd592a0f0c41ec15c643c4e91e9ec5cc
mode = 0644
[monitor-bin]
recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/${:filename}
download-only = true
md5sum = 05bbb70f6f69dc4f3fa83dc0f8c9960e
md5sum = 1e7b4698f6627150b1eb783b06f8b13a
destination = ${buildout:directory}/parts/monitor-template-monitor-bin
filename = monitor.py.in
mode = 0644
......@@ -64,6 +59,7 @@ recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/webfiles/${:filename}
download-only = true
md5sum = 91ac749f86aecc0c383d93e51e15a572
destination = ${buildout:directory}/parts/monitor-index
filename = index.cgi.in
mode = 0644
......@@ -71,7 +67,8 @@ mode = 0644
recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/webfiles/${:filename}
download-only = true
md5sum = aa375a4225e2587b22f68c28cafd7871
destination = ${buildout:directory}/parts/monitor-template-index
md5sum = e0d2aaeffc046b2ac6d9d717e1ba321d
filename = index.html.jinja2
mode = 0644
......@@ -79,7 +76,8 @@ mode = 0644
recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/webfiles/${:filename}
download-only = true
md5sum = 4e5b7fc5c5c237836c7c81fe3e3bb903
md5sum = aa2764cab87e457410435974f729e906
destination = ${buildout:directory}/parts/monitor-template-status-cgi
filename = status.cgi.in
mode = 0644
......@@ -88,6 +86,7 @@ recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/webfiles/${:filename}
download-only = true
md5sum = 18574b804da0c65d8670959f9e7c4774
destination = ${buildout:directory}/parts/monitor-template-settings-cgi
filename = settings.cgi.in
mode = 0644
......@@ -95,7 +94,8 @@ mode = 0644
recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/${:filename}
download-only = true
md5sum = 427d5135ca475f2a4c4e69a0da6ed8c4
md5sum = 5f1b93ccdea7c3031aef396154c64938
destination = ${buildout:directory}/parts/monitor-template-rss-bin
filename = status2rss.py
mode = 0644
......@@ -108,18 +108,9 @@ logfile = $${directory:log}/crond.log
[download-static-files]
recipe = hexagonit.recipe.download
url = https://github.com/Sebatyne/staticForMonitoring/blob/3f0e93cec706c7ad311ddbf1ebf996965ce2f0a3/static-files.tar.gz?raw=true
url = https://github.com/SlapOS/staticForMonitoring/blob/db670e7568871c69a64916d462ccb57629f1c77d/static-files.tar.gz?raw=true
download-only = true
md5sum = e98585b85634de48240b2c215e946769
md5sum = 9e3feb2b520620d5b8d478eb9a9be6de
filename = static-files.tar.gz
destination = ${buildout:directory}/parts/monitor-static-files
mode = 0644
[eggs]
recipe = z3c.recipe.scripts
eggs =
slapos.cookbook
PyRSS2Gen
[versions]
PyRSS2Gen = 1.1
Jinja2 = 2.6
#!${dash-output:dash}
STATUS=$${monitor-parameters:result-dir}
RSS_FILE=$${monitor-parameters:rss-path}
STATUS_DB={{ monitor_parameters['db-path'] }}
RSS_FILE={{ monitor_parameters['rss-path'] }}
PYTHON=${buildout:directory}/bin/${extra-eggs:interpreter}
STATUS2RSS=${rss-bin:location}/${rss-bin:filename}
NAME=`basename $STATUS`
cat $STATUS/* | $PYTHON $STATUS2RSS "Monitoring RSS feed" "https://[$${slap-parameters:ipv6-random}]:$${monitor-parameters:port}/$${deploy-index:filename}" > $RSS_FILE
$PYTHON $STATUS2RSS "Monitoring RSS feed" "{{ monitor_parameters['url'] }}/{{ monitor_parameters['index-filename'] }}" $STATUS_DB > $RSS_FILE
This diff is collapsed.
......@@ -5,16 +5,21 @@ import json
import os
import subprocess
import sys
import sqlite3
import time
from optparse import OptionParser, make_option
FAILURE = "FAILURE"
SUCCESS = "SUCCESS"
db_path = "{{ monitor_parameter['db-path'] }}"
instance_path = "{{ directory['home'] }}"
monitor_dir = "{{ directory['monitor'] }}"
monitor_dir = "{{ directory['monitor-custom-scripts'] }}"
pid_dir = "{{ directory['run'] }}"
promise_dir = "{{ directory['promise'] }}"
monitoring_file_json = "{{ monitoring_file_json }}"
monitoring_folder_bool = "{{ monitoring_folder_bool }}"
option_list = [
make_option("-a", "--all", action="store_true", dest="all",
......@@ -30,16 +35,38 @@ option_list = [
]
def init_db():
db = sqlite3.connect(db_path)
c = db.cursor()
c.executescript("""
CREATE TABLE IF NOT EXISTS status (
timestamp INTEGER UNIQUE,
status VARCHAR(255));
CREATE TABLE IF NOT EXISTS individual_status (
timestamp INTEGER,
status VARCHAR(255),
element VARCHAR(255),
output TEXT);
""")
db.commit()
db.close()
def getListOfScripts(directory):
"""
Get the list of script inside of a directory (not recursive)
"""
scripts = []
if os.path.exists(directory) and os.path.isdir(directory):
for file in os.listdir(directory):
scripts.append(os.path.join(directory, file))
for file_name in os.listdir(directory):
file = os.path.join(directory, file_name)
if os.access(file, os.X_OK) and not os.path.isdir(file):
scripts.append(file)
else:
exit("There is a problem in your directories" \
"of monitoring. Please check them")
return scripts
def runServices(directory):
services = getListOfScripts(directory)
result = {}
......@@ -49,7 +76,8 @@ def runServices(directory):
try:
pid = int(open(service_path).read())
### because apache (or others) can write sockets
except IOError:
### We also ignore not readable pid files
except (IOError, ValueError):
continue
try:
os.kill(pid, 0)
......@@ -91,22 +119,28 @@ def runScripts(directory):
def writeFiles(monitors):
timestamp = int(time.time())
date = datetime.datetime.now().ctime()
init_db()
db = sqlite3.connect(db_path)
fail = False
for i in monitors.values():
if i != "" :
for key, value in monitors.iteritems():
element_status = SUCCESS
if value != "" :
fail = True
element_status = FAILURE
db.execute("insert into individual_status(timestamp, element, output, status) values (?, ?, ?, ?)", (timestamp, key, value, element_status))
db.commit()
status = SUCCESS
if fail:
message = "FAILURE : something went wrong\n"
else:
message = "SUCCESS : everything is ok\n"
date = datetime.datetime.now().ctime()
status = FAILURE
db.execute("insert into status(timestamp, status) values (?, ?)", (timestamp, status))
db.commit()
db.close()
monitors['datetime'] = date
file_bool = os.path.join(monitoring_folder_bool, str(time.time()))
open(file_bool, "w+").write(date + "," + message)
open(monitoring_file_json, "w+").write(json.dumps(monitors))
if __name__ == "__main__":
def main():
parser = OptionParser(option_list=option_list)
monitors = {}
(options, args) = parser.parse_args()
......@@ -131,3 +165,6 @@ if __name__ == "__main__":
else:
exit(1)
if __name__ == "__main__":
main()
import datetime
import PyRSS2Gen
import sys
from email.utils import parsedate_tz, mktime_tz
import sqlite3
import time
import base64
# Based on http://thehelpfulhacker.net/2011/03/27/a-rss-feed-for-your-crontabs/
......@@ -9,27 +10,36 @@ import base64
# ### Defaults
TITLE = sys.argv[1]
LINK = sys.argv[2]
db_path = sys.argv[3]
DESCRIPTION = TITLE
SUCCESS = "SUCCESS"
FAILURE = "FAILURE"
items = []
status = ""
while 1:
try:
line = sys.stdin.readline()
except KeyboardInterrupt:
break
current_timestamp = int(time.time())
# We only build the RSS for the last ten days
period = 3600 * 24 * 10
db = sqlite3.connect(db_path)
rows = db.execute("select timestamp, status from status where timestamp>? order by timestamp", (current_timestamp - period,))
for row in rows:
line_timestamp, line_status = row
line_status = line_status.encode()
if not line:
break
if line_status == status:
continue
time, desc = line.split(',', 1)
status = line_status
event_time = datetime.datetime.fromtimestamp(line_timestamp).strftime('%Y-%m-%d %H:%M:%S')
rss_item = PyRSS2Gen.RSSItem(
title = desc,
description = "%s, %s" % (time, desc),
title = status,
description = "%s: %s" % (event_time, status),
link = LINK,
pubDate = datetime.datetime.fromtimestamp(mktime_tz(parsedate_tz(time))),
guid = PyRSS2Gen.Guid(base64.b64encode("%s, %s" % (time, desc)))
pubDate = event_time,
guid = PyRSS2Gen.Guid(base64.b64encode("%s, %s" % (event_time, status)))
)
items.append(rss_item)
......
......@@ -17,6 +17,8 @@
<li><a href="{{ category }}/{{ script }}" class="script">{{ script }}</a></li>
{% endfor %}
{% endfor %}
<li class="pure-menu-heading category">Files</li>
<li><a href="./private/" class="link"> User: admin</br> Password is yours</a></li>
</ul>
</div>
</div>
......
#!{{ python_executable }}
import cgi
import cgitb
import json
import subprocess
def refresh():
command = ["{{ monitor_bin }}", "-a"]
subprocess.call(command)
cgitb.enable(display=0, logdir="/tmp/cgi.log")
form = cgi.FieldStorage()
if "refresh" in form:
refresh()
json_file = "{{ json_file }}"
result = json.load(open(json_file))
......@@ -13,8 +22,12 @@ print "<link rel=\"stylesheet\" href=\"pure-min.css\">"
print "<link rel=\"stylesheet\" href=\"/style.css\">"
print "</head><body>"
print "<h1>Monitoring :</h1>"
print "<form action=\"/index.cgi\" method=\"post\" class=\"pure-form-aligned\">"
print "<input type=\"hidden\" name=\"posting-script\" value=\"{{ pwd }}/{{ this_file }}\">"
print "<p><em>Last time of monitoring process : %s</em></p>" % (result['datetime'])
del result['datetime']
print "<div class=\"pure-controls\"><button type=\"submit\" class=\"pure-button \
pure-button-primary\" name=\"refresh\" value=\"refresh\">Refresh</button></div></form>"
print "<br/>"
print "<h2>These scripts and promises have failed :</h2>"
......
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