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

abilian: postgres backup with cron

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