[buildout]

extends =
  buildout.hash.cfg
  ../../component/apache/buildout.cfg
  ../../component/curl/buildout.cfg
  ../../component/dash/buildout.cfg
  ../../component/openssl/buildout.cfg
  ../../component/lxml-python/buildout.cfg
  ../../component/pycurl/buildout.cfg
  ../../component/python-cryptography/buildout.cfg
  ../../stack/logrotate/buildout.cfg

parts =
  slapos-cookbook
  monitor-eggs
  extra-eggs
  monitor2-template

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

[monitor-template-base]
<= monitor-download-base
url = ${:_profile_base_location_}/templates/${:filename}

[monitor-template-script]
<= monitor-download-base
url = ${:_profile_base_location_}/scripts/${:filename}
destination = ${buildout:parts-directory}/monitor-scripts
on-update = true

[monitor-eggs]
recipe = zc.recipe.egg
eggs =
  ${lxml-python:egg}
  ${pycurl:egg}
  ${python-cryptography:egg}
  plone.recipe.command
  collective.recipe.template
  cns.recipe.symlink
  slapos.toolbox
  slapos.core

# Do no generate any scripts here as all of them are generated by extraeggs
scripts =

[extra-eggs]
recipe = zc.recipe.egg
interpreter = pythonwitheggs
eggs =
  ${monitor-eggs:eggs}
  psutil
  PyRSS2Gen
  Jinja2


# Monitor templates files
[monitor-httpd-conf]
<= monitor-template-base
md5sum = b5f42503799e7e770afce4097d3b75ae
filename = monitor-httpd.conf.in

[monitor-template-wrapper]
<= monitor-template-base
filename = wrapper.in
md5sum = 1695c9a06a2b11ccfe893d7a224e489d

[monitor-conf]
<= monitor-template-base
filename = monitor.conf.in
md5sum = 91c4c9bba1f7df788b9b7a059ed89ac2

[monitor-httpd-cors]
<= monitor-template-base
filename = httpd-cors.cfg.in
md5sum = 683ea85fc054094248baf5752dd089bf
# End templates files

# XXX keep compatibility (with software/ipython_notebook/software.cfg )
[monitor-template]
rendered = ${monitor2-template:rendered}
output = ${monitor2-template:rendered}

[monitor2-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
context =
    key apache_location apache:location
    key gzip_location gzip:location
    key template_logrotate_base template-logrotate-base:rendered
    raw monitor_bin ${buildout:directory}/bin/monitor.bootstrap
    raw monitor_collect ${buildout:directory}/bin/monitor.collect
    raw monitor_statistic ${buildout:directory}/bin/monitor.statistic
    raw monitor_runpromise ${buildout:directory}/bin/monitor.runpromise
    raw monitor_genstatus ${buildout:directory}/bin/monitor.genstatus
    raw monitor_configwrite ${buildout:directory}/bin/monitor.configwrite
    raw monitor_conf_template ${monitor-conf:location}/${monitor-conf:filename}
    raw monitor_https_cors ${monitor-httpd-cors:location}/${monitor-httpd-cors: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 openssl_executable_location ${openssl:location}/bin/openssl
    raw python_executable ${buildout:executable}
    raw python_with_eggs ${buildout:directory}/bin/${extra-eggs:interpreter}
    raw template_wrapper ${monitor-template-wrapper:location}/${monitor-template-wrapper:filename}
    raw check_disk_space ${buildout:directory}/bin/check-free-disk
    raw bin_directory ${buildout:directory}/bin
depends = 
  ${monitor-eggs:eggs}

[versions]
cns.recipe.symlink = 0.2.3
pyasn1 = 0.3.7

