[buildout]

extends =
  ../../component/apache/buildout.cfg
  ../../component/curl/buildout.cfg
  ../../component/dash/buildout.cfg
  ../../component/dcron/buildout.cfg
  ../../component/openssl/buildout.cfg

parts =
  slapos-cookbook
  dcron
  monitor-eggs
  extra-eggs
  monitor-conf
  monitor-bin
  monitor-web-index-html
  monitor-web-monitor-css
  monitor-web-monitor-js
  monitor-web-monitor-logout-cgi
  monitor-web-monitor-logout-page
  monitor-template
  rss-bin

[monitor-download-base]
recipe = hexagonit.recipe.download
download-only = true
url = ${:_profile_base_location_}/${:filename}
mode = 0644

[monitor-eggs]
recipe = zc.recipe.egg
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 = 98c8f6fd81e405b0ad10db07c3776321
output = ${buildout:directory}/template-make-rss.sh.in
mode = 0644

[monitor-conf]
<= monitor-download-base
filename = monitor.conf.in
md5sum = 2db5c08c7e8658981b4b1e3f27fd5967

[monitor-bin]
<= monitor-download-base
filename = monitor.py.in
md5sum = cc2f9c6b138ce11af9999ed58cd46799

[monitor-web-index-html]
<= monitor-download-base
filename = index.html
md5sum = 262db07691c145301252a49b6b51d11d

[monitor-web-monitor-css]
<= monitor-download-base
filename = monitor.css
md5sum = a18ab932e5e2e656995f47c7d4a7853a

[monitor-web-monitor-js]
<= monitor-download-base
filename = monitor.js.in
md5sum = 8bc4b8368a752f90da2571866768e81f

[monitor-web-monitor-logout-cgi]
<= monitor-download-base
filename = monitor-logout.sh.cgi
md5sum = 1daf20f1d6c025e33c608fd9c390e057
mode = 0755

[monitor-web-monitor-logout-page]
<= monitor-download-base
filename = monitor-logout.html
md5sum = b210c6842df541305d299081bc1bf81e

[monitor-template]
recipe = slapos.recipe.template:jinja2
filename = template-monitor.cfg
template = ${:_profile_base_location_}/instance-monitor.cfg.jinja2.in
rendered = ${buildout:directory}/template-monitor.cfg
md5sum = 794e7fd74bca86ea5e74a29cde21b836
context =
    key apache_location apache:location
    key gzip_location gzip:location
    raw monitor_bin ${monitor-bin:location}/${monitor-bin:filename}
    raw monitor_conf_template ${monitor-conf:location}/${monitor-conf:filename}
    raw monitor_web_index_html ${monitor-web-index-html:location}/${monitor-web-index-html:filename}
    raw monitor_web_monitor_css ${monitor-web-monitor-css:location}/${monitor-web-monitor-css:filename}
    raw monitor_web_monitor_logout_cgi ${monitor-web-monitor-logout-cgi:location}/${monitor-web-monitor-logout-cgi:filename}
    raw monitor_web_monitor_logout_page ${monitor-web-monitor-logout-page:location}/${monitor-web-monitor-logout-page:filename}
    raw monitor_web_monitor_js ${monitor-web-monitor-js:location}/${monitor-web-monitor-js:filename}
    raw curl_executable_location ${curl:location}/bin/curl
    raw dash_executable_location ${dash:location}/bin/dash
    raw dcron_executable_location ${dcron:location}/sbin/crond
    raw logrotate_executable_location ${logrotate:location}/usr/sbin/logrotate
    raw monitor_httpd_template ${monitor-httpd-conf:location}/${monitor-httpd-conf:filename}
    raw monitor_service_run ${monitor-service-template-run:location}/${monitor-service-template-run:filename}
    raw monitor_service_template_conf ${monitor-service-template-conf:location}/${monitor-service-template-conf:filename}
    raw openssl_executable_location ${openssl:location}/bin/openssl
    raw python_executable ${buildout:executable}
    raw promise_executor_py ${run-promise-py:location}/${run-promise-py:filename}
    raw template_wrapper ${template-wrapper:output}

[monitor-httpd-conf]
recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/templates/${:filename}
download-only = true
md5sum = 5be55c3918daa9cc9f8425bfc40e70b1
filename = monitor-httpd.conf.in
mode = 0644

[monitor-service-template-conf]
recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/templates/${:filename}
download-only = true
md5sum = 24885347932935fac93e8bc2a80ec7a2
filename = monitor-service.conf.in
mode = 0644

[monitor-service-template-run]
recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/templates/${:filename}
download-only = true
md5sum = d5f29fa859a45696e1ff1bb174ab1111
filename = monitor-service-run.in
mode = 0644

[monitor-html-static]
recipe = slapos.recipe.build:download-unpacked
url = https://nexedi.erp5.net/monitor-5c66a4518b466d45cb31cb7e8a225cde20247589.tar.gz
#md5sum
strip-top-level-dir = true

[run-promise-py]
<= monitor-download-base
filename = run-promise.py
md5sum = 6db26ce13becf8a190e34c14cb8b6f9f

[monitor-httpd-template]
recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/${:filename}
download-only = true
md5sum = 93e1dda50cb71bfe29966b2946c02dd1
filename = cgi-httpd.conf.in
mode = 0644

[index]
recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/webfile-directory/${:filename}
download-only = true
md5sum = e759977b21c70213daa4c2701f2c2078
destination = ${buildout:parts-directory}/monitor-index
filename = index.cgi.in
mode = 0644

[index-template]
recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/webfile-directory/${:filename}
download-only = true
destination = ${buildout:parts-directory}/monitor-template-index
md5sum = 7400c8cfa16a15a0d41f512b8bbb1581
filename = index.html.jinja2
mode = 0644

[status-cgi]
recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/webfile-directory/${:filename}
download-only = true
md5sum = e43d79bec8824265e22df7960744113a
destination = ${buildout:parts-directory}/monitor-template-status-cgi
filename = status.cgi.in
mode = 0644

[status-history-cgi]
recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/webfile-directory/${:filename}
download-only = true
#md5sum = 4fb26753ee669b8ac90ffe33dbd12e8f
destination = ${buildout:parts-directory}/monitor-template-status-history-cgi
filename = status-history.cgi.in
mode = 0644

[settings-cgi]
recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/webfile-directory/${:filename}
download-only = true
md5sum = b4cef123a3273e848e8fe496e22b20a8
destination = ${buildout:parts-directory}/monitor-template-settings-cgi
filename = settings.cgi.in
mode = 0644

[monitor-password-cgi]
recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/webfile-directory/${:filename}
download-only = true
md5sum = c7ba7ecb09d0d1d24e7cb73a212cc33f
destination = ${buildout:parts-directory}/monitor-template-monitor-password-cgi
filename = monitor-password.cgi.in
mode = 0644

[rss-bin]
recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/${:filename}
download-only = true
md5sum = 6c84a826778cb059754623f39b33651b
destination = ${buildout:parts-directory}/monitor-template-rss-bin
filename = status2rss.py
mode = 0644

[dcron-service]
recipe = slapos.recipe.template
url = ${template-dcron-service:output}
output = $${directory:services}/crond
mode = 0700
logfile = $${directory:log}/crond.log

[download-monitor-static]
recipe = hexagonit.recipe.download
url = http://git.erp5.org/gitweb/slapos.git/snapshot/930be99041ea26b7b1186830e5eb56ef0acc1bdf.tar.gz
download-only = false
filename = monitor-static.tar.gz
destination = ${buildout:parts-directory}/monitor-static-files
ignore-existing = true
strip-top-level-dir = true
mode = 0644

[download-monitor-jquery]
recipe = hexagonit.recipe.download
url = http://code.jquery.com/jquery-1.10.2.min.js
download-only = true
destination = ${download-monitor-static:destination}
filename = jquery-1.10.2.min.js
mode = 0644

[template-wrapper]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/wrapper.in
output = ${buildout:directory}/template-wrapper.cfg
mode = 0644
md5sum = 8cde04bfd0c0e9bd56744b988275cfd8