[buildout]

extends =
  buildout.hash.cfg
# buildout.hash.cfg is used for automated hash calculation of managed
# instance files by calling update-hash
# buildout.hash.cfg
# "slapos" stack describes basic things needed for 99.9% of SlapOS Software
# Releases
  ../../stack/slapos.cfg
  ../../stack/monitor/buildout.cfg
# Extend here component profiles, like openssl, apache, mariadb, curl...
# Or/and extend a stack (lamp, tomcat) that does most of the work for you
# In this example we extend from helloweb component.
  ../../component/unzip/buildout.cfg
  ../../component/curl/buildout.cfg
  ../../component/dcron/buildout.cfg
  ../../component/vim/buildout.cfg
  ../../component/nodejs/buildout.cfg
  ../../component/yarn/buildout.cfg
  ../../component/python3/buildout.cfg
  ../../component/nginx/buildout.cfg
  ../../component/ffmpeg/buildout.cfg
  ../../component/postgresql/buildout.cfg
  ../../component/nspr/buildout.cfg
  ../../component/gcc/buildout.cfg
  ../../component/libxml2/buildout.cfg
  ../../component/libxslt/buildout.cfg
  ../../component/lxml-python/buildout.cfg
# redis-server
  ../../component/redis/buildout.cfg
  ../../component/git/buildout.cfg
  ../../component/wget/buildout.cfg
# backup
  ../../component/rdiff-backup/buildout.cfg
  ../../component/rsync/buildout.cfg

parts =
# Call installation of slapos.cookbook egg defined in stack/slapos.cfg (needed
# in 99,9% of Slapos Software Releases)
  slapos-cookbook
  dcron
  gcc
  unzip
  curl
  openssl
  python3
  nginx
  ffmpeg
  postgresql
  redis
  wget
# peetube sections
  peertube
  peertube-build
  instance-profile

[nodejs]
<= nodejs-16.19.0

[peertube]
recipe = slapos.recipe.build:download-unpacked
url = https://github.com/Chocobozzz/PeerTube/releases/download/v4.2.2/peertube-v4.2.2.zip
md5sum = 1c9639748d66e8c49fc27e4705f87622

[peertube-build]
recipe = slapos.recipe.cmmi
path = ${peertube:location}
environment =
  PATH=${unzip:location}/bin:${vim:location}/bin:${nodejs:location}/bin:${yarn:location}/bin:${python3:location}/bin:${nginx:location}/sbin:${postgresql10:location}/bin:${gcc-10.2:location}/bin:${redis:location}/bin:{git:location}/bin:{wget:location}/bin:%(PATH)s
  CPPFLAGS=-I${openssl:location}/include
  LDFLAGS=-L${curl:location}/lib -Wl,-rpath -Wl,${openssl:location}/lib -Wl
pre-configure =
  ${yarn:location}/bin/yarn install --production --pure-lockfile
configure-command = true
make-binary = cd ${peertube:location} && ${yarn:location}/bin/yarn
post-install =
  rm -rf ${buildout:directory}/.cache/yarn/
  rm -rf ${buildout:directory}/parts/peertube/client/node_modules/chromedriver/

[instance-profile]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/${:filename}
output = ${buildout:directory}/instance.cfg

[instance-peertube]
recipe  = slapos.recipe.build:download
url     = ${:_profile_base_location_}/${:_update_hash_filename_}
destination = ${buildout:directory}/${:_buildout_section_name_}

[template-peertube-service]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/${:filename}
output = ${buildout:directory}/${:filename}

[template-peertube-yaml]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/${:filename}
output = ${buildout:directory}/${:filename}

[template-nginx-service]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/${:filename}
output = ${buildout:directory}/${:filename}

[template-nginx-configuration]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/${:filename}
output = ${buildout:directory}/${:filename}

[template-dcron-service]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/${:filename}
output = ${buildout:directory}/${:filename}

[template-crontab-line]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/${:filename}
output = ${buildout:directory}/${:filename}

[template-crontab]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/${:filename}
output = ${buildout:directory}/${:filename}

[template-peertube-backup-script]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/${:filename}
output = ${buildout:directory}/${:filename}

[template-peertube-restore-script]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/${:filename}
output = ${buildout:directory}/${:filename}
