aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authornemsia <nemsia@nemsia.org>2017-07-13 00:27:17 +0200
committernemsia <nemsia@nemsia.org>2017-07-13 00:27:17 +0200
commit60ae6587feb89feb6221d43d89fac40eb44165a8 (patch)
treeb9cdf6ea7270150a29fda581c2f2b26c0225d6eb /scripts
parent8f88641088a09aa466d6d2de760d9470b3d4d322 (diff)
parent8711b925306be63d7b2b7669fe2ef3cf8ebdc476 (diff)
downloadmastodon_ynh-60ae6587feb89feb6221d43d89fac40eb44165a8.tar.gz
mastodon_ynh-60ae6587feb89feb6221d43d89fac40eb44165a8.tar.bz2
mastodon_ynh-60ae6587feb89feb6221d43d89fac40eb44165a8.zip
Merge remote-tracking branch 'refs/remotes/YunoHost-Apps/master' into upgrade-from-pre-release
Diffstat (limited to 'scripts')
-rw-r--r--scripts/backup9
-rw-r--r--scripts/install11
-rw-r--r--scripts/restore4
-rw-r--r--scripts/upgrade4
4 files changed, 24 insertions, 4 deletions
diff --git a/scripts/backup b/scripts/backup
index cc94aa4..e4a5bba 100644
--- a/scripts/backup
+++ b/scripts/backup
@@ -23,6 +23,9 @@ domain=$(ynh_app_setting_get "$app" domain)
final_path="/opt/${app}"
ynh_backup "$final_path" "sources" 1
+# final_path on nginx
+sudo sed -i "s@$final_path@__FINALPATH__@g" /etc/nginx/conf.d/${domain}.d/${app}.conf
+
# Copy the nginx conf files
ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf" "nginx.conf"
ynh_backup "/etc/cron.d/${app}" "cron.conf"
@@ -32,9 +35,13 @@ ynh_backup "/etc/systemd/system/mastodon-streaming.service" "systemd_streaming.s
ynh_backup "/etc/apt/sources.list.d/backports.list" "apt_backports.list"
ynh_backup "/etc/apt/sources.list.d/yarn.list" "apt_yarn.list"
+# final_path on nginx
+sudo sed -i "s@__FINALPATH__@$final_path@g" /etc/nginx/conf.d/${domain}.d/${app}.conf
+
# Backup db
sudo su - postgres <<COMMANDS
pg_dump --role=mastodon -U postgres --no-password mastodon_production > mastodon_db.sql
COMMANDS
ynh_backup "/var/lib/postgresql/${app}_db.sql" "${app}_db.sql"
-ynh_secure_remove /var/lib/postgresql/mastodon_db.sql
+# Fix backup fail on yunohost 2.6
+#ynh_secure_remove /var/lib/postgresql/mastodon_db.sql
diff --git a/scripts/install b/scripts/install
index ebe4569..b7e175c 100644
--- a/scripts/install
+++ b/scripts/install
@@ -52,6 +52,13 @@ ynh_package_install postgresql postgresql-contrib
# Install Ruby
ynh_package_install autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm3 libgdbm-dev
+# Import debian archive pubkey, need on ARM arch
+arch=$(uname -m)
+if [[ $arch = arm* ]]; then
+ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 8B48AD6246925553
+ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 7638D0442B90D010
+fi
+
# Install source.list debian package backports & yarn
sudo cp ../conf/backports.list /etc/apt/sources.list.d/
sudo curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
@@ -206,7 +213,9 @@ RAILS_ENV=production bin/bundle exec rails mastodon:make_admin USERNAME=$admin_m
RAILS_ENV=production bin/bundle exec rails mastodon:confirm_email USER_EMAIL=$admin_mastodon_mail
ACOMMANDS
-# Copy nginx config
+# Modify Nginx configuration file and copy it to Nginx conf directory
+sudo sed -i "s@__PATH__@$app@g" ../conf/nginx.conf*
+sudo sed -i "s@__FINALPATH__@$final_path@g" ../conf/nginx.conf*
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
# Install crontab
diff --git a/scripts/restore b/scripts/restore
index 5860e2c..30666df 100644
--- a/scripts/restore
+++ b/scripts/restore
@@ -162,7 +162,9 @@ yarn install --pure-lockfile
#RAILS_ENV=production bin/bundle exec rails assets:precompile
RCOMMANDS
-# Restore nginx configuration files
+# Modify Nginx configuration file and copy it to Nginx conf directory
+sudo sed -i "s@__PATH__@$app@g" ./nginx.conf
+sudo sed -i "s@__FINALPATH__@$final_path@g" ./nginx.conf
sudo cp -a ./nginx.conf "$nginx_conf"
# Restore crontab
sudo cp -a ./cron.conf "$crontab_conf"
diff --git a/scripts/upgrade b/scripts/upgrade
index 979e005..9dffa34 100644
--- a/scripts/upgrade
+++ b/scripts/upgrade
@@ -31,7 +31,7 @@ db_name=$app
# Modify Nginx configuration file and copy it to Nginx conf directory
sudo sed -i "s@__PATH__@$app@g" ../conf/nginx.conf*
-sudo sed -i "s@__FINALPATH__@$final_path/@g" ../conf/nginx.conf*
+sudo sed -i "s@__FINALPATH__@$final_path@g" ../conf/nginx.conf*
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
# Stop Mastodon Services
@@ -71,6 +71,8 @@ sudo su - $app <<COMMANDS
pushd ~/live
bin/bundle install
yarn install --pure-lockfile
+# For 1.4.1 -> 1.4.2 migration prepare_for_foreign_keys is needed
+RAILS_ENV=production bundle exec rails mastodon:maintenance:prepare_for_foreign_keys
RAILS_ENV=production bundle exec rails assets:clean
RAILS_ENV=production bundle exec rails assets:precompile
RAILS_ENV=production bundle exec rails db:migrate