aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scripts/restore13
-rw-r--r--scripts/upgrade2
2 files changed, 12 insertions, 3 deletions
diff --git a/scripts/restore b/scripts/restore
index f754d81..7820e04 100644
--- a/scripts/restore
+++ b/scripts/restore
@@ -70,6 +70,8 @@ sudo cp -a ./sources "$final_path"
# Set permissions
sudo chown -R $app: "$final_path"
+sudo chmod -R a+rx /home/yunohost.backup/tmp
+
# Set UTF8 encoding by default
sudo su -c "psql" postgres <<< \
@@ -81,12 +83,19 @@ sudo su -c "psql" postgres <<< \
sudo su -c "psql" postgres <<< \
"update pg_database set datistemplate='true' where datname='template1';"
+# Copy postgresql dump
+sudo cp $YNH_APP_BACKUP_DIR/mastodon_db.sql $final_path
+
# Restore db
ynh_psql_create_db_without_password "$app"
+sudo systemctl restart postgresql
sudo su - postgres <<COMMANDS
-pg_dump --role=mastodon -U postgres --no-password mastodon < $YNH_APP_BACKUP_DIR/mastodon_db.sql
+pg_restore --role=mastodon -U postgres --no-password < $final_path/mastodon_db.sql
COMMANDS
+# Delete dump after restore
+# rm $final_path/mastodon_db.sql
+
# Create symlink for ruby
sudo ln -s /opt/mastodon/.rbenv/versions/2.4.1/bin/ruby /usr/bin/ruby || true
@@ -121,4 +130,4 @@ sudo yunohost service add mastodon-sidekiq
sudo yunohost service add mastodon-streaming
# Reload services
-sudo systemctl reload nginx \ No newline at end of file
+sudo systemctl reload nginx
diff --git a/scripts/upgrade b/scripts/upgrade
index 655f22f..076e3fb 100644
--- a/scripts/upgrade
+++ b/scripts/upgrade
@@ -39,7 +39,7 @@ sudo systemctl stop mastodon-*.service
# Update Mastodon
sudo su - $app <<COMMANDS
-pushd ~/live
+cd live
git fetch
git pull https://github.com/tootsuite/mastodon.git master
git checkout $(git tag | tail -n 1)