diff options
Diffstat (limited to 'scripts/install')
| -rw-r--r-- | scripts/install | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/scripts/install b/scripts/install index da81c3b..91133d3 100644 --- a/scripts/install +++ b/scripts/install @@ -75,9 +75,10 @@ ynh_app_setting_set --app=$app --key=port_stream --value=$port_stream #================================================= ynh_script_progression --message="Installing dependencies..." -ynh_install_nodejs --nodejs_version=$NODEJS_VERSION ynh_install_app_dependencies $pkg_dependencies +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 #================================================= # CREATE DEDICATED USER @@ -128,7 +129,7 @@ ynh_add_nginx_config 'port_web port_stream' #================================================= # ADD SWAP IF NEEDED #================================================= -ynh_script_progression --message="Adding swap is needed..." +ynh_script_progression --message="Adding swap if needed..." total_memory=$(ynh_get_ram --total) swap_needed=0 @@ -146,10 +147,10 @@ ynh_add_swap --size=$swap_needed #================================================= ynh_script_progression --message="Installing Ruby..." -ynh_install_ruby --ruby_version=$RUBY_VERSION pushd "$final_path/live" - $RBENV_ROOT/versions/$app/bin/gem update --system - $RBENV_ROOT/versions/$app/bin/gem install bundler:$BUNDLER_VERSION --no-document + ynh_use_ruby + ynh_gem update --system + ynh_gem install bundler --no-document popd #================================================= @@ -185,17 +186,17 @@ ynh_script_progression --message="Installing Mastodon..." chown -R "$app": "$final_path" pushd "$final_path/live" + sudo -u $app $ynh_ruby_load_path bin/bundle config deployment 'true' + 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 PATH=$PATH $RBENV_ROOT/versions/$app/bin/bundle config deployment 'true' - sudo -u $app PATH=$PATH $RBENV_ROOT/versions/$app/bin/bundle config without 'development test' - sudo -u $app PATH=$PATH $RBENV_ROOT/versions/$app/bin/bundle install -j$(getconf _NPROCESSORS_ONLN) - sudo -u $app PATH=$PATH yarn install --pure-lockfile + sudo -u $app $ynh_node_load_PATH yarn install --pure-lockfile echo "SAFETY_ASSURED=1">> $config - sudo -u $app RAILS_ENV=production PATH=$PATH $RBENV_ROOT/versions/$app/bin/bundle exec rails db:setup --quiet - sudo -u $app RAILS_ENV=production PATH=$PATH $RBENV_ROOT/versions/$app/bin/bundle exec rails assets:precompile --quiet - sudo -u $app RAILS_ENV=production PATH=$PATH $RBENV_ROOT/versions/$app/bin/bundle exec rake mastodon:webpush:generate_vapid_key > key.txt - sudo -u $app RAILS_ENV=production PATH=$PATH bin/tootctl accounts create "$admin" --email="$admin_mail" --confirmed --role=admin > /dev/null - sudo -u $app RAILS_ENV=production PATH=$PATH bin/tootctl accounts modify "$admin" --approve + 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 popd vapid_private_key=$(grep -oP "VAPID_PRIVATE_KEY=\K.+" "$final_path/live/key.txt") @@ -204,6 +205,8 @@ ynh_app_setting_set --app="$app" --key=vapid_private_key --value="$vapid_private vapid_public_key=$(grep -oP "VAPID_PUBLIC_KEY=\K.+" "$final_path/live/key.txt") ynh_app_setting_set --app="$app" --key=vapid_public_key --value="$vapid_public_key" +ynh_delete_file_checksum --file="$config" + ynh_add_config --template="../conf/.env.production.sample" --destination="$config" ynh_secure_remove --file="$final_path/live/key.txt" @@ -249,7 +252,7 @@ yunohost service add "$app-streaming" --description="$app streaming service" #================================================= ynh_script_progression --message="Starting a systemd service..." -ynh_systemd_action --service_name=${app}-web --action="start" --log_path=systemd --line_match="Listening on tcp" +ynh_systemd_action --service_name=${app}-web --action="start" --log_path=systemd --line_match="Listening on" ynh_systemd_action --service_name=${app}-sidekiq --action="start" --log_path=systemd --line_match="Schedules Loaded" ynh_systemd_action --service_name=${app}-streaming --action="start" --log_path=systemd --line_match="Worker 1 now listening" |
