diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 8f144f3..0000000 --- a/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -*~ -*.sw[op] -.DS_Store diff --git a/manifest.toml b/manifest.toml index d25ef79..639dec0 100644 --- a/manifest.toml +++ b/manifest.toml @@ -15,7 +15,7 @@ website = "https://www.cloudlog.co.uk" code = "https://github.com/magicbug/Cloudlog" [integration] -yunohost = ">= 11.2.23" +yunohost = ">= 11.2.29" helpers_version = "2.1" architectures = "all" multi_instance = true @@ -48,6 +48,7 @@ ram.runtime = "50M" [resources.system_user] [resources.install_dir] + group = "www-data:r-x" [resources.permissions] main.url = "/" diff --git a/scripts/backup b/scripts/backup index 2bfe7ea..94c3150 100755 --- a/scripts/backup +++ b/scripts/backup @@ -1,6 +1,5 @@ #!/bin/bash -# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers @@ -10,19 +9,19 @@ ynh_print_info "Declaring files to be backed up..." # BACKUP THE APP MAIN DIR #================================================= -ynh_backup --src_path="$install_dir" +ynh_backup "$install_dir" #================================================= # 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/php/$phpversion/fpm/pool.d/$app.conf" +ynh_backup "/etc/php/$php_version/fpm/pool.d/$app.conf" -ynh_backup --src_path="/etc/logrotate.d/$app" +ynh_backup "/etc/logrotate.d/$app" -ynh_backup --src_path="/etc/cron.d/$app" +ynh_backup "/etc/cron.d/$app" #================================================= # BACKUP THE MYSQL DATABASE diff --git a/scripts/config b/scripts/config deleted file mode 100644 index c4753d9..0000000 --- a/scripts/config +++ /dev/null @@ -1,95 +0,0 @@ -#!/bin/bash -# In simple cases, you don't need a config script. - -# With a simple config_panel.toml, you can write in the app settings, in the - -# upstream config file or replace complete files (logo ...) and restart services. - -# The config scripts allows you to go further, to handle specific cases - -# (validation of several interdependent fields, specific getter/setter for a value, -# display dynamic informations or choices, pre-loading of config type .cube... ). - -source /usr/share/yunohost/helpers - -ynh_abort_if_errors - -#================================================= -# RETRIEVE ARGUMENTS -#================================================= - -install_dir=$(ynh_app_setting_get --key=install_dir) - -#================================================= -# SPECIFIC GETTERS FOR TOML SHORT KEY -#================================================= - -get__amount() { - # Here we can imagine to have an API call to stripe to know the amount of donation during a month - local amount = 200 - - # It's possible to change some properties of the question by overriding it: - if [ $amount -gt 100 ] - then - cat << EOF -style: success -value: $amount -ask: - en: A lot of donation this month: **$amount €** -EOF - else - cat << EOF -style: danger -value: $amount -ask: - en: Not so much donation this month: $amount € -EOF - fi -} - -get__prices() { - local prices = "$(grep "DONATION\['" "$install_dir/settings.py" | sed -r "s@^DONATION\['([^']*)'\]\['([^']*)'\] = '([^']*)'@\1/\2/\3@g" | sed -z 's/\n/,/g;s/,$/\n/')" - if [ "$prices" == "," ]; - then - # Return YNH_NULL if you prefer to not return a value at all. - echo YNH_NULL - else - echo $prices - fi -} - -#================================================= -# SPECIFIC VALIDATORS FOR TOML SHORT KEYS -#================================================= -validate__publishable_key() { - - # We can imagine here we test if the key is really a publisheable key - (is_secret_key $publishable_key) && - echo 'This key seems to be a secret key' -} - -#================================================= -# SPECIFIC SETTERS FOR TOML SHORT KEYS -#================================================= -set__prices() { - - #--------------------------------------------- - # IMPORTANT: setter are trigger only if a change is detected - #--------------------------------------------- - for price in $(echo $prices | sed "s/,/ /"); do - frequency=$(echo $price | cut -d/ -f1) - currency=$(echo $price | cut -d/ -f2) - price_id=$(echo $price | cut -d/ -f3) - sed "d/DONATION\['$frequency'\]\['$currency'\]" "$install_dir/settings.py" - - echo "DONATION['$frequency']['$currency'] = '$price_id'" >> "$install_dir/settings.py" - done - - #--------------------------------------------- - # IMPORTANT: to be able to upgrade properly, you have to saved the value in settings too - #--------------------------------------------- - ynh_app_setting_set $app prices $prices -} - -#================================================= -ynh_app_config_run $1 diff --git a/scripts/install b/scripts/install index 7a829b0..61f9e7b 100755 --- a/scripts/install +++ b/scripts/install @@ -3,8 +3,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# APP "BUILD" (DEPLOYING SOURCES, VENV, COMPILING ETC) #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -14,8 +12,6 @@ ynh_setup_source --dest_dir="$install_dir" ynh_replace --match="define('ENVIRONMENT', 'development');" --replace="define('ENVIRONMENT', 'production');" --file=$install_dir/index.php -chown -R $app:www-data "$install_dir" - #================================================= # SYSTEM CONFIGURATION #================================================= @@ -28,15 +24,6 @@ ynh_config_add_nginx ynh_config_add_logrotate ynh_config_add --template="cron" --destination="/etc/cron.d/$app" -chown root: "/etc/cron.d/$app" -chmod 644 "/etc/cron.d/$app" - -#================================================= -# SETUP APPLICATION WITH CURL -#================================================= -ynh_script_progression "Finalizing installation..." - -ynh_local_curl "/install/index.php?submit" "username=$db_user" "password=$db_pwd" "database=$db_name" #================================================= # END OF SCRIPT diff --git a/scripts/restore b/scripts/restore index fcb2390..5092cb6 100755 --- a/scripts/restore +++ b/scripts/restore @@ -1,6 +1,5 @@ #!/bin/bash -# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers @@ -11,8 +10,6 @@ ynh_script_progression "Restoring the app main directory..." ynh_restore "$install_dir" -chown -R $app:www-data "$install_dir" - #================================================= # RESTORE THE MYSQL DATABASE #================================================= @@ -23,8 +20,6 @@ ynh_mysql_db_shell < ./db.sql #================================================= # RESTORE SYSTEM CONFIGURATIONS #================================================= -# RESTORE THE PHP-FPM CONFIGURATION -#================================================= ynh_script_progression "Restoring system configurations related to $app..." ynh_restore "/etc/php/$php_version/fpm/pool.d/$app.conf" diff --git a/scripts/upgrade b/scripts/upgrade index 0660b3f..48a0c57 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -3,8 +3,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# "REBUILD" THE APP (DEPLOY NEW SOURCES, RERUN NPM BUILD...) #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -14,8 +12,6 @@ ynh_setup_source --dest_dir="$install_dir" ynh_replace --match="define('ENVIRONMENT', 'development');" --replace="define('ENVIRONMENT', 'production');" --file=$install_dir/index.php -chown -R $app:www-data "$install_dir" - #================================================= # REAPPLY SYSTEM CONFIGURATIONS #=================================================