[buildout]

parts =
  publish-connection-informations
  cron
  certificate-authority
  cron-entry-monitor
  cron-entry-rss
  deploy-index
  deploy-settings-cgi
  deploy-status-cgi
  deploy-status-history-cgi
  setup-static-files
  certificate-authority
  zero-parameters
  public-symlink
  cgi-httpd-wrapper
  cgi-httpd-graceful-wrapper
  monitor-promise
  monitor-instance-log-access
  cron-rsync-logs
  
extends = ${monitor-template:output}


eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
offline = true

[cron-rsync-logs]
<= cron
recipe = slapos.cookbook:cron.d
name = rsync-logs
frequency = * * * * *
command = $${rsync-logs:rendered}

[rsync-logs]
recipe = slapos.recipe.template:jinja2
template = ${rsync-logs-script:output}
rendered = $${monitor-directory:bin}/rsync-logs.sh
mode = 0744
context =
  key buildout_directory buildout:directory
  raw rsync_binary ${rsync:location}/bin/rsync
  key server_log_directory monitor-directory:server-log 

[pwgen]
recipe = slapos.cookbook:generate.password
user = admin
bytes = 16

[pwgen32]
recipe = slapos.cookbook:generate.password
user = admin
bytes = 16


[monitor-directory]
server-log = $${:private-directory}/server-log
cache = $${:var}/cache
mod-ssl = $${:cache}/httpd_mod_ssl

[slap-parameter]
private-hash = $${pwgen:passwd}$${pwgen32:passwd}
frontend-domain = 

[monitor-frontend]
<= slap-connection
recipe = slapos.cookbook:requestoptional
name = Monitor Frontend
# XXX We have hardcoded SR URL here.
software-url = http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD:/software/apache-frontend/software.cfg
slave = true
config = url domain
config-url = $${monitor-parameters:url}
config-domain = $${slap-parameter:frontend-domain}
return = site_url domain

[publish-connection-informations]
recipe = slapos.cookbook:publish
monitor_url = $${monitor-parameters:url}
server_log_url = $${:url}$${slap-parameter:private-hash}/ 
url = $${monitor-frontend:connection-site_url}

[monitor-httpd-configuration-file]
context =
  section directory monitor-directory
  section monitor_parameters monitor-parameters
  section httpd_configuration monitor-httpd-configuration
  section monitor_rewrite_rule monitor-rewrite-rule
  key monitor_private_hash slap-parameter:private-hash  
