[buildout]
extends =
  buildout.hash.cfg
  ../../stack/slapos.cfg
  ../../component/dash/buildout.cfg
  ../../component/caddy/buildout.cfg
  ../../component/gzip/buildout.cfg
  ../../component/logrotate/buildout.cfg
  ../../component/trafficserver/buildout.cfg
  ../../component/6tunnel/buildout.cfg
  ../../component/xz-utils/buildout.cfg
  ../../component/rsyslogd/buildout.cfg
  ../../component/numpy/buildout.cfg
  ../../component/haproxy/buildout.cfg
  ../../component/nginx/buildout.cfg

  ../../stack/caucase/buildout.cfg

parts +=
  caucase-eggs
  template
  software-install
  kedifa

[kedifa]
recipe = zc.recipe.egg
eggs =
  ${python-cryptography:egg}
  kedifa

[software-setup]
recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/setup.py

[software-py]
recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/software.py

[software-prepare]
recipe = plone.recipe.command
stop-on-error = True
location = ${buildout:parts-directory}/${:_buildout_section_name_}
update-command = ${:command}
command =
  rm -fr ${:location} &&
  mkdir -p ${:location} &&
  cp ${software-setup:target} ${:location}/ &&
  cp ${software-py:target} ${:location}/

[software-develop]
recipe = zc.recipe.egg:develop
setup = ${software-prepare:location}

[software-install]
depends = ${software-develop:recipe}
recipe = zc.recipe.egg
eggs =
  software
  websockify

[profile-common]
recipe = slapos.recipe.template:jinja2
url = ${:_profile_base_location_}/instance-common.cfg.in
output = ${buildout:directory}/instance-common.cfg
context =
  key develop_eggs_directory buildout:develop-eggs-directory
  key eggs_directory buildout:eggs-directory

[software-parameter-section]
# libraries
caucase_jinja2_library = ${caucase-jinja2-library:target}

# profiles
profile_frontend = ${profile-frontend:target}
profile_master = ${profile-master:target}
profile_common = ${profile-common:output}
profile_kedifa = ${profile-kedifa:target}
profile_logrotate_base = ${template-logrotate-base:output}
profile_monitor = ${monitor-template:output}
profile_monitor2 = ${monitor2-template:output}
profile_master_publish_slave_information = ${profile-master-publish-slave-information:target}
profile_slave_list = ${profile-slave-list:target}

# templates
template_backend_haproxy_configuration = ${template-backend-haproxy-configuration:target}
template_backend_haproxy_rsyslogd_conf = ${template-backend-haproxy-rsyslogd-conf:target}
template_caddy_frontend_configuration = ${template-caddy-frontend-configuration:target}
template_lazy_script_call = ${template-lazy-script-call:target}
template_configuration_state_script = ${template-configuration-state-script:target}
template_default_slave_virtualhost = ${template-default-slave-virtualhost:target}
template_empty = ${template-empty:target}
template_graceful_script = ${template-graceful-script:target}
template_not_found_html = ${template-not-found-html:target}
template_rotate_script = ${template-rotate-script:target}
template_slave_introspection_httpd_nginx = ${template-slave-introspection-httpd-nginx:target}
template_trafficserver_logging_yaml = ${template-trafficserver-logging-yaml:target}
template_trafficserver_records_config = ${template-trafficserver-records-config:target}
template_trafficserver_storage_config = ${template-trafficserver-storage-config:target}
template_validate_script = ${template-validate-script:target}
template_wrapper = ${template-wrapper:output}
template_expose_csr_nginx_conf = ${template-expose-csr-nginx-conf:target}

# directories
bin_directory = ${buildout:bin-directory}

# files
sixtunnel = ${6tunnel:location}
nginx = ${nginx-output:nginx}
nginx_mime = ${nginx-output:mime}
caddy = ${caddy:output}
haproxy_executable = ${haproxy:location}/sbin/haproxy
rsyslogd_executable = ${rsyslogd:location}/sbin/rsyslogd
curl = ${curl:location}
dash = ${dash:location}
gzip = ${gzip:location}
logrotate = ${logrotate:location}
openssl = ${openssl:location}/bin/openssl
openssl_cnf = ${openssl:location}/etc/ssl/openssl.cnf
trafficserver = ${trafficserver:location}
sha256sum = ${coreutils:location}/bin/sha256sum
kedifa = ${:bin_directory}/kedifa
kedifa-updater = ${:bin_directory}/kedifa-updater
kedifa-csr = ${:bin_directory}/kedifa-csr
xz_location = ${xz-utils:location}
htpasswd = ${:bin_directory}/htpasswd
smart_caucase_signer = ${:bin_directory}/smart-caucase-signer
caucase_csr_sign_check = ${:bin_directory}/caucase-csr-sign-check

[template]
recipe = slapos.recipe.template:jinja2
url = ${:_profile_base_location_}/instance.cfg.in
output = ${buildout:directory}/template.cfg
context =
  section software_parameter_dict software-parameter-section

[download-profile]
recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/${:filename}

[profile-frontend]
<= download-profile

[profile-master]
<= download-profile

[profile-kedifa]
<= download-profile

[profile-slave-list]
<= download-profile

[profile-master-publish-slave-information]
<= download-profile

[download-template]
recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/${:_update_hash_filename_}

[template-caddy-frontend-configuration]
<=download-template

[template-not-found-html]
<=download-template

[template-default-slave-virtualhost]
<=download-template

[template-backend-haproxy-configuration]
<=download-template

[template-empty]
<=download-template

[template-slave-introspection-httpd-nginx]
<=download-template

[template-wrapper]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/templates/wrapper.in
output = ${buildout:directory}/template-wrapper.cfg

[template-trafficserver-records-config]
<=download-template

[template-trafficserver-storage-config]
<=download-template

[template-trafficserver-logging-yaml]
<=download-template

[template-rotate-script]
<=download-template

[template-lazy-script-call]
<=download-template

[template-graceful-script]
<=download-template

[template-validate-script]
<=download-template

[template-configuration-state-script]
<=download-template

[template-backend-haproxy-rsyslogd-conf]
<=download-template

[template-expose-csr-nginx-conf]
<=download-template

[versions]
kedifa = 0.0.6
# Modern KeDiFa requires zc.lockfile
zc.lockfile = 1.4

python2-secrets = 1.0.5
validators = 0.12.2
PyRSS2Gen = 1.1
cns.recipe.symlink = 0.2.3
ecdsa = 0.13
gitdb = 0.6.4
plone.recipe.command = 1.1
pycrypto = 2.6.1
smmap = 0.9.0

websockify = 0.8.0
furl = 2.1.0
orderedmultidict = 1.0.1