[buildout]

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

extends =
    ${instance-postgres:output}
    ${instance-extranet:output}
    ${instance-redis:output}
    ${instance-environment:output}

parts =
    directories
    json-configuration
    json-extra-configuration
    sh-instance-environment
    postgres-instance
    postgres-promise
    extranet-symlinks
    extranet-service
    extranet-promise
    config-staging-py
    request-web-frontend
    publish-connection-parameters
    redis
    cron
    postgres-backup
    cron-postgres-backup




[json-configuration]
recipe = slapos.cookbook:slapconfiguration.jsondump
json-output = $${buildout:directory}/partition-parameters.json
computer = $${slap-connection:computer-id}
partition = $${slap-connection:partition-id}
url = $${slap-connection:server-url}
key = $${slap-connection:key-file}
cert = $${slap-connection:cert-file}


[json-extra-configuration]
recipe = slapos.cookbook:jsondump
json-output = $${buildout:directory}/abilian-config-extra.json
UNOCONV_LOCATION = ${unoconv-repository:location}/unoconv
BROKER_URL = redis://:$${redis-requirepass:passwd}@[$${redis:ipv4}]:$${redis:port}/2
CELERY_RESULT_BACKEND = redis://:$${redis-requirepass:passwd}@[$${redis:ipv4}]:$${redis:port}/2
SECRET_KEY = $${csrf-secret-key:passwd}
INSTANCE_HOST = $${instance-parameters:ipv6-random}




#----------------
#-- Instance-level buildout profiles.

[instance]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg.in
output = ${buildout:directory}/instance.cfg
md5sum = d8b833a2054b82b6031a9420008b58fd
mode = 0644



[directories]
recipe = slapos.cookbook:mkdirectory
bin = $${buildout:directory}/bin
etc = $${buildout:directory}/etc
cron-entries = $${:etc}/cron.d
crontabs = $${:etc}/crontabs
cronstamps = $${:etc}/cronstamps
run = $${:var}/run
scripts = $${:etc}/run
srv = $${buildout:directory}/srv
services = $${:etc}/service
promises = $${:etc}/promise
var = $${buildout:directory}/var
backup = $${:var}/backup
extranet_spr-instance = $${:var}/extranet_spr-instance
cache = $${:extranet_spr-instance}/cache
data = $${:extranet_spr-instance}/data
log = $${:var}/log
tmp = $${:var}/tmp
whoosh = $${:data}/whoosh


[cron-simplelogger]
recipe = slapos.cookbook:simplelogger
wrapper = $${directories:bin}/cron_simplelogger
log = $${directories:log}/cron.log


[cron]
recipe = slapos.cookbook:cron
dcrond-binary = ${dcron:location}/sbin/crond
cron-entries = $${directories:cron-entries}
crontabs = $${directories:crontabs}
cronstamps = $${directories:cronstamps}
catcher = $${cron-simplelogger:wrapper}
binary = $${directories:services}/crond



[request-web-frontend]
<= slap-connection
recipe = slapos.cookbook:requestoptional
name = Web 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
config-url = https://[$${instance-parameters:ipv6-random}]:$${extranet-promise:port}
return = site_url


[publish-connection-parameters]
recipe = slapos.cookbook:publish
url = $${request-web-frontend:connection-site_url}
ipv6_url = http://[$${instance-parameters:ipv6-random}]:$${extranet-promise:port}/
postgres_host = $${postgres-promise:hostname}
postgres_port = $${postgres-promise:port}