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
34b1948c
Commit
34b1948c
authored
Nov 26, 2022
by
Boxiang Sun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
peertube: restore fixup
parent
c9ea69df
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
3 deletions
+19
-3
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
+18
-2
No files found.
software/peertube/buildout.hash.cfg
View file @
34b1948c
...
@@ -54,4 +54,4 @@ md5sum = 58d1a4fe246169dea94d7d243b4bac9e
...
@@ -54,4 +54,4 @@ md5sum = 58d1a4fe246169dea94d7d243b4bac9e
[template-peertube-restore-script]
[template-peertube-restore-script]
filename = template-peertube-restore.sh.in
filename = template-peertube-restore.sh.in
md5sum =
4cc9853025c2bf45b35ca14d5182b15b
md5sum =
dd4f5a5f862473efa2109315dbef3110
software/peertube/template-peertube-restore.sh.in
View file @
34b1948c
...
@@ -10,6 +10,11 @@
...
@@ -10,6 +10,11 @@
# Depending on the output, it will create a file containing
# Depending on the output, it will create a file containing
# the status of the restoration (success or failure)
# the status of the restoration (success or failure)
slapos node stop all
slapos_node_status_pid=$!
echo $slapos_node_status_pid
wait $slapos_node_status_pid
die() {
die() {
echo "$*" 1>&2
echo "$*" 1>&2
...
@@ -17,6 +22,7 @@ die() {
...
@@ -17,6 +22,7 @@ die() {
}
}
pg_version=$${postgresql:pgdata-directory}/PG_VERSION
pg_version=$${postgresql:pgdata-directory}/PG_VERSION
echo "Check postgresql data directory is ready"
tpgwait=60
tpgwait=60
while ! [ -e "$pg_version" ]; do
while ! [ -e "$pg_version" ]; do
...
@@ -26,6 +32,7 @@ while ! [ -e "$pg_version" ]; do
...
@@ -26,6 +32,7 @@ while ! [ -e "$pg_version" ]; do
sleep 1
sleep 1
done
done
echo "Postgresql data directory is ready"
# 2. Make sure the postgresql process is not running.
# 2. Make sure the postgresql process is not running.
# Quote from the postgresql doc:
# Quote from the postgresql doc:
# > While the server is running, its PID is stored in the file postmaster.pid in the data directory.
# > While the server is running, its PID is stored in the file postmaster.pid in the data directory.
...
@@ -41,6 +48,8 @@ else
...
@@ -41,6 +48,8 @@ else
echo $postgres_pid
echo $postgres_pid
fi
fi
echo "Anyway, the postgresql is running..."
# run psql
# run psql
psql() {
psql() {
$${postgresql:bin}/psql \
$${postgresql:bin}/psql \
...
@@ -50,6 +59,8 @@ psql() {
...
@@ -50,6 +59,8 @@ psql() {
"$@"
"$@"
}
}
echo "Ready to check postgresql is running..."
# initial db setup
# initial db setup
# ( first quering PG several times waiting a bit till postgresql is started and ready )
# ( first quering PG several times waiting a bit till postgresql is started and ready )
tpgwait=5
tpgwait=5
...
@@ -71,14 +82,17 @@ if ! [ -e "$pid_file" ]; then
...
@@ -71,14 +82,17 @@ if ! [ -e "$pid_file" ]; then
exit 1
exit 1
fi
fi
echo "Postgresql is running, ready to restore"
# Restore the database
# 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
echo "Postgresql restore finished"
pg_restore_pid=$!
pg_restore_pid=$!
echo $pg_restore_pid
echo $pg_restore_pid
wait $
PID
wait $
pg_restore_pid
echo
'Backup restoration successfully completed.'
echo
"Backup restoration successfully completed."
# The database process should be stopped to allow
# The database process should be stopped to allow
#"slapos node instance" to starts the real postgresql service
#"slapos node instance" to starts the real postgresql service
...
@@ -86,3 +100,5 @@ if [ -e "$pid_file" ]; then
...
@@ -86,3 +100,5 @@ if [ -e "$pid_file" ]; then
echo "Stoping postgresql..."
echo "Stoping postgresql..."
pkill -9 -f "$${postgresql:bin}/postgres -D $${postgresql:pgdata-directory}"
pkill -9 -f "$${postgresql:bin}/postgres -D $${postgresql:pgdata-directory}"
fi
fi
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