aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authoryalh76 <yalh@yahoo.com>2022-01-07 19:41:59 +0100
committerGitHub <noreply@github.com>2022-01-07 19:41:59 +0100
commitfa8a9d4eed460fa73926e7874313091dffb7b9fc (patch)
tree155293eb2bf6b881ab4bae9490440bd2125cdfec /scripts
parentadec07db890dec787416e1b7c4493d24391d3500 (diff)
parent1476f17251ea0b339390cfa5210e258342ea5a4a (diff)
downloadmastodon_ynh-fa8a9d4eed460fa73926e7874313091dffb7b9fc.tar.gz
mastodon_ynh-fa8a9d4eed460fa73926e7874313091dffb7b9fc.tar.bz2
mastodon_ynh-fa8a9d4eed460fa73926e7874313091dffb7b9fc.zip
Merge pull request #290 from YunoHost-Apps/testing
Upgrade to 3.4.4
Diffstat (limited to 'scripts')
-rw-r--r--scripts/_common.sh2
-rw-r--r--scripts/install18
-rw-r--r--scripts/restore9
-rw-r--r--scripts/upgrade8
4 files changed, 17 insertions, 20 deletions
diff --git a/scripts/_common.sh b/scripts/_common.sh
index b6f4796..c861376 100644
--- a/scripts/_common.sh
+++ b/scripts/_common.sh
@@ -5,7 +5,7 @@
#=================================================
# dependencies used by the app
-pkg_dependencies="imagemagick ffmpeg libpq-dev libxml2-dev libxslt1-dev file git-core g++ libprotobuf-dev protobuf-compiler pkg-config gcc autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm3|libgdbm6 libgdbm-dev redis-server redis-tools postgresql postgresql-contrib libidn11-dev libicu-dev libjemalloc-dev curl apt-transport-https"
+pkg_dependencies="imagemagick ffmpeg libpq-dev libxml2-dev libxslt1-dev file git-core g++ libprotobuf-dev protobuf-compiler pkg-config gcc autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm3|libgdbm6 libgdbm-dev redis-tools redis-server postgresql postgresql-contrib libidn11-dev libicu-dev libjemalloc-dev curl apt-transport-https"
MEMORY_NEEDED="2560"
diff --git a/scripts/install b/scripts/install
index d4056ef..e6960d1 100644
--- a/scripts/install
+++ b/scripts/install
@@ -75,8 +75,8 @@ ynh_app_setting_set --app=$app --key=port_stream --value=$port_stream
#=================================================
ynh_script_progression --message="Installing dependencies..."
-ynh_install_app_dependencies $pkg_dependencies
-ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
+ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
+ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
ynh_install_ruby --ruby_version=$RUBY_VERSION
@@ -93,13 +93,13 @@ ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
ynh_script_progression --message="Creating a PostgreSQL database..."
+ynh_psql_test_if_first_run
# Create PostgreSQL database
db_name=$(ynh_sanitize_dbid --db_name="${app}_production")
db_user=$(ynh_sanitize_dbid --db_name=$app)
db_pwd=$(ynh_string_random --length=30)
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
ynh_app_setting_set --app=$app --key=db_pwd --value=$db_pwd
-ynh_psql_test_if_first_run
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
ynh_psql_execute_as_root --sql="ALTER USER $db_user CREATEDB;"
@@ -207,13 +207,13 @@ pushd "$final_path/live"
sudo -u $app $ynh_ruby_load_path bin/bundle config without 'development test'
sudo -u $app $ynh_ruby_load_path bin/bundle install -j$(getconf _NPROCESSORS_ONLN)
ynh_use_nodejs
- sudo -u $app $ynh_node_load_PATH yarn install --pure-lockfile
+ ynh_exec_warn_less sudo -u $app $ynh_node_load_PATH yarn install --pure-lockfile
echo "SAFETY_ASSURED=1">> $config
- sudo -u $app RAILS_ENV=production $ynh_ruby_load_path bin/bundle exec rails db:setup --quiet
- sudo -u $app RAILS_ENV=production $ynh_ruby_load_path bin/bundle exec rails assets:precompile --quiet
- sudo -u $app RAILS_ENV=production $ynh_ruby_load_path bin/bundle exec rake mastodon:webpush:generate_vapid_key > key.txt
- sudo -u $app RAILS_ENV=production $ynh_ruby_load_path bin/tootctl accounts create "$admin" --email="$admin_mail" --confirmed --role=admin > /dev/null
- sudo -u $app RAILS_ENV=production $ynh_ruby_load_path bin/tootctl accounts modify "$admin" --approve
+ ynh_exec_warn_less sudo -u $app RAILS_ENV=production $ynh_ruby_load_path bin/bundle exec rails db:setup --quiet
+ ynh_exec_warn_less sudo -u $app RAILS_ENV=production $ynh_ruby_load_path bin/bundle exec rails assets:precompile --quiet
+ ynh_exec_warn_less sudo -u $app RAILS_ENV=production $ynh_ruby_load_path bin/bundle exec rake mastodon:webpush:generate_vapid_key > key.txt
+ ynh_exec_warn_less sudo -u $app RAILS_ENV=production $ynh_ruby_load_path bin/tootctl accounts create "$admin" --email="$admin_mail" --confirmed --role=admin > /dev/null
+ ynh_exec_warn_less sudo -u $app RAILS_ENV=production $ynh_ruby_load_path bin/tootctl accounts modify "$admin" --approve
popd
vapid_private_key=$(grep -oP "VAPID_PRIVATE_KEY=\K.+" "$final_path/live/key.txt")
diff --git a/scripts/restore b/scripts/restore
index 7a3808b..aacb7f0 100644
--- a/scripts/restore
+++ b/scripts/restore
@@ -41,10 +41,7 @@ db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
#=================================================
ynh_script_progression --message="Validating restoration parameters..."
-ynh_webpath_available --domain=$domain --path_url=$path_url \
- || ynh_die --message="Path not available: ${domain}${path_url}"
-test ! -d $final_path \
- || ynh_die --message="There is already a directory: $final_path "
+test ! -d $final_path || ynh_die --message="There is already a directory: $final_path "
#=================================================
# STANDARD RESTORATION STEPS
@@ -104,8 +101,8 @@ ynh_restore_file --origin_path="/etc/cron.d/$app"
#=================================================
ynh_script_progression --message="Reinstalling dependencies..."
-ynh_install_app_dependencies $pkg_dependencies
-ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
+ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
+ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
ynh_install_ruby --ruby_version=$RUBY_VERSION
diff --git a/scripts/upgrade b/scripts/upgrade
index 0653f76..a386514 100644
--- a/scripts/upgrade
+++ b/scripts/upgrade
@@ -269,10 +269,10 @@ pushd "$final_path/live"
sudo -u $app $ynh_ruby_load_path bin/bundle install -j$(getconf _NPROCESSORS_ONLN)
ynh_use_nodejs
sudo -u $app $ynh_node_load_PATH yarn install --pure-lockfile
- sudo -u $app RAILS_ENV=production $ynh_ruby_load_path bin/bundle exec rails assets:clean
- sudo -u $app RAILS_ENV=production $ynh_ruby_load_path bin/bundle exec rails assets:precompile
- sudo -u $app RAILS_ENV=production $ynh_ruby_load_path bin/bundle exec rails db:migrate
- sudo -u $app RAILS_ENV=production $ynh_ruby_load_path bin/tootctl cache clear
+ ynh_exec_warn_less sudo -u $app RAILS_ENV=production $ynh_ruby_load_path bin/bundle exec rails assets:clean
+ ynh_exec_warn_less sudo -u $app RAILS_ENV=production $ynh_ruby_load_path bin/bundle exec rails assets:precompile
+ ynh_exec_warn_less sudo -u $app RAILS_ENV=production $ynh_ruby_load_path bin/bundle exec rails db:migrate
+ ynh_exec_warn_less sudo -u $app RAILS_ENV=production $ynh_ruby_load_path bin/tootctl cache clear
popd
#=================================================