[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/python-cryptography/buildout.cfg
  ../../stack/logrotate/buildout.cfg
  ../../stack/slapos.cfg

parts =
  slapos-cookbook
  monitor-eggs
  monitor2-template

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

[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
interpreter = monitor-pythonwitheggs
eggs =
  plone.recipe.command
  collective.recipe.template
  cns.recipe.symlink
  psutil
  PyRSS2Gen
  Jinja2
depends =
  ${slapos-toolbox:recipe}


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

[monitor-template-wrapper]
<= monitor-download-base
filename = wrapper.in

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

[monitor-httpd-cors]
<= monitor-download-base
filename = httpd-cors.cfg.in
# 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 template_logrotate_base template-logrotate-base:rendered
    raw monitor_bin ${buildout:bin-directory}/monitor.bootstrap
    raw monitor_collect ${buildout:bin-directory}/monitor.collect
    raw monitor_statistic ${buildout:bin-directory}/monitor.statistic
    raw monitor_runpromise ${buildout:bin-directory}/monitor.runpromise
    raw monitor_genstatus ${buildout:bin-directory}/monitor.genstatus
    raw monitor_configwrite ${buildout:bin-directory}/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:bin-directory}/${monitor-eggs:interpreter}
    raw template_wrapper ${monitor-template-wrapper:location}/${monitor-template-wrapper:filename}
    raw check_disk_space ${buildout:bin-directory}/check-free-disk
    raw bin_directory ${buildout:directory}/bin

[versions]
cns.recipe.symlink = 0.2.3