aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authornemsia <nemsia@nemsia.org>2018-06-12 23:26:56 +0200
committernemsia <nemsia@nemsia.org>2018-06-12 23:26:56 +0200
commit29c54691fe2d7f105b346ac23d38b86b3c187f3a (patch)
tree11d63d1cc387ea9ad3552bffb70fe50df16f9794 /scripts
parent4d552172643c981e10490e21e4c343baad5a933e (diff)
parentae04282b9e5bb3a2dff513b1c37c0ff54fd95db4 (diff)
downloadmastodon_ynh-29c54691fe2d7f105b346ac23d38b86b3c187f3a.tar.gz
mastodon_ynh-29c54691fe2d7f105b346ac23d38b86b3c187f3a.tar.bz2
mastodon_ynh-29c54691fe2d7f105b346ac23d38b86b3c187f3a.zip
Merge branch 'testing-2.4' of https://github.com/YunoHost-Apps/mastodon_ynh into YunoHost-Apps-testing-2.4
Diffstat (limited to 'scripts')
-rw-r--r--scripts/backup6
-rw-r--r--scripts/install6
-rw-r--r--scripts/remove5
-rw-r--r--scripts/restore10
-rw-r--r--scripts/upgrade6
5 files changed, 23 insertions, 10 deletions
diff --git a/scripts/backup b/scripts/backup
index 0846afe..f32dfdd 100644
--- a/scripts/backup
+++ b/scripts/backup
@@ -33,7 +33,11 @@ app=$YNH_APP_INSTANCE_NAME
# Retrieve app settings
domain=$(ynh_app_setting_get "$app" domain)
final_path=$(ynh_app_setting_get "$app" final_path)
-db_name=$(ynh_sanitize_dbid "$app")
+db_name=$(ynh_app_setting_get "$app" db_name)
+if [ -z "$db_name" ]; then
+ db_name="${app}_production"
+ ynh_app_setting_set "$app" db_name "$db_name"
+fi
#=================================================
# STANDARD BACKUP STEPS
diff --git a/scripts/install b/scripts/install
index cbce4e3..90a8dfc 100644
--- a/scripts/install
+++ b/scripts/install
@@ -124,8 +124,10 @@ ynh_install_app_dependencies \
ynh_psql_test_if_first_run
db_user=$(ynh_sanitize_dbid "$app")
-db_name=$(ynh_sanitize_dbid "$app")
+db_name="${app}_production"
+db_name=$(ynh_sanitize_dbid "$db_name")
db_pwd=$(ynh_string_random)
+ynh_app_setting_set $app db_name $db_name
ynh_app_setting_set $app db_pwd $db_pwd
ynh_psql_setup_db "$db_user" "$db_name" "$db_pwd"
@@ -220,7 +222,7 @@ sed -i "s@#SMTP_OPENSSL_VERIFY_MODE=peer@SMTP_OPENSSL_VERIFY_MODE=none@g" "${fin
$final_path/live/bin/bundle install -j$(getconf _NPROCESSORS_ONLN) --deployment --without development test --quiet
yarn install --production --no-progress --non-interactive --silent
echo "SAFETY_ASSURED=1">> .env.production
- RAILS_ENV=production $final_path/live/bin/bundle exec rails db:migrate --quiet
+ RAILS_ENV=production $final_path/live/bin/bundle exec rails db:setup --quiet
RAILS_ENV=production $final_path/live/bin/bundle exec rails assets:precompile --quiet
INSTALL
)
diff --git a/scripts/remove b/scripts/remove
index e939908..470455e 100644
--- a/scripts/remove
+++ b/scripts/remove
@@ -22,8 +22,11 @@ app=$YNH_APP_INSTANCE_NAME
# Retrieve app settings
domain=$(ynh_app_setting_get "$app" domain)
db_name=$(ynh_app_setting_get "$app" db_name)
+if [ -z "$db_name" ]; then
+ db_name="${app}_production"
+ ynh_app_setting_set "$app" db_name "$db_name"
+fi
db_user=$(ynh_sanitize_dbid "$app")
-db_name=$(ynh_sanitize_dbid "$app")
final_path=$(ynh_app_setting_get "$app" final_path)
#=================================================
diff --git a/scripts/restore b/scripts/restore
index a800966..b41b9cd 100644
--- a/scripts/restore
+++ b/scripts/restore
@@ -89,10 +89,10 @@ fi
# Install source.list debian package backports & yarn
if [ "$(lsb_release --codename --short)" == "jessie" ]; then
- cp ../conf/backports.list /etc/apt/sources.list.d/
+ cp ../conf/apt_backports.list /etc/apt/sources.list.d/
fi
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
-cp ../conf/yarn.list /etc/apt/sources.list.d/
+cp ../conf/apt_yarn.list /etc/apt/sources.list.d/yarn.list
ynh_package_update
# Install de Node.js
@@ -124,7 +124,11 @@ ynh_install_app_dependencies \
# Restore PostgreSQL database
db_user=$(ynh_sanitize_dbid "$app")
-db_name=$(ynh_sanitize_dbid "$app")
+db_name=$(ynh_app_setting_get "$app" db_name)
+if [ -z "$db_name" ]; then
+ db_name="${app}_production"
+ ynh_app_setting_set "$app" db_name "$db_name"
+fi
db_pwd=$(ynh_app_setting_get "$app" db_pwd)
ynh_psql_test_if_first_run
diff --git a/scripts/upgrade b/scripts/upgrade
index 3858ee8..d50b729 100644
--- a/scripts/upgrade
+++ b/scripts/upgrade
@@ -15,7 +15,7 @@ source /usr/share/yunohost/helpers
# See comments in install script
app=$YNH_APP_INSTANCE_NAME
-db_name=$app
+db_name=$(ynh_app_setting_get "$app" db_name)
# Retrieve app settings
domain=$(ynh_app_setting_get "$app" domain)
@@ -31,7 +31,7 @@ path_url="/"
# If db_name doesn't exist, create it
if [ -z "$db_name" ]; then
- db_name=$(ynh_sanitize_dbid "$app")
+ db_name="${app}_production"
ynh_app_setting_set "$app" db_name "$db_name"
fi
@@ -115,7 +115,7 @@ ynh_setup_source "$final_path/.rbenv/plugins/ruby-build" "app-ruby-build"
# Install ruby 2.5.1
(
- exec_as "$app" $final_path/.rbenv/bin/rbenv install 2.5.1 || true
+ exec_as "$app" $final_path/.rbenv/bin/rbenv install -s 2.5.1 || true
exec_as "$app" $final_path/.rbenv/bin/rbenv global 2.5.1 || true
exec_as "$app" $final_path/.rbenv/versions/2.5.1/bin/ruby -v
)