Commit 950194ca authored by Marco Mariani's avatar Marco Mariani

abilian: postgres backup with cron

parent 35e37753
......@@ -2,6 +2,8 @@
parts =
postgres-instance
postgres-promise
postgres-backup
cron-postgres-backup
# Define egg directories to be the one from Software Release
......@@ -100,3 +102,25 @@ url = $${slap-connection:server-url}
key = $${slap-connection:key-file}
cert = $${slap-connection:cert-file}
[postgres-backup]
recipe = slapos.recipe.template:jinja2
template = inline:
#!/bin/bash
. {{environment}}
{{postgres_bin}}/pg_dumpall --clean --file=$${directories:backup}/dumpall
echo "backup done"
rendered = $${directories:bin}/postgres-backup
mode = 700
context =
raw environment $${buildout:directory}/environment.sh
raw postgres_bin $${postgres-instance:bin}
[cron-postgres-backup]
<= cron
recipe = slapos.cookbook:cron.d
name = postgres-backup
frequency = 0 3 * * *
command = $${postgres-backup:rendered}
......@@ -21,7 +21,7 @@ server_dir = $${directories:srv}
requirepass = $${redis-requirepass:passwd}
config_file = $${directories:etc}/redis.conf
log_file = $${directories:log}/redis.log
wrapper = $${directories:services}/redis_server
wrapper = $${directories:services}/redis-server
promise_wrapper = $${directories:promises}/redis
promise_requirepass_file = $${redis-requirepass:storage-path}
......
......@@ -24,6 +24,9 @@ parts =
request-web-frontend
publish-connection-parameters
redis
cron
postgres-backup
cron-postgres-backup
......@@ -65,20 +68,41 @@ mode = 0644
recipe = slapos.cookbook:mkdirectory
bin = $${buildout:directory}/bin
etc = $${buildout:directory}/etc
run = $${directories:var}/run
scripts = $${directories:etc}/run
cron-entries = $${:etc}/cron.d
crontabs = $${:etc}/crontabs
cronstamps = $${:etc}/cronstamps
run = $${:var}/run
scripts = $${:etc}/run
srv = $${buildout:directory}/srv
services = $${directories:etc}/service
promises = $${directories:etc}/promise
services = $${:etc}/service
promises = $${:etc}/promise
var = $${buildout:directory}/var
backup = $${:var}/backup
extranet_spr-instance = $${:var}/extranet_spr-instance
cache = $${:extranet_spr-instance}/cache
data = $${:extranet_spr-instance}/data
log = $${directories:var}/log
tmp = $${directories:var}/tmp
log = $${:var}/log
tmp = $${:var}/tmp
whoosh = $${:data}/whoosh
[cron-simplelogger]
recipe = slapos.cookbook:simplelogger
wrapper = $${directories:bin}/cron_simplelogger
log = $${directories:log}/cron.log
[cron]
recipe = slapos.cookbook:cron
dcrond-binary = ${dcron:location}/sbin/crond
cron-entries = $${directories:cron-entries}
crontabs = $${directories:crontabs}
cronstamps = $${directories:cronstamps}
catcher = $${cron-simplelogger:wrapper}
binary = $${directories:services}/crond
[request-web-frontend]
<= slap-connection
recipe = slapos.cookbook:requestoptional
......
......@@ -10,6 +10,7 @@ extends =
../../../component/redis/buildout.cfg
../../../component/unoconv/buildout.cfg
../../../component/nginx/buildout.cfg
../../../component/dcron/buildout.cfg
../../../component/cups/buildout.cfg
../../../component/dbus/buildout.cfg
......@@ -36,6 +37,7 @@ parts =
abilian-core-repository-check
slapos-cookbook-repository-check
dcron
postgresql91
freetype
cairo
......@@ -226,21 +228,21 @@ configure-command =
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg.in
output = ${buildout:directory}/instance.cfg
md5sum = 963b22f55ba677441603e270ea973ed3
md5sum = 1bdd81a7c22a3cd1a28b8c1b06837b96
mode = 0644
[instance-postgres]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-postgres.cfg.in
output = ${buildout:directory}/instance-postgres.cfg
md5sum = e47ce979db2f12ac2b30814dd20f63f5
md5sum = a8fee23bcada451f94ee70d89c4b94c4
mode = 0644
[instance-redis]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-redis.cfg.in
output = ${buildout:directory}/instance-redis.cfg
md5sum = cb8dfefa0776de51449ada06c16c38b9
md5sum = e0f32e25d059ec67dfccd132cbb6095e
mode = 0644
[instance-extranet]
......
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