aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scripts/install8
-rw-r--r--scripts/restore2
-rw-r--r--scripts/upgrade14
3 files changed, 19 insertions, 5 deletions
diff --git a/scripts/install b/scripts/install
index f5522df..806fec2 100644
--- a/scripts/install
+++ b/scripts/install
@@ -85,13 +85,17 @@ sudo su -c "psql" postgres <<< \
ynh_psql_create_db_without_password "$app"
sudo systemctl restart postgresql
-# Download all Ruby source
+# Download all sources rbenv, ruby and mastodon
sudo su - $app <<CLONECOMMANDS
git clone https://github.com/rbenv/rbenv.git $final_path/.rbenv
git clone https://github.com/rbenv/ruby-build.git $final_path/.rbenv/plugins/ruby-build
git clone https://github.com/tootsuite/mastodon.git $final_path/live
CLONECOMMANDS
+# Switch to tagged release
+cd $final_path/live
+sudo git checkout $(git tag | tail -n 1)
+
# Be king rewind (/var/cache/yunohost/from_file/scripts)
popd
@@ -161,7 +165,7 @@ type rbenv
BCOMMANDS
# Add Services
-pushd $(popd)
+popd
sudo cp ../conf/mastodon-web.service /etc/systemd/system/mastodon-web.service
sudo chown root: /etc/systemd/system/mastodon-web.service
diff --git a/scripts/restore b/scripts/restore
index 1340796..965f6f0 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
+
sudo ls -alh "$final_path"
diff --git a/scripts/upgrade b/scripts/upgrade
index 07b3ee7..d1f985e 100644
--- a/scripts/upgrade
+++ b/scripts/upgrade
@@ -37,12 +37,20 @@ sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
# Stop Mastodon Services
sudo systemctl stop mastodon-*.service
-# Update Mastodon
-sudo su - $app <<COMMANDS
+# Download Mastodon
+sudo su - $app <<PULLCOMMANDS
pushd ~/live
git fetch
git pull https://github.com/tootsuite/mastodon.git master
-git checkout $(git tag | tail -n 1)
+PULLCOMMANDS
+
+# Switch branch to tagged release
+pushd /opt/mastodon/live
+sudo git checkout $(git tag | tail -n 1)
+
+# Apply Mastodon upgrade
+sudo su - $app <<COMMANDS
+pushd ~/live
bin/bundle install
yarn install --pure-lockfile
RAILS_ENV=production bundle exec rails assets:clean