[buildout]

parts = 
  redis
  bonjourgrid
  boinc-server
  certificate-authority
  ca-stunnel
  logrotate
  logrotate-entry-apache
  logrotate-entry-stunnel
  cron
  cron-entry-logrotate
  cron-entry-boinc
  promise
  frontend-promise
  content-promise
  publish-connection-informations
  boinc-app
  condor
  app-submit

extends = 
  ${template-condor:output}
  ${template-boinc:output}
  ${template-redis:output}

[rootdirectory]
recipe = slapos.cookbook:mkdirectory
etc = $${buildout:directory}/etc/
srv = $${buildout:directory}/srv/
var = $${buildout:directory}/var/
bin = $${buildout:directory}/bin/

[basedirectory]
recipe = slapos.cookbook:mkdirectory
scripts = $${rootdirectory:etc}/run/
log = $${rootdirectory:var}/log/
run = $${rootdirectory:var}/run/
backup = $${rootdirectory:srv}/backup/
promises = $${rootdirectory:etc}/promise/
bonjourgrid = $${rootdirectory:etc}/bonjourgrid.d/
bg_base = $${rootdirectory:srv}/bonjourgrid/
condor = $${rootdirectory:etc}/condor/
boinc = $${rootdirectory:etc}/boinc/

#Override Boinc server part with custom variables for BonjourGrid
#Change the wrapper directory to /bin/boinc/
[boinc-server]
wrapper-dir = $${basedirectory:boinc}

[condor]
#Change default wrapper dir to /etc/condor/
wrapper-dir = $${basedirectory:condor}

[bonjourgrid]
recipe = slapos.cookbook:bonjourgrid
master_script = ${bonjourgrid:location}/BonjourGridMaster.py
work_dir = $${basedirectory:bg_base}
install_dir = ${bonjourgrid:location}
condor-wrapper = $${condor:wrapper-dir}
boinc-wrapper = $${boinc-server:wrapper-dir}
boinc_condor_wrapper = $${basedirectory:bonjourgrid}/bonjourGrid
wrapper = $${basedirectory:services}/bonjourGrid
log_file = $${basedirectory:log}/bonjourgrid.log
pid_file = $${basedirectory:run}/bonjourgrid.pid
nworkers = $${slap-parameter:worker-number}
redis-url = $${slap-parameter:server-url}
redis-port = $${slap-parameter:server-port}
redis-passwd = $${slap-parameter:server-password}
type = $${slap-parameter:project-type}
python-bin = ${buildout:executable}

url-boinc = $${boinc-app:url-base}$${boinc-app:project}/
condor_host = $${slap-parameter:condor-host}
ipv6 = $${condor:ip}

[publish-connection-informations]
bg_instance_type = $${slap-parameter:project-type}
condor_ipv6_address = $${condor:ip}
condor_instance_type = $${condor:machine-role}
condor_host = $${condor:condor_host}
redis_ip = $${bonjourgrid:redis-url}
redis_port = $${bonjourgrid:redis-port}
redis_passwd = $${bonjourgrid:redis-passwd}
redis_uses_password = $${redis:use_passwd}

[slap-parameter]
project = bonjourgrid
server-url = $${redis:ipv6}
server-port = $${redis:port}
server-password = $${redis:passwd}
worker-number = 1
#specified if we want to run BOINC or Condor project:
#project-type = boinc | condor
project-type = boinc
###Condor Parameters #####
condor-host = [$${slap-network-information:global-ipv6}]
condor-collector-name = SLAPOS-CONDOR-POOL
condor-role = manager
condor-diskspace = 5
condor-admin-email = 
condor-allowed-write = $${:condor-host}
#submit application, using Json application list
condor-app-list = ${condor-application:list}
###Redis Parameters####
use_passwd = false
###BOINC parameters --Refer to Boinc Stack######