aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author__cyp <cyp@rouquin.me>2017-05-06 19:54:54 +0200
committerGitHub <noreply@github.com>2017-05-06 19:54:54 +0200
commitb25cc8f544457b6ea7eed56d30c211947b8baa12 (patch)
tree05f489a760cb3a06417e80b22942f584c16d48ca
parente9741741cf8aa2697a04322455d298b16e3d31c6 (diff)
parent6d0d7a561a4bb3eb7d0e5d4cf53c488c88e07da0 (diff)
downloadmastodon_ynh-b25cc8f544457b6ea7eed56d30c211947b8baa12.tar.gz
mastodon_ynh-b25cc8f544457b6ea7eed56d30c211947b8baa12.tar.bz2
mastodon_ynh-b25cc8f544457b6ea7eed56d30c211947b8baa12.zip
Merge pull request #20 from nemsia/patch-3
[fix] Restore pg dump and make jenkins happy
-rw-r--r--scripts/restore15
1 files changed, 13 insertions, 2 deletions
diff --git a/scripts/restore b/scripts/restore
index 1340796..500a9b1 100644
--- a/scripts/restore
+++ b/scripts/restore
@@ -101,8 +101,19 @@ RAILS_ENV=production bin/bundle exec rails db:migrate
RAILS_ENV=production bin/bundle exec rails assets:precompile
RCOMMANDS
-# restore database
-sudo psql mastodon_production < $YNH_APP_BACKUP_DIR/mastodon_db.sql
+# copy database dump
+sudo cp $YNH_APP_BACKUP_DIR/mastodon_db.sql $final_path
+sudo chmod a+r $final_path/mastodon_db.sql
+
+# Restore database dump
+sudo su - $app <<RECOMMANDS
+dropdb mastodon_production
+createdb mastodon_production
+psql mastodon_production < $final_path/mastodon_db.sql
+RECOMMANDS
+
+# Remove dump
+ynh_secure_remove $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