Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Iliya Manolov
slapos
Commits
37fffdaa
Commit
37fffdaa
authored
Oct 08, 2013
by
Nicolas Wavrant
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
helloworld: logrotate and cron added
parent
2cda6fc7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
82 additions
and
5 deletions
+82
-5
software/helloworld/instance.cfg.in
software/helloworld/instance.cfg.in
+71
-2
software/helloworld/software.cfg
software/helloworld/software.cfg
+8
-0
software/helloworld/template/rendered.in
software/helloworld/template/rendered.in
+3
-3
No files found.
software/helloworld/instance.cfg.in
View file @
37fffdaa
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
#
#
#############################
#############################
#
#
#
Now we are going how to add new parts, using new recipes
#
Adding a binary to this software : logrotate
#
#
#############################
#############################
[buildout]
[buildout]
...
@@ -14,6 +14,10 @@ parts =
...
@@ -14,6 +14,10 @@ parts =
publish-connection-parameter
publish-connection-parameter
# Don't forget to include the new part ! It will also call [template-get] in software.cfg
# Don't forget to include the new part ! It will also call [template-get] in software.cfg
template-creation
template-creation
cron
cron-entry-logrotate
logrotate
logrotate-entry
# Define egg directories to be the one from Software Release
# Define egg directories to be the one from Software Release
# (/opt/slapgrid/...)
# (/opt/slapgrid/...)
...
@@ -56,9 +60,11 @@ configuration.title =
...
@@ -56,9 +60,11 @@ configuration.title =
recipe = slapos.cookbook:mkdirectory
recipe = slapos.cookbook:mkdirectory
home = $${buildout:directory}
home = $${buildout:directory}
etc = $${:home}/etc
etc = $${:home}/etc
bin = $${:home}/bin
var = $${:home}/var
var = $${:home}/var
srv = $${:home}/srv
# Creation of the folder wich will contain the jinja template
# Creation of the folder wich will contain the jinja template
data-fold = $${:
home}/srv
/data
data-fold = $${:
srv}
/data
# Executables put here will be started but not monitored (for startup scripts)
# Executables put here will be started but not monitored (for startup scripts)
script = $${:etc}/run/
script = $${:etc}/run/
# Executables put here will be started and monitored (for daemons)
# Executables put here will be started and monitored (for daemons)
...
@@ -68,6 +74,69 @@ service = $${:etc}/service
...
@@ -68,6 +74,69 @@ service = $${:etc}/service
promise = $${:etc}/promise/
promise = $${:etc}/promise/
# Path of the log directory used by our service (see [hello-world])
# Path of the log directory used by our service (see [hello-world])
log = $${:var}/log
log = $${:var}/log
# 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
# Deploy cron
[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 * * * *
# Now that the cron is set up, we can define
# the command to launch every XX
command = $${logrotate:wrapper}
# Deploy Logrotate
# To know more about which arguments are necessary,
# and why they are used for, you should read the recipe,
# in ../../slapos/recipe/logrogate.py
[logrotate]
recipe = slapos.cookbook:logrotate
# Binaries
logrotate-binary = ${logrotate:location}/usr/sbin/logrotate
gzip-binary = ${gzip:location}/bin/gzip
gunzip-binary = ${gzip:location}/bin/gunzip
# Directories
wrapper = $${directory:bin}/logrotate
conf = $${directory:etc}/logrotate.conf
# in this folder will be defined tho files to save, and how to save them
logrotate-entries = $${directory:logrotate-entries}
# in this folder the logs will be compressed then saved
backup = $${directory:logrotate-backup}
state-file = $${directory:srv}/logrotate.status
[logrotate-entry]
<= 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
# It is now time for Jinja !
# It is now time for Jinja !
...
...
software/helloworld/software.cfg
View file @
37fffdaa
...
@@ -9,6 +9,10 @@ extends =
...
@@ -9,6 +9,10 @@ extends =
# In this example we only need the dash binary to run a simple "hello world"
# In this example we only need the dash binary to run a simple "hello world"
# shell script.
# shell script.
../../component/dash/buildout.cfg
../../component/dash/buildout.cfg
# Add the logrotate service
../../component/dcron/buildout.cfg
../../component/logrotate/buildout.cfg
../../component/gzip/buildout.cfg
parts =
parts =
# Call installation of slapos.cookbook egg defined in stack/slapos.cfg (needed
# Call installation of slapos.cookbook egg defined in stack/slapos.cfg (needed
...
@@ -17,6 +21,10 @@ parts =
...
@@ -17,6 +21,10 @@ parts =
# Call creation of instance.cfg file that will be called for deployment of
# Call creation of instance.cfg file that will be called for deployment of
# instance
# instance
template
template
# Deployment of the new components. Their buildout section can be found
# in ../../component/~~
dcron
logrotate
# Download instance.cfg.in (buildout profile used to deployment of instance),
# Download instance.cfg.in (buildout profile used to deployment of instance),
# replace all ${foo:bar} parameters by real values, and change $${foo:bar} to
# replace all ${foo:bar} parameters by real values, and change $${foo:bar} to
...
...
software/helloworld/template/rendered.in
View file @
37fffdaa
{%if title %}
{%
if title %}
---------------------------------------
---------------------------------------
{{
title
}}
{{
title
}}
---------------------------------------
---------------------------------------
{% endif %}
{% endif %}
Hello {{name}}
Hello {{ name }}
\ No newline at end of file
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment