[buildout]
# XXX THIS STACK IS A KIND OF FORK OF `stack/monitor`. THIS ONE WAS
#     CREATED AS A REDESIGNED ONE TO REMOVE UNWANTED FEATURES AND
#     TO GO FURTHER TO THE GOOD DESIGN DIRECTION. SEE THE README FOR
#     MORE INFORMATION.

extends =
  ../../component/apache/buildout.cfg
  ../../component/curl/buildout.cfg
  ../../component/dash/buildout.cfg
  ../../component/dcron/buildout.cfg
  ../../component/openssl/buildout.cfg
  ../../component/logrotate/buildout.cfg
  ../../component/gzip/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-web-base]
<= monitor-download-base
url = ${:_profile_base_location_}/web/${:filename}
destination = ${buildout:parts-directory}/monitor-web
on-update = true

[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 =
  collective.recipe.template
  cns.recipe.symlink

[extra-eggs]
<= monitor-eggs
interpreter = pythonwitheggs
eggs =
  psutil
  PyRSS2Gen
  Jinja2


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

[monitor-service-conf-template]
<= monitor-template-base
filename = monitor-service.cfg.in
md5sum = 5913d2a0096b50537f394a49b762b3e5

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

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

[monitor-instance-info]
<= monitor-template-base
filename = instance-info.conf.in
md5sum = 1bdb4e05c6be04f4e5766c64467fbcec

[monitor-httpd-cors]
<= monitor-template-base
filename = httpd-cors.cfg.in
md5sum = 5afad2bb6e088e080e907f1d837effbb
# 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
md5sum = 9d6f50e616655c1ae11ace419ac2861e  
context =
    key apache_location apache:location
    key gzip_location gzip:location
    raw monitor_bin ${monitor2-bin:location}/${monitor2-bin:filename}
    raw monitor_collect ${monitor-collect:location}/${monitor-collect:filename}
    raw monitor_conf_template ${monitor-conf:location}/${monitor-conf:filename}
    raw monitor_document_edit ${monitor-document-edit:location}/${monitor-document-edit:filename}
    raw monitor_https_cors ${monitor-httpd-cors:location}/${monitor-httpd-cors:filename}
    raw monitor_instance_info ${monitor-instance-info:location}/${monitor-instance-info:filename}
    raw monitor_globalstate ${monitor-globalstate:location}/${monitor-globalstate:filename}
    raw monitor_password_promise_template ${monitor-password-promise:location}/${monitor-password-promise: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_conf_template ${monitor-service-conf-template:location}/${monitor-service-conf-template: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 promise_executor_py ${run-promise-py:rendered}
    raw template_wrapper ${monitor-template-wrapper:location}/${monitor-template-wrapper:filename}
    raw status2rss_executable_path ${status2rss-executable:location}/${status2rss-executable:filename}
depends = 
  ${monitor-eggs:eggs}


[monitor2-bin]
<= monitor-template-script
filename = monitor.py
md5sum = 280412f9024030c8cae343c2b07e5130

[run-promise-py]
recipe = slapos.recipe.template:jinja2
template = ${:_profile_base_location_}/scripts/run-promise.py
rendered = ${buildout:parts-directory}/monitor-scripts/run-promise.py
md5sum = 2570b11cd1f718f240a9c7a05ffa861d
mode = 0755
context =
  raw python ${buildout:directory}/bin/${extra-eggs:interpreter}

[monitor-password-promise]
<= monitor-template-script
filename = monitor-password-promise.py
md5sum = f7e937d6619eb674f39f34718928d91d

[status2rss-executable]
<= monitor-template-script
filename = status2rss.py
md5sum = f297779d0881f4bd48081506efb492a4

[monitor-globalstate]
<= monitor-template-script
filename = globalstate.py
md5sum = 1ebead4480d62d5e1d2612c2d9f4e1d8

[monitor-collect]
<= monitor-template-script
filename = collect.py
md5sum = 78fbcb56761315bde354fe7914d3c54f

[monitor-document-edit]
<= monitor-template-script
filename = monitor-document.py
md5sum = f3e557e5d81291a22d6d2837a9e37bd0


[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
