1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/snserver_ynh.git synced 2024-09-03 20:26:22 +02:00

Fix: upgrade & action scripts

This commit is contained in:
Fabian Wilkens 2022-08-10 23:15:43 +02:00
parent 9b4923aed7
commit 36600c3835
No known key found for this signature in database
GPG key ID: 23DFA025BB4E9FAB
2 changed files with 15 additions and 23 deletions

View file

@ -15,7 +15,7 @@ final_path=$(ynh_app_setting_get $app final_path)
if [ ! -f .env ] if [ ! -f .env ]
then then
export $(cat $final_path/cron.env | xargs) export $(cat $final_path/cron.env | grep -v -E "^#" | xargs)
fi fi
FILE_UPLOAD_BYTES_PER_MB=1048576 FILE_UPLOAD_BYTES_PER_MB=1048576

View file

@ -132,34 +132,24 @@ if [ -z "$redis_db" ]; then
fi fi
# If port_api_gateway doesn't exist, create it # If one port_* doesn't exist, create all new
if [ -z "$port_api_gateway" ]; then if [[ -z "$port_api_gateway" || \
-z "$port_auth" || \
-z "$port_auth_worker" || \
-z "$port_files" || \
-z "$port_syncing_server" || \
-z "$port_syncing_server_worker" ]]; then
port_api_gateway=$(ynh_find_port --port=3000) port_api_gateway=$(ynh_find_port --port=3000)
ynh_app_setting_set --app=$app --key=port_api_gateway --value=$port_api_gateway
fi
# If port_auth doesn't exist, create it
if [ -z "$port_auth" ]; then
port_auth=$(ynh_find_port --port=$((port_api_gateway+1))) port_auth=$(ynh_find_port --port=$((port_api_gateway+1)))
ynh_app_setting_set --app=$app --key=port_auth --value=$port_auth
fi
# If port_auth_worker doesn't exist, create it
if [ -z "$port_auth_worker" ]; then
port_auth_worker=$(ynh_find_port --port=$((port_auth+1))) port_auth_worker=$(ynh_find_port --port=$((port_auth+1)))
ynh_app_setting_set --app=$app --key=port_auth_worker --value=$port_auth_worker
fi
# If port_files doesn't exist, create it
if [ -z "$port_files" ]; then
port_files=$(ynh_find_port --port=$((port_auth_worker+1))) port_files=$(ynh_find_port --port=$((port_auth_worker+1)))
ynh_app_setting_set --app=$app --key=port_files --value=$port_files
fi
# If port_syncing_server doesn't exist, create it
if [ -z "$port_syncing_server" ]; then
port_syncing_server=$(ynh_find_port --port=$((port_files+1))) port_syncing_server=$(ynh_find_port --port=$((port_files+1)))
ynh_app_setting_set --app=$app --key=port_syncing_server --value=$port_syncing_server
fi
# If port_syncing_server_worker doesn't exist, create it
if [ -z "$port_syncing_server_worker" ]; then
port_syncing_server_worker=$(ynh_find_port --port=$((port_syncing_server+1))) port_syncing_server_worker=$(ynh_find_port --port=$((port_syncing_server+1)))
ynh_app_setting_set --app=$app --key=port_api_gateway --value=$port_api_gateway
ynh_app_setting_set --app=$app --key=port_auth --value=$port_auth
ynh_app_setting_set --app=$app --key=port_auth_worker --value=$port_auth_worker
ynh_app_setting_set --app=$app --key=port_files --value=$port_files
ynh_app_setting_set --app=$app --key=port_syncing_server --value=$port_syncing_server
ynh_app_setting_set --app=$app --key=port_syncing_server_worker --value=$port_syncing_server_worker ynh_app_setting_set --app=$app --key=port_syncing_server_worker --value=$port_syncing_server_worker
fi fi
@ -239,11 +229,13 @@ if ynh_exec_warn_less yunohost service status "$app-syncing-server-js" >/dev/nul
then then
ynh_script_progression --message="Removing old service..." --weight=1 ynh_script_progression --message="Removing old service..." --weight=1
yunohost service remove "$app-syncing-server-js" yunohost service remove "$app-syncing-server-js"
ynh_remove_systemd_config --service="$app-syncing-server-js"
fi fi
if ynh_exec_warn_less yunohost service status "$app-syncing-server-js-worker" >/dev/null if ynh_exec_warn_less yunohost service status "$app-syncing-server-js-worker" >/dev/null
then then
ynh_script_progression --message="Removing old service..." --weight=1 ynh_script_progression --message="Removing old service..." --weight=1
yunohost service remove "$app-syncing-server-js-worker" yunohost service remove "$app-syncing-server-js-worker"
ynh_remove_systemd_config --service="$app-syncing-server-worker-js"
fi fi
# Remove unneeded data # Remove unneeded data