mirror of
https://git.lapiole.org/dani/ansible-roles.git
synced 2025-08-04 07:37:20 +02:00
Update to 2022-03-07 14:00
This commit is contained in:
14
roles/unmaintained/wh_backend/templates/backup.sh.j2
Normal file
14
roles/unmaintained/wh_backend/templates/backup.sh.j2
Normal file
@@ -0,0 +1,14 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
cd /opt/wh/{{ item.0.name }}/apps/{{ item.1.name }}
|
||||
# Remove old archives
|
||||
find archives/ -type f -mtime +2 -exec rm -f "{}" \;
|
||||
# Create the new daily archive, with a dump of the DB and the web, data and logs dir
|
||||
TS=$(date +%Y-%m-%d_%Hh%M)
|
||||
mysqldump --add-drop-table --single-transaction \
|
||||
--host={{ (wh_default_app | combine(item.1)).database.server | default(mysql_server) }} \
|
||||
--user={{ item.0.name[0:7] }}_{{ item.1.name[0:7] }} \
|
||||
--password="{{ (wh_default_app | combine(item.1)).database.pass | default((wh_pass_seed | password_hash('sha256', 65534 | random(seed=item.0.name + item.1.name) | string))[9:27] ) }}" \
|
||||
{{ item.0.name[0:7] }}_{{ item.1.name[0:7] }} | \
|
||||
zstd -c > archives/$TS.sql.zst
|
||||
ZSTD_CLEVEL=15 ZSTD_NBTHREADS=0 nice -n 9 tar cf archives/$TS.tar.zst --use-compress-program=zstd data web logs
|
Reference in New Issue
Block a user