From c1bee3ddc9f430d5ac7a9d1a8fa9fdab4e5f694a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Sat, 28 Nov 2020 17:31:42 +0100 Subject: [PATCH] Fix install/upgrade --- conf/nginx.conf | 2 +- scripts/_common.sh | 6 ------ scripts/backup | 3 +++ scripts/experimental_helper.sh | 2 +- scripts/install | 3 +++ scripts/upgrade | 3 +++ 6 files changed, 11 insertions(+), 8 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index bcd94f2..e184597 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,6 +1,6 @@ location __PATH__ { include uwsgi_params; - uwsgi_pass unix:///var/run/__NAME__/app.socket; + uwsgi_pass unix:///run/__NAME__/app.socket; uwsgi_read_timeout 180; uwsgi_send_timeout 180; diff --git a/scripts/_common.sh b/scripts/_common.sh index 7457f45..a8abe47 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -8,12 +8,6 @@ pgadmin_user="pgadmin" python_version="$(python3 -V | cut -d' ' -f2 | cut -d. -f1-2)" dependances="python3-pip build-essential python3-dev python3-venv postgresql uwsgi uwsgi-plugin-python3 expect libpq-dev" -if [[ -e "../settings/manifest.json" ]] || [[ -e "../manifest.json" ]]; then - APP_VERSION=$(ynh_app_upstream_version) - app_main_version=$(echo $APP_VERSION | cut -d'-' -f1) - app_sub_version=$(echo $APP_VERSION | cut -d'-' -f2) -fi - #================================================= # DEFINE ALL COMMON FONCTIONS #================================================= diff --git a/scripts/backup b/scripts/backup index 2565a45..52ff421 100644 --- a/scripts/backup +++ b/scripts/backup @@ -19,6 +19,9 @@ ynh_script_progression --message="Loading installation settings..." final_path=$(ynh_app_setting_get --app $app --key final_path) domain=$(ynh_app_setting_get --app $app --key domain) db_name=$(ynh_app_setting_get --app $app --key db_name) +app_version=$(ynh_app_upstream_version) +app_main_version=$(echo $app_version | cut -d'-' -f1) +app_sub_version=$(echo $app_version | cut -d'-' -f2) #================================================= # STANDARD BACKUP STEPS diff --git a/scripts/experimental_helper.sh b/scripts/experimental_helper.sh index a5cc663..0e70509 100644 --- a/scripts/experimental_helper.sh +++ b/scripts/experimental_helper.sh @@ -17,7 +17,7 @@ After=syslog.target RuntimeDirectory=%i ExecStart=/usr/bin/uwsgi \ --ini /etc/uwsgi/apps-available/%i.ini \ - --socket /var/run/%i/app.socket \ + --socket /run/%i/app.socket \ --logto /var/log/uwsgi/%i/%i.log User=%i Group=www-data diff --git a/scripts/install b/scripts/install index 2dd26a6..389b1d0 100644 --- a/scripts/install +++ b/scripts/install @@ -22,6 +22,9 @@ path_url=$(ynh_normalize_url_path --path_url $YNH_APP_ARG_PATH) admin=$YNH_APP_ARG_ADMIN db_user="pgadmin" admin_pwd=$YNH_APP_ARG_ADMIN_PASSWORD +app_version=$(ynh_app_upstream_version) +app_main_version=$(echo $app_version | cut -d'-' -f1) +app_sub_version=$(echo $app_version | cut -d'-' -f2) # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS test ! -e "$final_path" || ynh_die --message "This path already contains a folder" diff --git a/scripts/upgrade b/scripts/upgrade index b1fae6e..98afbd0 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -19,6 +19,9 @@ ynh_script_progression --message="Loading installation settings..." domain=$(ynh_app_setting_get --app $app --key domain) path_url=$(ynh_normalize_url_path --path_url $(ynh_app_setting_get --app $app --key path)) admin=$(ynh_app_setting_get --app $app --key admin) +app_version=$(ynh_app_upstream_version) +app_main_version=$(echo $app_version | cut -d'-' -f1) +app_sub_version=$(echo $app_version | cut -d'-' -f2) # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=10