diff --git a/scripts/upgrade b/scripts/upgrade index 5a69976..cd86805 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -160,18 +160,6 @@ CREATE EXTENSION IF NOT EXISTS unaccent;CREATE EXTENSION IF NOT EXISTS citext;" # Open this port yunohost firewall allow Both "$port" 2>&1 - -# Give permission to the final_path -chown -R "$app":"$app" "$final_path" -( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix local.hex --force ) -( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix local.rebar --force ) -( cd $final_path/$app && sudo -u "$app" mix deps.get ) -ynh_psql_execute_as_root \ -"ALTER USER $app WITH SUPERUSER;" -( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix ecto.migrate --force ) -ynh_psql_execute_as_root \ -"ALTER USER $app WITH NOSUPERUSER;" - #================================================= # MODIFY A CONFIG FILE #================================================= @@ -211,6 +199,21 @@ ynh_backup_if_checksum_is_different "$final_path/$app/config/prod.secret.exs" # Recalculate and store the checksum of the file for the next upgrade. ynh_store_file_checksum "$final_path/$app/config/prod.secret.exs" +#================================================= +# MAKE UPGRADE +#================================================= + +# Give permission to the final_path +chown -R "$app":"$app" "$final_path" +( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix local.hex --force ) +( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix local.rebar --force ) +( cd $final_path/$app && sudo -u "$app" mix deps.get ) +ynh_psql_execute_as_root \ +"ALTER USER $app WITH SUPERUSER;" +( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix ecto.migrate --force ) +ynh_psql_execute_as_root \ +"ALTER USER $app WITH NOSUPERUSER;" + #================================================= # SETUP LOGROTATE #=================================================