From 90770990566bd53b386416dbca3fe79b21b5f537 Mon Sep 17 00:00:00 2001 From: Yunohost-Bot <> Date: Fri, 30 Aug 2024 22:38:25 +0200 Subject: [PATCH] [autopatch] Automatic patch attempt for helpers 2.1 --- .gitignore | 1 + manifest.toml | 2 ++ scripts/_common.sh | 24 ++++---------- scripts/backup | 21 ++++++------- scripts/install | 78 +++++++++++++++++++++++----------------------- scripts/remove | 24 +++++++------- scripts/restore | 49 ++++++++++++++--------------- scripts/upgrade | 77 ++++++++++++++++++++++----------------------- 8 files changed, 131 insertions(+), 145 deletions(-) diff --git a/.gitignore b/.gitignore index 783a4ae..8f144f3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *~ *.sw[op] +.DS_Store diff --git a/manifest.toml b/manifest.toml index 11ccd62..19f1433 100644 --- a/manifest.toml +++ b/manifest.toml @@ -18,6 +18,7 @@ code = "https://github.com/magicstone-dev/acropolis" [integration] yunohost = ">=11.2.12" +helpers_version = "2.1" architectures = "all" multi_instance = false @@ -59,6 +60,7 @@ ram.runtime = "50M" [resources.system_user] [resources.install_dir] + group = "www-data:r-x" [resources.permissions] main.url = "/" diff --git a/scripts/_common.sh b/scripts/_common.sh index 5f5307a..6dda112 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -1,17 +1,13 @@ #!/bin/bash #================================================= -# COMMON VARIABLES +# COMMON VARIABLES AND CUSTOM HELPERS #================================================= -RUBY_VERSION="2.7.1" +ruby_version="2.7.1" MEMORY_NEEDED="2560" -#================================================= -# PERSONAL HELPERS -#================================================= - # Returns true if a swap partition is enabled, false otherwise # usage: is_swap_present is_swap_present() { @@ -37,11 +33,11 @@ is_memory_available() { # terminates installation if requirements not met check_memory_requirements() { if ! is_swap_present ; then - ynh_die --message="You must have a swap partition in order to install and use this application" + ynh_die "You must have a swap partition in order to install and use this application" elif ! is_swappiness_sufficient ; then - ynh_die --message="Your swappiness must be higher than 50; please see https://en.wikipedia.org/wiki/Swappiness" + ynh_die "Your swappiness must be higher than 50; please see https://en.wikipedia.org/wiki/Swappiness" elif ! is_memory_available 1000000 ; then - ynh_die --message="You must have a minimum of 1Gb available memory (RAM+swap) for the installation" + ynh_die "You must have a minimum of 1Gb available memory (RAM+swap) for the installation" fi } # Checks discourse upgrade memory requirements @@ -49,7 +45,7 @@ check_memory_requirements() { # terminates upgrade if requirements not met check_memory_requirements_upgrade() { if ! is_memory_available 400000 ; then - ynh_die --message="You must have a minimum of 400Mb available memory (RAM+swap) for the upgrade" + ynh_die "You must have a minimum of 400Mb available memory (RAM+swap) for the upgrade" fi } @@ -111,11 +107,3 @@ ynh_maintenance_mode_OFF () { systemctl reload nginx } - -#================================================= -# EXPERIMENTAL HELPERS -#================================================= - -#================================================= -# FUTURE OFFICIAL HELPERS -#================================================= diff --git a/scripts/backup b/scripts/backup index 7a474c5..e50cee8 100644 --- a/scripts/backup +++ b/scripts/backup @@ -9,37 +9,34 @@ source ../settings/scripts/_common.sh source ../settings/scripts/ynh_add_swap source /usr/share/yunohost/helpers -#================================================= -# DECLARE DATA AND CONF FILES TO BACKUP -#================================================= -ynh_print_info --message="Declaring files to be backed up..." +ynh_print_info "Declaring files to be backed up..." #================================================= # BACKUP THE APP MAIN DIR #================================================= -ynh_backup --src_path="$install_dir" +ynh_backup "$install_dir" #================================================= # BACKUP THE SYSTEM CONFIGURATION #================================================= -ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" +ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" -ynh_backup --src_path="/etc/systemd/system/$app-web.service" -ynh_backup --src_path="/etc/systemd/system/$app-sidekiq.service" +ynh_backup "/etc/systemd/system/$app-web.service" +ynh_backup "/etc/systemd/system/$app-sidekiq.service" -ynh_backup --src_path="/etc/logrotate.d/$app" +ynh_backup "/etc/logrotate.d/$app" #================================================= # BACKUP THE MYSQL DATABASE #================================================= -ynh_print_info --message="Backing up the PostgreSQL database..." +ynh_print_info "Backing up the PostgreSQL database..." -ynh_psql_dump_db --database="$db_name" > db.sql +ynh_psql_dump_db > db.sql #================================================= # END OF SCRIPT #================================================= -ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." +ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." diff --git a/scripts/install b/scripts/install index 289b379..a28d108 100644 --- a/scripts/install +++ b/scripts/install @@ -11,14 +11,14 @@ source /usr/share/yunohost/helpers #================================================= # INSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Installing Ruby..." --weight=1 +ynh_script_progression "Installing Ruby..." -ynh_exec_warn_less ynh_install_ruby --ruby_version="$RUBY_VERSION" +ynh_ruby_install #================================================= # ADD SWAP IF NEEDED #================================================= -ynh_script_progression --message="Adding swap if needed..." +ynh_script_progression "Adding swap if needed..." total_memory=$(ynh_get_ram --total) swap_needed=0 @@ -28,92 +28,92 @@ if (( MEMORY_NEEDED > total_memory )); then swap_needed=$((MEMORY_NEEDED - total_memory)) fi -ynh_script_progression --message="Adding $swap_needed Mo to swap..." +ynh_script_progression "Adding $swap_needed Mo to swap..." ynh_add_swap --size=$swap_needed #================================================= # CREATE A POSTGRESQL DATABASE #================================================= -ynh_script_progression --message="Setting the PostgreSQL database..." +ynh_script_progression "Setting the PostgreSQL database..." -ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS hstore;" --database="$db_name" -ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pg_trgm;" --database="$db_name" +ynh_psql_db_shell <<< "CREATE EXTENSION IF NOT EXISTS hstore;" + +ynh_psql_db_shell <<< "CREATE EXTENSION IF NOT EXISTS pg_trgm;" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_script_progression --message="Setting up source files..." --weight=1 +ynh_script_progression "Setting up source files..." ynh_setup_source --dest_dir="$install_dir" mkdir -p "$install_dir/tmp/pids" -chmod -R o-rwx "$install_dir" -chown -R "$app:www-data" "$install_dir" - +#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir" +#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R "$app:www-data" "$install_dir" #================================================= # ADD A CONFIGURATION #================================================= -ynh_script_progression --message="Adding a configuration file..." --weight=1 +ynh_script_progression "Adding $app's configuration..." -ynh_add_config --template="database.yml.example" --destination="$install_dir/config/database.yml" -ynh_add_config --template="diaspora.toml.example" --destination="$install_dir/config/diaspora.toml" +ynh_config_add --template="database.yml.example" --destination="$install_dir/config/database.yml" +ynh_config_add --template="diaspora.toml.example" --destination="$install_dir/config/diaspora.toml" -chmod 400 "$install_dir/config/database.yml" -chmod 400 "$install_dir/config/diaspora.toml" -chown "$app:$app" "$install_dir/config/database.yml" -chown "$app:$app" "$install_dir/config/diaspora.toml" +#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 400 "$install_dir/config/database.yml" +#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 400 "$install_dir/config/diaspora.toml" +#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown "$app:$app" "$install_dir/config/database.yml" +#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown "$app:$app" "$install_dir/config/diaspora.toml" #================================================= # INSTALLING RUBY AND BUNDLER #================================================= -ynh_script_progression --message="Building $app..." +ynh_script_progression "Building $app..." pushd "$install_dir" - ynh_use_ruby - ynh_gem install bundler:1.17.3 --no-document - ynh_exec_as "$app" echo "gem: --no-ri --no-rdoc" >> "$install_dir/.gemrc" - ynh_exec_as "$app" chmod +x script/server - ynh_exec_warn_less ynh_exec_as "$app" "$ynh_ruby_load_path" script/configure_bundler - ynh_exec_warn_less ynh_exec_as "$app" "$ynh_ruby_load_path" bin/bundle config set path 'vendor/bundle' - ynh_exec_warn_less ynh_exec_as "$app" "$ynh_ruby_load_path" bin/bundle install --full-index --with postgresql + gem install bundler:1.17.3 --no-document + ynh_exec_as_app echo "gem: --no-ri --no-rdoc" >> "$install_dir/.gemrc" + ynh_exec_as_app chmod +x script/server + + ynh_hide_warnings ynh_exec_as_app ruby_load_path" script/configure_bundler + ynh_hide_warnings ynh_exec_as_app ruby_load_path" bin/bundle config set path 'vendor/bundle' + ynh_hide_warnings ynh_exec_as_app ruby_load_path" bin/bundle install --full-index --with postgresql popd -ynh_script_progression --message="Preparing the database and create initial admin user..." +ynh_script_progression "Preparing the database and create initial admin user..." pushd "$install_dir" - ynh_exec_warn_less ynh_exec_as "$app" "$ynh_ruby_load_path" RAILS_ENV=production bin/rake db:migrate - ynh_exec_warn_less ynh_exec_as "$app" "$ynh_ruby_load_path" RAILS_ENV=production bin/rake assets:precompile - ynh_exec_warn_less ynh_exec_as "$app" "$ynh_ruby_load_path" RAILS_ENV=production bin/rake "admin:create[$admin, $email, $password]" + ynh_hide_warnings ynh_exec_as_app ruby_load_path" RAILS_ENV=production bin/rake db:migrate + ynh_hide_warnings ynh_exec_as_app ruby_load_path" RAILS_ENV=production bin/rake assets:precompile + ynh_hide_warnings ynh_exec_as_app ruby_load_path" RAILS_ENV=production bin/rake "admin:create[$admin, $email, $password]" popd #================================================= # SYSTEM CONFIGURATION #================================================= -ynh_script_progression --message="Adding system configurations related to $app..." --weight=1 +ynh_script_progression "Adding system configurations related to $app..." -ynh_add_nginx_config +ynh_config_add_nginx -ynh_add_systemd_config --service="$app-web" --template="$app-web.service" +ynh_config_add_systemd --service="$app-web" --template="$app-web.service" yunohost service add "$app-web" --description="$app web service" -ynh_add_systemd_config --service="$app-sidekiq" --template="$app-sidekiq.service" +ynh_config_add_systemd --service="$app-sidekiq" --template="$app-sidekiq.service" yunohost service add "$app-sidekiq" --description="$app sidekiq service" # Use logrotate to manage application logfile(s) -ynh_use_logrotate +ynh_config_add_logrotate #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=1 +ynh_script_progression "Starting $app's systemd service..." -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="Booted Rails" +ynh_systemctl --service="${app}-web" --action="start" --log_path=systemd --wait_until="listening on" +ynh_systemctl --service="${app}-sidekiq" --action="start" --log_path=systemd --wait_until="Booted Rails" #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Installation of $app completed" --last +ynh_script_progression "Installation of $app completed" diff --git a/scripts/remove b/scripts/remove index e31f498..d388021 100644 --- a/scripts/remove +++ b/scripts/remove @@ -11,37 +11,37 @@ source /usr/share/yunohost/helpers #================================================= # REMOVE SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Removing system configurations related to $app..." --weight=1 +ynh_script_progression "Removing system configurations related to $app..." # Remove the service from the list of services known by YunoHost (added from `yunohost service add`) -if ynh_exec_warn_less yunohost service status "$app-web" >/dev/null; then +if ynh_hide_warnings yunohost service status "$app-web" >/dev/null; then yunohost service remove "$app-web" fi -ynh_remove_systemd_config --service="$app-web" +ynh_config_remove_systemd"$app-web" -if ynh_exec_warn_less yunohost service status "$app-sidekiq" >/dev/null; then +if ynh_hide_warnings yunohost service status "$app-sidekiq" >/dev/null; then yunohost service remove "$app-sidekiq" fi -ynh_remove_systemd_config --service="$app-sidekiq" +ynh_config_remove_systemd"$app-sidekiq" -ynh_remove_nginx_config +ynh_config_remove_nginx #================================================= # REMOVE VARIOUS FILES #================================================= -ynh_secure_remove --file="/etc/$app" +ynh_safe_rm "/etc/$app" -ynh_secure_remove --file="/var/log/$app" +#REMOVEME? (Apps should not remove their log dir during remove ... this should only happen if --purge is used, and be handled by the core...) ynh_safe_rm "/var/log/$app" -ynh_script_progression --message="Removing Swap..." --weight=1 +ynh_script_progression "Removing Swap..." ynh_del_swap -ynh_script_progression --message="Uninstalling Ruby..." --weight=1 -ynh_remove_ruby +ynh_script_progression "Uninstalling Ruby..." +ynh_ruby_remove #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Removal of $app completed" --last +ynh_script_progression "Removal of $app completed" diff --git a/scripts/restore b/scripts/restore index 0aab10f..d8bf60c 100644 --- a/scripts/restore +++ b/scripts/restore @@ -12,14 +12,14 @@ source /usr/share/yunohost/helpers #================================================= # INSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Reinstalling Ruby..." --weight=4 +ynh_script_progression "Reinstalling Ruby..." -ynh_exec_warn_less ynh_install_ruby --ruby_version="$RUBY_VERSION" +ynh_ruby_install #================================================= # ADD SWAP IF NEEDED #================================================= -ynh_script_progression --message="Adding swap if needed..." +ynh_script_progression "Adding swap if needed..." total_memory=$(ynh_get_ram --total) swap_needed=0 @@ -29,68 +29,67 @@ if (( MEMORY_NEEDED > total_memory )); then swap_needed=$((MEMORY_NEEDED - total_memory)) fi -ynh_script_progression --message="Adding $swap_needed Mo to swap..." +ynh_script_progression "Adding $swap_needed Mo to swap..." ynh_add_swap --size=$swap_needed #================================================= # RESTORE THE APP MAIN DIR #================================================= -ynh_script_progression --message="Restoring the app main directory..." --weight=1 +ynh_script_progression "Restoring the app main directory..." -ynh_restore_file --origin_path="$install_dir" +ynh_restore "$install_dir" mkdir -p "$install_dir/tmp/pids" -chmod -R o-rwx "$install_dir" -chown -R "$app:$app" "$install_dir" - +#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir" +#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R "$app:$app" "$install_dir" #================================================= # RESTORE THE POSTGRESQL DATABASE #================================================= -ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=1 +ynh_script_progression "Restoring the PostgreSQL database..." -ynh_psql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" < ./db.sql +ynh_psql_db_shell < ./db.sql #================================================= # INSTALLING RUBY AND BUNDLER #================================================= -ynh_script_progression --message="Rebuilding $app..." +ynh_script_progression "Rebuilding $app..." pushd "$install_dir" - ynh_use_ruby - ynh_gem install bundler:1.17.3 --no-document - ynh_exec_as "$app" echo "gem: --no-ri --no-rdoc" >> "$install_dir/.gemrc" + + gem install bundler:1.17.3 --no-document + ynh_exec_as_app echo "gem: --no-ri --no-rdoc" >> "$install_dir/.gemrc" popd #================================================= # RESTORE SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1 +ynh_script_progression "Restoring system configurations related to $app..." -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" +ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf" -ynh_restore_file --origin_path="/etc/systemd/system/$app-web.service" +ynh_restore "/etc/systemd/system/$app-web.service" systemctl enable "$app-web" --quiet yunohost service add "$app-web" --description="$app web service" -ynh_restore_file --origin_path="/etc/systemd/system/$app-sidekiq.service" +ynh_restore "/etc/systemd/system/$app-sidekiq.service" systemctl enable "$app-sidekiq" --quiet yunohost service add "$app-sidekiq" --description="$app sidekiq service" -ynh_restore_file --origin_path="/etc/logrotate.d/$app" +ynh_restore "/etc/logrotate.d/$app" #================================================= # RELOAD NGINX AND PHP-FPM OR THE APP SERVICE #================================================= -ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1 +ynh_script_progression "Reloading NGINX web server and $app's service..." -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="Booted Rails" +ynh_systemctl --service="${app}-web" --action="start" --log_path=systemd --wait_until="listening on" +ynh_systemctl --service="${app}-sidekiq" --action="start" --log_path=systemd --wait_until="Booted Rails" -ynh_systemd_action --service_name=nginx --action=reload +ynh_systemctl --service=nginx --action=reload #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Restoration completed for $app" --last +ynh_script_progression "Restoration completed for $app" diff --git a/scripts/upgrade b/scripts/upgrade index 8dbb61f..ec331fd 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -11,100 +11,99 @@ source /usr/share/yunohost/helpers #================================================= # STOP SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Stopping $app's systemd service..." --weight=1 +ynh_script_progression "Stopping $app's systemd service..." -ynh_systemd_action --service_name="${app}-web" --action="stop" --log_path=systemd -ynh_systemd_action --service_name="${app}-sidekiq" --action="stop" --log_path=systemd +ynh_systemctl --service="${app}-web" --action="stop" --log_path=systemd +ynh_systemctl --service="${app}-sidekiq" --action="stop" --log_path=systemd #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= -ynh_script_progression --message="Ensuring downward compatibility..." +ynh_script_progression "Ensuring downward compatibility..." ynh_remove_extra_repo -ynh_app_setting_delete --app="$app" --key=redis_namespace -ynh_app_setting_delete --app="$app" --key=secret_key_base +ynh_app_setting_delete --key=redis_namespace +ynh_app_setting_delete --key=secret_key_base #================================================= # INSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Updating Ruby..." --weight=1 +ynh_script_progression "Updating Ruby..." -ynh_exec_warn_less ynh_install_ruby --ruby_version="$RUBY_VERSION" +ynh_ruby_install #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_script_progression --message="Upgrading source files..." --weight=1 +ynh_script_progression "Upgrading source files..." # Download, check integrity, uncompress and patch the source from app.src -ynh_setup_source --dest_dir="$install_dir" --full_replace=1 --keep="config/database.yml config/diaspora.toml" +ynh_setup_source --dest_dir="$install_dir" --full_replace --keep="config/database.yml config/diaspora.toml" mkdir -p "$install_dir/tmp/pids" -chmod -R o-rwx "$install_dir" -chown -R "$app:www-data" "$install_dir" - +#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir" +#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R "$app:www-data" "$install_dir" #================================================= # UPDATE A CONFIG FILE #================================================= -ynh_script_progression --message="Updating $app's configuration files..." --weight=1 +ynh_script_progression "Updating $app's configuration files..." -ynh_add_config --template="database.yml.example" --destination="$install_dir/config/database.yml" -ynh_add_config --template="diaspora.toml.example" --destination="$install_dir/config/diaspora.toml" +ynh_config_add --template="database.yml.example" --destination="$install_dir/config/database.yml" +ynh_config_add --template="diaspora.toml.example" --destination="$install_dir/config/diaspora.toml" -chmod 400 "$install_dir/config/database.yml" -chmod 400 "$install_dir/config/diaspora.toml" -chown "$app:$app" "$install_dir/config/database.yml" -chown "$app:$app" "$install_dir/config/diaspora.toml" +#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 400 "$install_dir/config/database.yml" +#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 400 "$install_dir/config/diaspora.toml" +#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown "$app:$app" "$install_dir/config/database.yml" +#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown "$app:$app" "$install_dir/config/diaspora.toml" #================================================= # INSTALLING RUBY AND BUNDLER #================================================= -ynh_script_progression --message="Building $app..." +ynh_script_progression "Building $app..." pushd "$install_dir" - ynh_use_ruby - ynh_gem install bundler:1.17.3 --no-document - ynh_exec_as "$app" echo "gem: --no-ri --no-rdoc" >> "$install_dir/.gemrc" - ynh_exec_warn_less ynh_exec_as "$app" "$ynh_ruby_load_path" bin/bundle config deployment 'true' - ynh_exec_warn_less ynh_exec_as "$app" "$ynh_ruby_load_path" bin/bundle config without 'development test' - ynh_exec_warn_less ynh_exec_as "$app" "$ynh_ruby_load_path" bin/bundle install --full-index --with postgresql + gem install bundler:1.17.3 --no-document + ynh_exec_as_app echo "gem: --no-ri --no-rdoc" >> "$install_dir/.gemrc" - ynh_exec_warn_less ynh_exec_as "$app" "$ynh_ruby_load_path" RAILS_ENV=production bin/rake assets:clean - ynh_exec_warn_less ynh_exec_as "$app" "$ynh_ruby_load_path" RAILS_ENV=production bin/rake assets:precompile - ynh_exec_warn_less ynh_exec_as "$app" "$ynh_ruby_load_path" RAILS_ENV=production bin/rake db:migrate + ynh_hide_warnings ynh_exec_as_app ruby_load_path" bin/bundle config deployment 'true' + ynh_hide_warnings ynh_exec_as_app ruby_load_path" bin/bundle config without 'development test' + ynh_hide_warnings ynh_exec_as_app ruby_load_path" bin/bundle install --full-index --with postgresql + + ynh_hide_warnings ynh_exec_as_app ruby_load_path" RAILS_ENV=production bin/rake assets:clean + ynh_hide_warnings ynh_exec_as_app ruby_load_path" RAILS_ENV=production bin/rake assets:precompile + ynh_hide_warnings ynh_exec_as_app ruby_load_path" RAILS_ENV=production bin/rake db:migrate popd #================================================= # REAPPLY SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1 +ynh_script_progression "Upgrading system configurations related to $app..." # Create a dedicated NGINX config -ynh_add_nginx_config +ynh_config_add_nginx # Create a dedicated systemd config -ynh_add_systemd_config --service="$app-web" --template="acropolis-web.service" +ynh_config_add_systemd --service="$app-web" --template="acropolis-web.service" yunohost service add "$app-web" --description="$app web service" -ynh_add_systemd_config --service="$app-sidekiq" --template="acropolis-sidekiq.service" +ynh_config_add_systemd --service="$app-sidekiq" --template="acropolis-sidekiq.service" yunohost service add "$app-sidekiq" --description="$app sidekiq service" # Use logrotate to manage app-specific logfile(s) -ynh_use_logrotate --non-append +ynh_config_add_logrotate #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting $app's systemd service..." --weight=1 +ynh_script_progression "Starting $app's systemd service..." -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="Booted Rails" +ynh_systemctl --service="${app}-web" --action="start" --log_path=systemd --wait_until="listening on" +ynh_systemctl --service="${app}-sidekiq" --action="start" --log_path=systemd --wait_until="Booted Rails" #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Upgrade of $app completed" --last +ynh_script_progression "Upgrade of $app completed"