aboutsummaryrefslogtreecommitdiff
path: root/scripts/install
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/install')
-rw-r--r--scripts/install28
1 files changed, 17 insertions, 11 deletions
diff --git a/scripts/install b/scripts/install
index 409911b..2e218c6 100644
--- a/scripts/install
+++ b/scripts/install
@@ -20,6 +20,7 @@ source /usr/share/yunohost/helpers
ynh_script_progression --message="Managing script failure..." --weight=1
ynh_clean_setup () {
+ read -p "key"
ynh_clean_check_starting
}
# Exit if an error occurs during the execution of the script
@@ -153,9 +154,11 @@ ynh_add_swap --size=$swap_needed
#=================================================
ynh_script_progression --message="Installing Ruby..." --weight=424
-ynh_install_ruby --ruby_version=2.6.5
-/opt/rbenv/versions/2.6.5/bin/gem update --system
-/opt/rbenv/versions/2.6.5/bin/gem install bundler:1.17.3 --no-document
+ynh_install_ruby --ruby_version=$RUBY_VERSION
+pushd "$final_path/live"
+ gem update --system
+ gem install bundler:1.17.3 --no-document
+popd
#=================================================
# MODIFY A CONFIG FILE
@@ -194,13 +197,13 @@ chown -R "$app": "$final_path"
pushd "$final_path/live"
ynh_use_nodejs
- sudo -u "$app" env PATH=$PATH /opt/rbenv/versions/2.6.5/bin/bundle install -j$(getconf _NPROCESSORS_ONLN) --deployment --without development test
- sudo -u "$app" env PATH=$PATH yarn install --pure-lockfile
- sudo -u "$app" echo "SAFETY_ASSURED=1">> $config
- sudo -u "$app" env PATH=$PATH RAILS_ENV=production /opt/rbenv/versions/2.6.5/bin/bundle exec rails db:setup --quiet
- sudo -u "$app" env PATH=$PATH RAILS_ENV=production /opt/rbenv/versions/2.6.5/bin/bundle exec rails assets:precompile --quiet
- sudo -u "$app" env PATH=$PATH RAILS_ENV=production /opt/rbenv/versions/2.6.5/bin/bundle exec rake mastodon:webpush:generate_vapid_key > key.txt
- sudo -u "$app" env PATH=$PATH RAILS_ENV=production bin/tootctl accounts create "$admin" --email="$admin_mail" --confirmed --role=admin > acc.txt
+ bundle install -j$(getconf _NPROCESSORS_ONLN) --deployment --without development test
+ yarn install --pure-lockfile
+ echo "SAFETY_ASSURED=1">> $config
+ RAILS_ENV=production bundle exec rails db:setup --quiet
+ RAILS_ENV=production bundle exec rails assets:precompile --quiet
+ RAILS_ENV=production bundle exec rake mastodon:webpush:generate_vapid_key > key.txt
+ RAILS_ENV=production bin/tootctl accounts create "$admin" --email="$admin_mail" --confirmed --role=admin > acc.txt
popd
admin_pass=$( tail -1 $final_path/live/acc.txt | head -1 | cut -c 15- )
@@ -224,7 +227,8 @@ ynh_script_progression --message="Setuping a cron job for removing cache..." --w
ynh_replace_string --match_string="__FINAL_PATH__" --replace_string="$final_path" --target_file="../conf/cron"
ynh_replace_string --match_string="__USER__" --replace_string="$app" --target_file="../conf/cron"
-sudo cp -f ../conf/cron /etc/cron.d/$app
+ynh_replace_string --match_string="__RBENVROOT__" --replace_string="$RBENV_ROOT" --target_file="../conf/cron"
+cp -f ../conf/cron /etc/cron.d/$app
#=================================================
# SETUP SYSTEMD
@@ -233,6 +237,8 @@ ynh_script_progression --message="Configuring a systemd service..." --weight=5
# Create a dedicated systemd config
ynh_replace_string --match_string="__PORT_WEB__" --replace_string="$port_web" --target_file="../conf/mastodon-web.service"
+ynh_replace_string --match_string="__RBENVROOT__" --replace_string="$RBENV_ROOT" --target_file="../conf/mastodon-web.service"
+ynh_replace_string --match_string="__RBENVROOT__" --replace_string="$RBENV_ROOT" --target_file="../conf/mastodon-sidekiq.service"
ynh_replace_string --match_string="__PORT_STREAM__" --replace_string="$port_stream" --target_file="../conf/mastodon-streaming.service"
ynh_replace_string --match_string="__NODEJS_PATH__" --replace_string="$nodejs_path" --target_file="../conf/mastodon-streaming.service"
ynh_add_systemd_config --service="$app-web" --template="mastodon-web.service"