1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/X-prober_ynh.git synced 2024-09-03 20:36:04 +02:00

Merge pull request #2 from jarod5001/testing

no data dir + nginc fix
This commit is contained in:
jarod5001 2022-03-18 23:34:00 +01:00 committed by GitHub
commit aa1c607f58
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 92 deletions

View file

@ -12,8 +12,7 @@
"license": "GPL-3.0",
"website": "https://prober.inn-studio.com/",
"demo": "https://prober.inn-studio.com/",
"admindoc": "https://yunohost.org/packaging_apps",
"userdoc": "https://yunohost.org/apps",
"userdoc": "https://github.com/kmvan/x-prober",
"code": "https://github.com/kmvan/x-prober"
},
"license": "GPL-3.0",
@ -46,8 +45,8 @@
"name": "phpversion",
"type": "string",
"ask": {
"en": "Choose a PHP version you want to use for your app",
"fr": "Choisissez une version PHP que vous souhaitez utiliser pour votre application"
"en": "Choose a PHP version you want to use for your app. Yes, 8 is better",
"fr": "Choisissez une version PHP que vous souhaitez utiliser pour votre application. Oui, la 8 est meilleure"
},
"choices" : ["7.4", "8.0"],
"default" : "8.0"

View file

@ -31,7 +31,7 @@ app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
domain=$(ynh_app_setting_get --app=$app --key=domain)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
#=================================================
# DECLARE DATA AND CONF FILES TO BACKUP
@ -49,12 +49,6 @@ ynh_print_info --message="Declaring files to be backed up..."
ynh_backup --src_path="$final_path"
#=================================================
# BACKUP THE DATA DIR
#=================================================
ynh_backup --src_path="$datadir" --is_big
#=================================================
# BACKUP THE NGINX CONFIGURATION
#=================================================

View file

@ -29,7 +29,6 @@ path_url=$YNH_APP_ARG_PATH
is_public=$YNH_APP_ARG_IS_PUBLIC
phpversion=$YNH_APP_ARG_PHPVERSION
### If it's a multi-instance app, meaning it can be installed several times independently
### The id of the app as stated in the manifest is available as $YNH_APP_ID
### The instance number is available as $YNH_APP_INSTANCE_NUMBER (equals "1", "2"...)
@ -78,17 +77,13 @@ ynh_app_setting_set --app=$app --key=phpversion --value=$phpversion
# INSTALL DEPENDENCIES
#=================================================
if [ $phpversion != "none" ]
then
ynh_script_progression --message="Installing dependencies..." --weight=2
ynh_install_app_dependencies "php${phpversion}-fpm"
fi
#=================================================
# STANDARD MODIFICATIONS
#=================================================
#=================================================
# CREATE DEDICATED USER
#=================================================
@ -150,42 +145,7 @@ ynh_script_progression --message="Configuring PHP-FPM..." --time --weight=1
ynh_add_fpm_config --usage=low --footprint=low --phpversion=$phpversion
#=================================================
# SPECIFIC SETUP
#=================================================
# ...
#=================================================
#=================================================
# CREATE DATA DIRECTORY
#=================================================
ynh_script_progression --message="Creating a data directory..." --time --weight=1
### Use these lines if you need to create a directory to store "persistent files" for the application.
### Usually this directory is used to store uploaded files or any file that won't be updated during
### an upgrade and that won't be deleted during app removal unless "--purge" option is used.
### If you're not using these lines:
### - Remove the section "BACKUP THE DATA DIR" in the backup script
### - Remove the section "RESTORE THE DATA DIRECTORY" in the restore script
### - As well as the section "REMOVE DATA DIR" in the remove script
datadir=/home/yunohost.app/$app
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
mkdir -p $datadir
# FIXME: this should be managed by the core in the future
# Here, as a packager, you may have to tweak the ownerhsip/permissions
# such that the appropriate users (e.g. maybe www-data) can access
# files in some cases.
# But FOR THE LOVE OF GOD, do not allow r/x for "others" on the entire folder -
# this will be treated as a security issue.
chmod 750 "$datadir"
chmod -R o-rwx "$datadir"
chown -R $app:www-data "$datadir"
#=================================================
# SETUP APPLICATION WITH CURL
# SETUP APPLICATION WITH CURL >>> to be removed
#=================================================
### Use these lines only if the app installation needs to be finalized through
@ -194,16 +154,16 @@ chown -R $app:www-data "$datadir"
### forms.
# Set the app as temporarily public for curl call
ynh_script_progression --message="Configuring SSOwat..." --time --weight=1
# ynh_script_progression --message="Configuring SSOwat..." --time --weight=1
# Making the app public for curl
ynh_permission_update --permission="main" --add="visitors"
# ynh_permission_update --permission="main" --add="visitors"
# Installation with curl
ynh_script_progression --message="Finalizing installation..." --time --weight=1
ynh_local_curl "/INSTALL_PATH" "key1=value1" "key2=value2" "key3=value3"
# ynh_script_progression --message="Finalizing installation..." --time --weight=1
# ynh_local_curl "/INSTALL_PATH" "key1=value1" "key2=value2" "key3=value3"
# Remove the public access
ynh_permission_update --permission="main" --remove="visitors"
# ynh_permission_update --permission="main" --remove="visitors"
#=================================================
# GENERIC FINALIZATION

View file

@ -32,7 +32,7 @@ domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
@ -76,25 +76,6 @@ chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#=================================================
# RESTORE THE DATA DIRECTORY
#=================================================
ynh_script_progression --message="Restoring the data directory..." --time --weight=1
ynh_restore_file --origin_path="$datadir" --not_mandatory
mkdir -p $datadir
# FIXME: this should be managed by the core in the future
# Here, as a packager, you may have to tweak the ownerhsip/permissions
# such that the appropriate users (e.g. maybe www-data) can access
# files in some cases.
# But FOR THE LOVE OF GOD, do not allow r/x for "others" on the entire folder -
# this will be treated as a security issue.
chmod 750 "$datadir"
chmod -R o-rwx "$datadir"
chown -R $app:www-data "$datadir"
#=================================================
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
@ -131,20 +112,6 @@ ynh_script_progression --message="Restoring the logrotate configuration..." --ti
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --time --weight=1
yunohost service add $app --description="A short description of the app" --log="/var/log/$app/$app.log"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --time --weight=1
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
#=================================================
# GENERIC FINALIZATION
#=================================================

View file

@ -19,6 +19,7 @@ app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# CHECK VERSION
@ -143,7 +144,7 @@ ynh_add_nginx_config
ynh_script_progression --message="Upgrading PHP-FPM configuration..." --time --weight=1
# Create a dedicated PHP-FPM config
ynh_add_fpm_config
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --phpversion=$phpversion
#=================================================
# SPECIFIC UPGRADE