Commit 707fce90 authored by Ayush Tiwari's avatar Ayush Tiwari

Hello World: Logrotate and Cron components added

parent fadfc92e
......@@ -10,6 +10,10 @@ parts =
hello-world-promise
publish-connection-parameter
render-template
cron
cron-entry-logrotate
logrotate
logrotate-entry
# Define egg directories to be the one from Software Release
# (/opt/slapgrid/...)
......@@ -52,6 +56,8 @@ recipe = slapos.cookbook:mkdirectory
home = $${buildout:directory}
etc = $${:home}/etc
var = $${:home}/var
bin = $${:home}/bin
srv = $${:home}/srv
# Executables put here will be started but not monitored (for startup scripts)
script = $${:etc}/run/
# Executables put here will be started and monitored (for daemons)
......@@ -61,8 +67,59 @@ service = $${:etc}/service
promise = $${:etc}/promise/
# Path of the log directory used by our service (see [hello-world])
log = $${:var}/log
data-fold = $${:home}/srv/data
data-fold = $${:srv}/data
# Cron directories
cron-entries = $${:etc}/cron.d
crontabs = $${:etc}/crontabs
cronstamps = $${:etc}/cronstamps
# Logrotate directories
backup = $${:srv}/backup
logrotate-backup = $${:backup}/logrotate
logrotate-entries = $${:etc}/logrotate.d
[cron]
recipe = slapos.cookbook:cron
dcrond-binary = ${dcron:location}/sbin/crond
cron-entries = $${directory:cron-entries}
crontabs = $${directory:crontabs}
cronstamps = $${directory:cronstamps}
catcher = $${cron-simplelogger:wrapper}
binary = $${directory:service}/crond
[cron-simplelogger]
recipe = slapos.cookbook:simplelogger
wrapper = $${directory:bin}/cron_simplelogger
log = $${directory:log}/cron.log
[cron-entry-logrotate]
<= cron
recipe = slapos.cookbook:cron.d
name = logrotate
frequency = 0 * * * *
command = $${logrotate:wrapper}
[logrotate]
recipe = slapos.cookbook:logrotate
logrotate-binary = ${logrotate:location}/usr/sbin/logrotate
gzip-binary = ${gzip:location}/bin/gzip
gunzip-binary = ${gzip:location}/bin/gunzip
wrapper = $${directory:bin}/logrotate
conf = $${directory:etc}/logrotate.conf
logrotate-entries = $${directory:logrotate-entries}
backup = $${directory:logrotate-backup}
state-file = $${directory:srv}/logrotate.status
[logrotate-entry]
# Extends logrotate
<= logrotate
recipe = slapos.cookbook:logrotate.d
name = helloworld-logrotate
log = $${directory:log}/log.log
frequency = daily
rotatep-num = 30
sharedscripts = true
notifempty = true
create = true
# Create a simple web server that says "hello <configuration.name>" to the web.
[hello-world]
......
......@@ -10,6 +10,10 @@ extends =
# above stack/slapos.cfg
# ../../component/component1/buildout.cfg
# ../../component/component2/buildout.cfg
# Logrotate service
../../component/dcron/buildout.cfg
../../component/logrotate/buildout.cfg
../../component/gzip/buildout.cfg
parts =
# Call installation of slapos.cookbook egg defined in stack/slapos.cfg (needed
......@@ -22,6 +26,10 @@ parts =
# "build" python program (install + correct shebang for our python)
hello-web-bin
# Parts for cron and logrotate
dcron
logrotate
# Download instance.cfg.in (buildout profile used to deployment of instance),
# replace all ${foo:bar} parameters by real values, and change $${foo:bar} to
......
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