[buildout]
extends =
  ../../component/bash/buildout.cfg
  ../../component/openssl/buildout.cfg
  ../../component/curl/buildout.cfg
  ../../component/git/buildout.cfg
  ../../stack/slapos.cfg
  ../../stack/nodejs.cfg
  ../../stack/monitor/buildout.cfg
  ./buildout.hash.cfg

parts =
  slapos-cookbook
  nodejs
  openssl
  jscrawler-build
  instance

[python]
part = python2.7

[nodejs]
<= nodejs-12.18.3

[jscrawler]
recipe = slapos.recipe.build:gitclone
repository = https://lab.nexedi.com/Mynij/mynij-crawler.git
revision = ccbdfdc4712c008034b891f081be92b9342c48ac
git-executable = ${git:location}/bin/git


[jscrawler-build]
recipe = plone.recipe.command
stop-on-error = true
command =
  cd ${jscrawler:location} && PATH=${nodejs:location}/bin:$PATH npm install
update-command = ${:command}

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

[instance]
recipe = slapos.recipe.template:jinja2
output = ${buildout:directory}/instance.cfg
url = ${:_profile_base_location_}/${:filename}
context =
    key bash_location bash:location
    key bin_directory buildout:bin-directory
    key buildout_egg_directory buildout:eggs-directory
    key buildout_develop_directory buildout:develop-eggs-directory
    key buildout_directory buildout:directory
    key template_monitor_cfg monitor2-template:output
    key logrotate_cfg template-logrotate-base:output
    key jscrawler_location jscrawler:location
    key nodejs_location nodejs:location
    key openssl_location openssl:location
    key template_jscrawler template-jscrawler:target
    key template_jscrawler_builder template-jscrawler-builder:target


[template-jscrawler]
<= download-template
output = ${buildout:directory}/instance-jscrawler.cfg.jinja2

[template-jscrawler-builder]
<= download-template
output = ${buildout:directory}/template-jscrawler.builder.sh.in
