Commit 0226ee01 authored by Boxiang Sun's avatar Boxiang Sun

peertube: Add crontab service and enabled database backup

parent 72326142
Pipeline #24642 passed with stage
in 0 seconds
......@@ -31,3 +31,19 @@ filename = template-peertube.yaml.in
[template-nginx-configuration]
filename = template-nginx.cfg.in
# md5sum = 6b11e79bcc7734d8629e1b6e6cb497e1
[template-dcron-service]
filename = template-dcron-service.sh.in
# md5sum = 851262d7174da868805cb7c8e1ced7c0
[template-crontab-line]
filename = template-crontab-line.in
# md5sum = 5cbd64f04da0601ba4286516a6161f5e
[template-crontab]
filename = template-crontab.in
# md5sum = f1f82101258de19068262b7213fc478b
[template-peertube-backup-script]
filename = template-peertube-backup.sh.in
# md5sum = ae4a0043414336a521b524d9c95f1c68
......@@ -11,6 +11,11 @@ parts =
peertube-service
publish-connection-parameter
peertube-urlparse
dcron-service
activate-crontab-file
peertube-backup-cron
peertube-database-resiliency-after-import-script
peertube-database-resiliency-exclude-file
nginx-listen-promise
peertube-listen-promise
......@@ -26,6 +31,10 @@ var = $${buildout:directory}/var
log = $${:var}/log
run = $${:var}/run
www = $${:var}/www
crontabs = $${:etc}/crontabs
cron-entries = $${:etc}/cron.d
cronstamps = $${:etc}/cronstamps
cron-lines = $${:etc}/cron.lines
nginx = $${:etc}/nginx
peertube_nginx_log = $${:log}/nginx
varnginx = $${:var}/nginx
......@@ -144,6 +153,45 @@ config-command = $${service-redis:promise-wrapper}
log = $${redis:log}/*.log
name = redis
#################################
# Cron service
#################################
[dcron-service]
recipe = slapos.recipe.template
url = ${template-dcron-service:output}
output = $${directory:services}/crond
logfile = $${directory:log}/crond.log
[peertube-backup-script]
recipe = slapos.recipe.template
url = ${template-peertube-backup-script:output}
output = $${directory:etc}/$${:_buildout_section_name_}
[peertube-backup-cron]
recipe = slapos.recipe.template
url = ${template-crontab-line:output}
output = $${directory:cron-lines}/$${:_buildout_section_name_}
script = $${peertube-backup-script:output}
frequency = daily
[activate-crontab-file]
# XXX File is never removed
recipe = plone.recipe.command
stop-on-error = true
command = ${coreutils-output:cat} ${template-crontab:output} $${peertube-backup-cron:output} | ${dcron-output:crontab} -c $${directory:crontabs} -
[peertube-database-resiliency-exclude-file]
recipe = slapos.recipe.template:jinja2
inline = {{ "$${postgresql:pgdata-directory}/**" }}
output = $${directory:srv}/exporter.exclude
[peertube-database-resiliency-after-import-script]
recipe = collective.recipe.template
input = inline: #!/bin/sh
$${postgresql:bin}/pg_restore -c -C -d postgres $${directory:peertube_directory}//peertube_prod-dump.db
output = $${directory:srv}/runner-import-restore
mode = 755
#################################
# SlapOS service
#################################
......
......@@ -14,6 +14,7 @@ extends =
# 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
......@@ -30,11 +31,15 @@ extends =
../../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
......@@ -106,3 +111,23 @@ output = ${buildout:directory}/${:filename}
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}
# $${:_buildout_section_name_}
$${:frequency} $${:script}
# min(0-59) hours(0-23) day(1-31) month(1-12) dow(0-7) command
MAILTO=admins@erp5.org
#!${dash-output:dash}
# BEWARE: This file is operated by slapos node
# BEWARE: It will be overwritten automatically
exec ${dcron-output:crond} \
-s $${directory:cron-entries} \
-c $${directory:crontabs} \
-t $${directory:cronstamps} \
-f -l 5 \
-L $${dcron-service:logfile}
# -M cron_simplelogger
echo "Hello Peertube"
# Dump the databse
$${postgresql:bin}/pg_dump -Fc peertube_prod > $${directory:peertube_directory}/peertube_prod-dump.db
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment