Commit 3aadd960 authored by Boxiang Sun's avatar Boxiang Sun

peertube: backup fixup

parent 7f746f93
Pipeline #24974 passed with stage
in 0 seconds
......@@ -186,7 +186,7 @@ virtual-depends =
[nginx-listen-promise]
<= monitor-promise-base
promise = check_url_available
promise = check_socket_listening
name = nginx_listen.py
config-host = $${nginx-configuration:ip}
config-port = $${nginx-configuration:port}
......
......@@ -18,7 +18,7 @@ md5sum = b67bad9012a8f79c66779d4c660828e2
[instance-peertube]
_update_hash_filename_ = instance-peertube.cfg.in
md5sum = 45bc81b1659aff57ec763af7863d77db
md5sum = 3096a4d3e117752b4827925129d61331
[template-nginx-service]
filename = template-nginx-service.sh.in
......@@ -54,4 +54,4 @@ md5sum = 58d1a4fe246169dea94d7d243b4bac9e
[template-peertube-restore-script]
filename = template-peertube-restore.sh.in
md5sum = 0b3206237adec20cbdb379d3766e4333
md5sum = d3189a97e1898cc319acb7bc28ef3245
......@@ -146,8 +146,6 @@ name = redis
[peertube-passwd]
recipe = slapos.cookbook:generate.password
storage-path = ${directory:etc}/.peertube_user
bytes = 8
username = root
[peertube-yaml]
......@@ -169,7 +167,7 @@ output = ${directory:services}/peertube
[peertube-database-resiliency-exclude-file]
recipe = slapos.recipe.template:jinja2
inline = {{ "${postgresql:pgdata-directory}/**" }}
inline = {{ "${postgresql:pgdata-directory}/" }}
output = ${directory:srv}/exporter.exclude
[peertube-database-resiliency-after-import-script]
......
......@@ -23,9 +23,8 @@ if [ -e "$pid_file" ]; then
exit 1
fi
# 2.
echo "Deleting existing database..."
find "$${postgresql:pgdata-directory}" -mindepth 1 -delete
# 2. Restore database
$${postgresql:bin}/pg_restore -h $${postgresql:pgdata-directory} -C -c -U peertube $${directory:srv}/backup/peertube_prod-dump.db
# 3.
echo "Starting postgresql..."
......@@ -57,15 +56,10 @@ echo "I: PostgreSQL ready." 1>&2
$${postgresql:bin}/postgres -D $${postgresql:pgdata-directory}
sleep 30
# If mysql has stopped, abort
# If postgresql has stopped, abort
if ! [ -d "$${postgresql:pgdata-directory}" ]; then
echo "postgresql exited, aborting."
exit 1
fi
# 4.
echo "Importing data..."
$${postgresql:bin}/pg_restore -h $${postgresql:pgdata-directory} -c -U peertube -d peertube_prod $${directory:srv}/backup/peertube_prod-dump.db
# Check if it failed?
echo 'Backup restoration successfully completed.'
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