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
Romain Courteaud
slapos
Commits
0c75750b
Commit
0c75750b
authored
Dec 02, 2022
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
restore
parent
75138c3d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
26 deletions
+18
-26
software/peertube/buildout.hash.cfg
software/peertube/buildout.hash.cfg
+1
-1
software/peertube/template-peertube-restore.sh.in
software/peertube/template-peertube-restore.sh.in
+17
-25
No files found.
software/peertube/buildout.hash.cfg
View file @
0c75750b
...
...
@@ -54,4 +54,4 @@ md5sum = 58d1a4fe246169dea94d7d243b4bac9e
[template-peertube-restore-script]
filename = template-peertube-restore.sh.in
md5sum =
2630fcace4412951264c11f3ef1ac82d
md5sum =
bb909227944d626bbe7358ef2669cce2
software/peertube/template-peertube-restore.sh.in
View file @
0c75750b
...
...
@@ -35,9 +35,18 @@ echo "Postgresql data directory is ready"
pid_file=$${postgresql:pgdata-directory}/postmaster.pid
if [ -e "$pid_file" ]; then
echo "Postgresql is running, this should not happened, aborting."
else
echo "Starting postgresql..."
$${postgresql:bin}/postgres -D $${postgresql:pgdata-directory} &
exit 1
fi
echo "Starting postgresql..."
$${postgresql:bin}/postgres -D $${postgresql:pgdata-directory} &
postgresql_pid=$!
trap "kill $postgresql_pid" EXIT TERM INT
sleep 30
# If postgres has stopped, abort
if ! [ -d /proc/$postgresql_pid ]; then
echo "postgresql exited, aborting."
exit 1
fi
tpgwait=60
...
...
@@ -84,28 +93,11 @@ fi
echo "Postgresql is running, ready to restore"
# Restore the database
$${postgresql:bin}/pg_restore -h $${postgresql:pgdata-directory} -U peertube -e -c -C -d postgres $${directory:srv}/backup/peertube_prod-dump.db
$${postgresql:bin}/pg_restore -h $${postgresql:pgdata-directory} -U peertube -e -c -C -d postgres $${directory:srv}/backup/peertube_prod-dump.db || {
RESTORE_EXIT_CODE=$?
echo 'Backup restoration failed.'
exit $RESTORE_EXIT_CODE
}
echo "Postgresql restore finished"
pg_restore_pid=$!
echo $pg_restore_pid
wait $pg_restore_pid
echo "Backup restoration successfully completed."
# The database process should be stopped to allow
#"slapos node instance" to starts the real postgresql service
if [ -e "$pid_file" ]; then
echo "Stoping postgresql..."
pkill -9 -f "$${postgresql:bin}/postgres -D $${postgresql:pgdata-directory}"
fi
tpgwait=60
while [ -e "$pid_file" ]; do
tpgwait=$(( $tpgwait - 1 ))
test $tpgwait = 0 && die "Pid file always exist"
echo "I: Pid file still exist; will retry $tpgwait times..." 1>&2
sleep 1
done
echo "Postgresql process killed"
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