From 54d609c124c2eba89f75910cea363790c204a85b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sat, 4 Feb 2023 21:08:46 +0100 Subject: [PATCH 01/83] v2 --- conf/nginx_no_php.conf | 2 +- conf/nginx_with_php.conf | 2 +- manifest.toml | 76 +++++++++++++++++++++++++++++++++++ scripts/_common.sh | 32 +++++++-------- scripts/backup | 20 +++++----- scripts/install | 86 ++++++++++++++++++++-------------------- scripts/remove | 28 ++++++------- scripts/restore | 54 ++++++++++++------------- scripts/upgrade | 86 ++++++++++++++++++++-------------------- 9 files changed, 231 insertions(+), 155 deletions(-) create mode 100644 manifest.toml diff --git a/conf/nginx_no_php.conf b/conf/nginx_no_php.conf index e0eacb3..992aab7 100644 --- a/conf/nginx_no_php.conf +++ b/conf/nginx_no_php.conf @@ -2,7 +2,7 @@ location __PATH__/ { # Path to source - alias __FINALPATH__/www/; + alias __INSTALL_DIR__/www/; # Common parameter to increase upload size limit in conjunction with dedicated PHP-FPM file #client_max_body_size 1G; diff --git a/conf/nginx_with_php.conf b/conf/nginx_with_php.conf index a2367c5..9a9ad34 100644 --- a/conf/nginx_with_php.conf +++ b/conf/nginx_with_php.conf @@ -2,7 +2,7 @@ location __PATH__/ { # Path to source - alias __FINALPATH__/www/; + alias __INSTALL_DIR__/www/; # Common parameter to increase upload size limit in conjunction with dedicated PHP-FPM file #client_max_body_size 1G; diff --git a/manifest.toml b/manifest.toml new file mode 100644 index 0000000..d128921 --- /dev/null +++ b/manifest.toml @@ -0,0 +1,76 @@ +packaging_format = 2 + +id = "my_webapp" +name = "My Webapp" +description.en = "Custom Web app with SFTP access to serve static (HTML, CSS, JS) and PHP files" +description.fr = "Application Web personnalisée avec accès SFTP pour servir des fichiers statiques (HTML, CSS, JS) et PHP" + +version = "1.0~ynh12" + +maintainers = [] + +[upstream] +license = "GPL-3.0-only" +code = "https://github.com/YunoHost-Apps/my_webapp_ynh" +website = "https://github.com/YunoHost-Apps/my_webapp_ynh" +cpe = "???" # FIXME: optional but recommended if relevant, this is meant to contain the Common Platform Enumeration, which is sort of a standard id for applications defined by the NIST. In particular, Yunohost may use this is in the future to easily track CVE (=security reports) related to apps. The CPE may be obtained by searching here: https://nvd.nist.gov/products/cpe/search. For example, for Nextcloud, the CPE is 'cpe:2.3:a:nextcloud:nextcloud' (no need to include the version number) +fund = "???" # FIXME: optional but recommended (or remove if irrelevant / not applicable). This is meant to be an URL where people can financially support this app, especially when its development is based on volunteers and/or financed by its community. YunoHost may later advertise it in the webadmin. + +[integration] +yunohost = ">= 11.0.9" +architectures = "all" # FIXME: can be replaced by a list of supported archs using the dpkg --print-architecture nomenclature (amd64/i386/armhf/arm64), for example: ["amd64", "i386"] +multi_instance = true +ldap = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "sso" key : the "ldap" key corresponds to wether or not a user *can* login on the app using its YunoHost credentials. +sso = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "ldap" key : the "sso" key corresponds to wether or not a user is *automatically logged-in* on the app when logged-in on the YunoHost portal. +disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ... +ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... +ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... + +[install] + [install.domain] + # this is a generic question - ask strings are automatically handled by Yunohost's core + type = "domain" + + [install.path] + # this is a generic question - ask strings are automatically handled by Yunohost's core + type = "path" + default = "/site" + + [install.with_sftp] + ask.en = "Do you need a SFTP access?" + ask.fr = "Avez-vous besoin d'un accès SFTP ?" + type = "boolean" + default = true + + [install.password] + # this is a generic question - ask strings are automatically handled by Yunohost's core + type = "password" + optional = true + + [install.init_main_permission] + type = "group" + default = "visitors" + + [install.phpversion] + ask.en = "Choose a PHP version you want to use for your app" + ask.fr = "Choisissez une version PHP que vous souhaitez utiliser pour votre application" + type = "string" + choices = ["none", "7.3", "7.4", "8.0", "8.1", "8.2"] + default = "7.4" + + [install.with_mysql] + ask.en = "Do you need a MySQL database?" + ask.fr = "Avez-vous besoin d'une base de données MySQL ?" + type = "boolean" + default = false + +[resources] + [resources.system_user] + + [resources.install_dir] + + [resources.permissions] + main.url = "/" + + [resources.database] + type = "mysql" diff --git a/scripts/_common.sh b/scripts/_common.sh index 31498b2..701f83a 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -31,7 +31,7 @@ ynh_send_readme_to_admin() { type="${type:-install}" # Get the value of admin_mail_html - admin_mail_html=$(ynh_app_setting_get $app admin_mail_html) +#REMOVEME? admin_mail_html=$(ynh_app_setting_get $app admin_mail_html) admin_mail_html="${admin_mail_html:-0}" # Retrieve the email of users @@ -150,12 +150,12 @@ __PRE_TAG1__$(yunohost tools diagnosis | grep -B 100 "services:" | sed '/service #================================================= ynh_maintenance_mode_ON () { - # Load value of $path_url and $domain from the config if their not set - if [ -z $path_url ]; then - path_url=$(ynh_app_setting_get $app path) + # Load value of $path and $domain from the config if their not set + if [ -z $path ]; then +#REMOVEME? path=$(ynh_app_setting_get $app path) fi if [ -z $domain ]; then - domain=$(ynh_app_setting_get $app domain) +#REMOVEME? domain=$(ynh_app_setting_get $app domain) fi mkdir -p /var/www/html/ @@ -182,10 +182,10 @@ ynh_maintenance_mode_ON () { " > "/var/www/html/maintenance.$app.html" # Create a new nginx config file to redirect all access to the app to the maintenance notice instead. - echo "# All request to the app will be redirected to ${path_url}_maintenance and fall on the maintenance notice -rewrite ^${path_url}/(.*)$ ${path_url}_maintenance/? redirect; + echo "# All request to the app will be redirected to ${path}_maintenance and fall on the maintenance notice +rewrite ^${path}/(.*)$ ${path}_maintenance/? redirect; # Use another location, to not be in conflict with the original config file -location ${path_url}_maintenance/ { +location ${path}_maintenance/ { alias /var/www/html/ ; try_files maintenance.$app.html =503; @@ -196,7 +196,7 @@ include conf.d/yunohost_panel.conf.inc; # The current config file will redirect all requests to the root of the app. # To keep the full path, we can use the following rewrite rule: - # rewrite ^${path_url}/(.*)$ ${path_url}_maintenance/\$1? redirect; + # rewrite ^${path}/(.*)$ ${path}_maintenance/\$1? redirect; # The difference will be in the $1 at the end, which keep the following queries. # But, if it works perfectly for a html request, there's an issue with any php files. # This files are treated as simple files, and will be downloaded by the browser. @@ -206,16 +206,16 @@ include conf.d/yunohost_panel.conf.inc; } ynh_maintenance_mode_OFF () { - # Load value of $path_url and $domain from the config if their not set - if [ -z $path_url ]; then - path_url=$(ynh_app_setting_get $app path) + # Load value of $path and $domain from the config if their not set + if [ -z $path ]; then +#REMOVEME? path=$(ynh_app_setting_get $app path) fi if [ -z $domain ]; then - domain=$(ynh_app_setting_get $app domain) +#REMOVEME? domain=$(ynh_app_setting_get $app domain) fi - # Rewrite the nginx config file to redirect from ${path_url}_maintenance to the real url of the app. - echo "rewrite ^${path_url}_maintenance/(.*)$ ${path_url}/\$1 redirect;" > "/etc/nginx/conf.d/$domain.d/maintenance.$app.conf" + # Rewrite the nginx config file to redirect from ${path}_maintenance to the real url of the app. + echo "rewrite ^${path}_maintenance/(.*)$ ${path}/\$1 redirect;" > "/etc/nginx/conf.d/$domain.d/maintenance.$app.conf" systemctl reload nginx # Sleep 4 seconds to let the browser reload the pages and redirect the user to the app. @@ -265,7 +265,7 @@ ynh_app_changelog () { return 0 fi - local current_version=$(ynh_read_manifest --manifest="/etc/yunohost/apps/$YNH_APP_INSTANCE_NAME/manifest.json" --manifest_key="version") +#REMOVEME? local current_version=$(ynh_read_manifest --manifest="/etc/yunohost/apps/$YNH_APP_INSTANCE_NAME/manifest.json" --manifest_key="version") local update_version=$(ynh_read_manifest --manifest="../manifest.json" --manifest_key="version") # Get the line of the version to update to into the changelog diff --git a/scripts/backup b/scripts/backup index 2e90618..0ea702d 100644 --- a/scripts/backup +++ b/scripts/backup @@ -14,21 +14,21 @@ source /usr/share/yunohost/helpers #================================================= # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_print_info --message="Loading installation settings..." +#REMOVEME? ynh_print_info --message="Loading installation settings..." -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? 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) -db_name=$(ynh_app_setting_get --app=$app --key=db_name) -with_mysql=$(ynh_app_setting_get --app=$app --key=with_mysql) -with_sftp=$(ynh_app_setting_get --app=$app --key=with_sftp) -phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) +#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) +#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) +#REMOVEME? with_mysql=$(ynh_app_setting_get --app=$app --key=with_mysql) +#REMOVEME? with_sftp=$(ynh_app_setting_get --app=$app --key=with_sftp) +#REMOVEME? phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # DECLARE DATA AND CONF FILES TO BACKUP @@ -39,7 +39,7 @@ ynh_print_info --message="Declaring files to be backed up..." # BACKUP THE APP MAIN DIR #================================================= -ynh_backup --src_path="$final_path" +ynh_backup --src_path="$install_dir" #================================================= # BACKUP THE NGINX CONFIGURATION diff --git a/scripts/install b/scripts/install index f2f0ace..052d9a0 100644 --- a/scripts/install +++ b/scripts/install @@ -14,51 +14,51 @@ source /usr/share/yunohost/helpers #================================================= # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= -domain=$YNH_APP_ARG_DOMAIN -path_url=$YNH_APP_ARG_PATH -with_sftp=$YNH_APP_ARG_WITH_SFTP -password=$YNH_APP_ARG_PASSWORD -is_public=$YNH_APP_ARG_IS_PUBLIC -phpversion=$YNH_APP_ARG_PHPVERSION +#REMOVEME? domain=$YNH_APP_ARG_DOMAIN +#REMOVEME? path=$YNH_APP_ARG_PATH +#REMOVEME? with_sftp=$YNH_APP_ARG_WITH_SFTP +#REMOVEME? password=$YNH_APP_ARG_PASSWORD +#REMOVEME? is_public=$YNH_APP_ARG_IS_PUBLIC +#REMOVEME? phpversion=$YNH_APP_ARG_PHPVERSION -with_mysql=$YNH_APP_ARG_WITH_MYSQL +#REMOVEME? with_mysql=$YNH_APP_ARG_WITH_MYSQL -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME app_nb=$YNH_APP_INSTANCE_NUMBER #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= -ynh_script_progression --message="Validating installation parameters..." --weight=2 +#REMOVEME? ynh_script_progression --message="Validating installation parameters..." --weight=2 -final_path=/var/www/$app -test ! -e "$final_path" || ynh_die --message="This path already contains a folder" +#REMOVEME? install_dir=/var/www/$app +#REMOVEME? test ! -e "$install_dir" || ynh_die --message="This path already contains a folder" [ $with_sftp -eq 0 ] || [ "$password" != "" ] || ynh_die --message="You need to set a password to enable SFTP" # Register (book) web path -ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url +#REMOVEME? ynh_webpath_register --app=$app --domain=$domain --path=$path #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -ynh_script_progression --message="Storing installation settings..." +#REMOVEME? ynh_script_progression --message="Storing installation settings..." -ynh_app_setting_set --app=$app --key=domain --value=$domain -ynh_app_setting_set --app=$app --key=path --value=$path_url +#REMOVEME? ynh_app_setting_set --app=$app --key=domain --value=$domain +#REMOVEME? ynh_app_setting_set --app=$app --key=path --value=$path ynh_app_setting_set --app=$app --key=with_mysql --value=$with_mysql ynh_app_setting_set --app=$app --key=with_sftp --value=$with_sftp -ynh_app_setting_set --app=$app --key=password --value="$password" -ynh_app_setting_set --app=$app --key=final_path --value=$final_path +#REMOVEME? ynh_app_setting_set --app=$app --key=password --value="$password" +#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir ynh_app_setting_set --app=$app --key=phpversion --value=$phpversion -ynh_app_setting_set --app=$app --key=admin_mail_html --value=1 +#REMOVEME? ynh_app_setting_set --app=$app --key=admin_mail_html --value=1 #================================================= # STANDARD MODIFICATIONS @@ -68,9 +68,9 @@ ynh_app_setting_set --app=$app --key=admin_mail_html --value=1 if [ $phpversion != "none" ] then - ynh_script_progression --message="Installing dependencies..." --weight=2 +#REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=2 - ynh_install_app_dependencies "php${phpversion}-fpm" +#REMOVEME? ynh_install_app_dependencies "php${phpversion}-fpm" fi #================================================= @@ -79,13 +79,13 @@ fi if [ $with_mysql -eq 1 ] then - ynh_script_progression --message="Creating a MySQL database..." --weight=2 +#REMOVEME? ynh_script_progression --message="Creating a MySQL database..." --weight=2 - ynh_install_app_dependencies "php${phpversion}-mysql" +#REMOVEME? ynh_install_app_dependencies "php${phpversion}-mysql" db_name=$(ynh_sanitize_dbid --db_name=$app) - ynh_app_setting_set --app=$app --key=db_name --value=$db_name - ynh_mysql_setup_db --db_user=$db_name --db_name=$db_name +#REMOVEME? ynh_app_setting_set --app=$app --key=db_name --value=$db_name +#REMOVEME? ynh_mysql_setup_db --db_user=$db_name --db_name=$db_name fi #================================================= @@ -108,7 +108,7 @@ ynh_add_nginx_config #================================================= # CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Configuring system user..." +#REMOVEME? ynh_script_progression --message="Configuring system user..." if [ $with_sftp -eq 1 ] then @@ -117,7 +117,7 @@ else groups="" fi -ynh_system_user_create --username=$app --home_dir="$final_path" --groups="$groups" +#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" --groups="$groups" if [ $with_sftp -eq 1 ] then @@ -131,16 +131,16 @@ fi # MODIFY A CONFIG FILE #================================================= -mkdir -p "$final_path/www" +mkdir -p "$install_dir/www" if [ $with_sftp -eq 1 ] then - ynh_add_config --template="../sources/www/index.html" --destination="$final_path/www/index.html" + ynh_add_config --template="../sources/www/index.html" --destination="$install_dir/www/index.html" else # Copy files to the right place - cp "../sources/www/index_no_sftp.html" "$final_path/www/index.html" + cp "../sources/www/index_no_sftp.html" "$install_dir/www/index.html" fi if [ $with_mysql -eq 1 ]; then @@ -149,16 +149,16 @@ if [ $with_mysql -eq 1 ]; then name: ${db_name}\nuser: ${db_name}\npass: ${db_pwd}" > ../sources/db_access.txt # Copy files to the right place - cp -r "../sources/db_access.txt" "$final_path/db_access.txt" + cp -r "../sources/db_access.txt" "$install_dir/db_access.txt" fi -chown -R $app:www-data "$final_path" +chown -R $app:www-data "$install_dir" # Home directory of the user needs to be owned by root to allow # SFTP connections -chown root:root "$final_path" -setfacl -m g:$app:r-x "$final_path" -setfacl -m g:www-data:r-x "$final_path" -chmod 750 "$final_path" +chown root:root "$install_dir" +setfacl -m g:$app:r-x "$install_dir" +setfacl -m g:www-data:r-x "$install_dir" +chmod 750 "$install_dir" #================================================= # PHP-FPM CONFIGURATION @@ -190,20 +190,20 @@ fi #================================================= # SETUP SSOWAT #================================================= -ynh_script_progression --message="Configuring permissions..." +#REMOVEME? ynh_script_progression --message="Configuring permissions..." # Make app public if necessary -if [ $is_public -eq 1 ] +#REMOVEME? if [ $is_public -eq 1 ] then - ynh_permission_update --permission="main" --add="visitors" +#REMOVEME? ynh_permission_update --permission="main" --add="visitors" fi #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." +#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." -ynh_systemd_action --service_name=nginx --action=reload +#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload #================================================= # SEND A README FOR THE ADMIN @@ -216,7 +216,7 @@ if [ $with_mysql -eq 1 ] then sql_infos=" You've asked for a database, please find here the information about this SQL database. -$(cat "$final_path/db_access.txt") +$(cat "$install_dir/db_access.txt") " else sql_infos="" @@ -235,7 +235,7 @@ fi echo "This app is simply a blank web app container. You have to put your own app inside. $sql_infos -Please put your files into this directory: $final_path/www/ +Please put your files into this directory: $install_dir/www/ $sftp_infos You can configure this app easily by using the experimental __URL_TAG1__config-panel feature__URL_TAG2__$admin_panel/config-panel__URL_TAG3__. diff --git a/scripts/remove b/scripts/remove index e9952b0..9861420 100644 --- a/scripts/remove +++ b/scripts/remove @@ -12,17 +12,17 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --weight=2 +#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=2 -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get --app=$app --key=domain) -with_mysql=$(ynh_app_setting_get --app=$app --key=with_mysql) -with_sftp=$(ynh_app_setting_get --app=$app --key=with_sftp) +#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) +#REMOVEME? with_mysql=$(ynh_app_setting_get --app=$app --key=with_mysql) +#REMOVEME? with_sftp=$(ynh_app_setting_get --app=$app --key=with_sftp) -db_name=$(ynh_app_setting_get --app=$app --key=db_name) -db_user=$db_name -final_path=$(ynh_app_setting_get --app=$app --key=final_path) +#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) +#REMOVEME? db_user=$db_name +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) #================================================= # STANDARD REMOVE @@ -31,19 +31,19 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= if [ $with_mysql -eq 1 ]; then - ynh_script_progression --message="Removing the MySQL database..." --weight=2 +#REMOVEME? ynh_script_progression --message="Removing the MySQL database..." --weight=2 # Remove a database if it exists, along with the associated user - ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name +#REMOVEME? ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name fi #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_script_progression --message="Removing app main directory..." +#REMOVEME? ynh_script_progression --message="Removing app main directory..." # Remove the app directory securely -ynh_secure_remove --file="$final_path" +#REMOVEME? ynh_secure_remove --file="$install_dir" #================================================= # REMOVE NGINX CONFIGURATION @@ -70,10 +70,10 @@ ynh_remove_fpm_config #================================================= # REMOVE DEDICATED USER #================================================= -ynh_script_progression --message="Removing the dedicated system user..." +#REMOVEME? ynh_script_progression --message="Removing the dedicated system user..." # Delete a system user -ynh_system_user_delete --username=$app +#REMOVEME? ynh_system_user_delete --username=$app #================================================= # END OF SCRIPT diff --git a/scripts/restore b/scripts/restore index dec9279..15cc11a 100644 --- a/scripts/restore +++ b/scripts/restore @@ -14,31 +14,31 @@ source /usr/share/yunohost/helpers #================================================= # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= ynh_script_progression --message="Loading settings..." --weight=2 -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? 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) -db_name=$(ynh_app_setting_get --app=$app --key=db_name) -with_mysql=$(ynh_app_setting_get --app=$app --key=with_mysql) -with_sftp=$(ynh_app_setting_get --app=$app --key=with_sftp) -password=$(ynh_app_setting_get --app=$app --key=password) -phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) +#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) +#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) +#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) +#REMOVEME? with_mysql=$(ynh_app_setting_get --app=$app --key=with_mysql) +#REMOVEME? with_sftp=$(ynh_app_setting_get --app=$app --key=with_sftp) +#REMOVEME? password=$(ynh_app_setting_get --app=$app --key=password) +#REMOVEME? phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= -ynh_script_progression --message="Validating restoration parameters..." --weight=2 +#REMOVEME? ynh_script_progression --message="Validating restoration parameters..." --weight=2 -test ! -d $final_path \ - || ynh_die --message="There is already a directory: $final_path " +#REMOVEME? test ! -d $install_dir \ + || ynh_die --message="There is already a directory: $install_dir " #================================================= # STANDARD RESTORATION STEPS @@ -48,9 +48,9 @@ test ! -d $final_path \ if [ $phpversion != "none" ] then - ynh_script_progression --message="Reinstalling dependencies..." --weight=2 +#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." --weight=2 - ynh_install_app_dependencies "php${phpversion}-fpm" +#REMOVEME? ynh_install_app_dependencies "php${phpversion}-fpm" fi #================================================= @@ -64,19 +64,19 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= if [ $with_mysql -eq 1 ]; then - ynh_script_progression --message="Restoring the MySQL database..." +#REMOVEME? ynh_script_progression --message="Restoring the MySQL database..." - ynh_install_app_dependencies "php${phpversion}-mysql" +#REMOVEME? ynh_install_app_dependencies "php${phpversion}-mysql" - db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) - ynh_mysql_setup_db --db_user=$db_name --db_name=$db_name --db_pwd=$db_pwd +#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) +#REMOVEME? ynh_mysql_setup_db --db_user=$db_name --db_name=$db_name --db_pwd=$db_pwd ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name < ./db.sql fi #================================================= # RECREATE THE DEDICATED USER #================================================= -ynh_script_progression --message="Recreating the dedicated system user..." --weight=2 +#REMOVEME? ynh_script_progression --message="Recreating the dedicated system user..." --weight=2 if [ $with_sftp -eq 1 ] then @@ -85,7 +85,7 @@ else groups="" fi -ynh_system_user_create --username=$app --home_dir="$final_path" --groups="$groups" +#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" --groups="$groups" if [ -n "$password" ] then @@ -98,16 +98,16 @@ fi #================================================= ynh_script_progression --message="Restoring the app main directory..." -ynh_restore_file --origin_path="$final_path" +ynh_restore_file --origin_path="$install_dir" # Restore permissions on app files -chown -R $app:www-data "$final_path" +chown -R $app:www-data "$install_dir" # Home directory of the user needs to be owned by root to allow # SFTP connections -chown root:root "$final_path" -setfacl -m g:$app:r-x "$final_path" -setfacl -m g:www-data:r-x "$final_path" -chmod 750 "$final_path" +chown root:root "$install_dir" +setfacl -m g:$app:r-x "$install_dir" +setfacl -m g:www-data:r-x "$install_dir" +chmod 750 "$install_dir" #================================================= # RESTORE THE PHP-FPM CONFIGURATION diff --git a/scripts/upgrade b/scripts/upgrade index f65ad0e..63878d5 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,24 +12,24 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --weight=2 +#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=2 -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? 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) -db_name=$(ynh_app_setting_get --app=$app --key=db_name) -with_mysql=$(ynh_app_setting_get --app=$app --key=with_mysql) -with_sftp=$(ynh_app_setting_get --app=$app --key=with_sftp) -password=$(ynh_app_setting_get --app=$app --key=password) -phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) +#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) +#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) +#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) +#REMOVEME? with_mysql=$(ynh_app_setting_get --app=$app --key=with_mysql) +#REMOVEME? with_sftp=$(ynh_app_setting_get --app=$app --key=with_sftp) +#REMOVEME? password=$(ynh_app_setting_get --app=$app --key=password) +#REMOVEME? phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) -admin_mail_html=$(ynh_app_setting_get --app=$app --key=admin_mail_html) +#REMOVEME? admin_mail_html=$(ynh_app_setting_get --app=$app --key=admin_mail_html) -fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint) -fpm_free_footprint=$(ynh_app_setting_get --app=$app --key=fpm_free_footprint) -fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage) +#REMOVEME? fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint) +#REMOVEME? fpm_free_footprint=$(ynh_app_setting_get --app=$app --key=fpm_free_footprint) +#REMOVEME? fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage) #================================================= # CHECK VERSION @@ -40,16 +40,16 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=3 +#REMOVEME? ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=3 # Backup the current version of the app -ynh_backup_before_upgrade -ynh_clean_setup () { +#REMOVEME? ynh_backup_before_upgrade +#REMOVEME? ynh_clean_setup () { # restore it if the upgrade fails - ynh_restore_upgradebackup +#REMOVEME? ynh_restore_upgradebackup } # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # ENSURE DOWNWARD COMPATIBILITY @@ -59,19 +59,19 @@ ynh_script_progression --message="Ensuring downward compatibility..." # If db_name doesn't exist, create it if [ -z "$db_name" ]; then db_name=$(ynh_sanitize_dbid --db_name=$app) - ynh_app_setting_set --app=$app --key=db_name --value=$db_name +#REMOVEME? ynh_app_setting_set --app=$app --key=db_name --value=$db_name fi -# If final_path doesn't exist, create it -if [ -z "$final_path" ]; then - final_path=/var/www/$app - ynh_app_setting_set --app=$app --key=final_path --value=$final_path +# If install_dir doesn't exist, create it +if [ -z "$install_dir" ]; then +#REMOVEME? install_dir=/var/www/$app +#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir fi # If admin_mail_html doesn't exist, create it if [ -z "$admin_mail_html" ]; then admin_mail_html=1 - ynh_app_setting_set --app=$app --key=admin_mail_html --value=$admin_mail_html +#REMOVEME? ynh_app_setting_set --app=$app --key=admin_mail_html --value=$admin_mail_html fi # If fpm_footprint doesn't exist, create it @@ -105,22 +105,22 @@ if [ -z "$phpversion" ]; then fi # Delete old user -if [ -n "$(ynh_app_setting_get --app=$app --key=user)" ] +#REMOVEME? if [ -n "$(ynh_app_setting_get --app=$app --key=user)" ] then ynh_systemd_action --service_name=php${phpversion}-fpm --action=stop - ynh_system_user_delete --username="$(ynh_app_setting_get --app=$app --key=user)" +#REMOVEME? #REMOVEME? ynh_system_user_delete --username="$(ynh_app_setting_get --app=$app --key=user)" ynh_app_setting_delete --app=$app --key=user fi # Cleaning legacy permissions -if ynh_legacy_permissions_exists; then - ynh_legacy_permissions_delete_all +#REMOVEME? if ynh_legacy_permissions_exists; then +#REMOVEME? ynh_legacy_permissions_delete_all ynh_app_setting_delete --app=$app --key=is_public fi # Ensure password is a setting even if empty, for the config panel -ynh_app_setting_set --app=$app --key=password --value="$password" +#REMOVEME? ynh_app_setting_set --app=$app --key=password --value="$password" #================================================= # ACTIVATE MAINTENANCE MODE @@ -137,14 +137,14 @@ ynh_maintenance_mode_ON if [ $phpversion != "none" ] then - ynh_script_progression --message="Installing dependencies..." --weight=2 +#REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=2 - ynh_install_app_dependencies "php${phpversion}-fpm" +#REMOVEME? ynh_install_app_dependencies "php${phpversion}-fpm" fi if [ $with_mysql -eq 1 ] then - ynh_install_app_dependencies "php${phpversion}-mysql" +#REMOVEME? ynh_install_app_dependencies "php${phpversion}-mysql" fi #================================================= @@ -168,7 +168,7 @@ ynh_add_nginx_config #================================================= # CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." --weight=2 +#REMOVEME? ynh_script_progression --message="Making sure dedicated system user exists..." --weight=2 if [ $with_sftp -eq 1 ] then @@ -177,7 +177,7 @@ else groups="" fi -ynh_system_user_create --username=$app --home_dir="$final_path" --groups="$groups" +#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" --groups="$groups" if [ -n "$password" ] then @@ -211,20 +211,20 @@ fi # SECURE FILES AND DIRECTORIES #================================================= -chown -R $app:www-data "$final_path" +chown -R $app:www-data "$install_dir" # Home directory of the user needs to be owned by root to allow # SFTP connections -chown root:root "$final_path" -setfacl -m g:$app:r-x "$final_path" -setfacl -m g:www-data:r-x "$final_path" -chmod 750 "$final_path" +chown root:root "$install_dir" +setfacl -m g:$app:r-x "$install_dir" +setfacl -m g:www-data:r-x "$install_dir" +chmod 750 "$install_dir" #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." +#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." -ynh_systemd_action --service_name=nginx --action=reload +#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload #================================================= # DEACTIVE MAINTENANCE MODE @@ -242,7 +242,7 @@ admin_panel="https://$(grep portal_domain /etc/ssowat/conf.json | cut -d'"' -f4) # Build the changelog # Get the value of admin_mail_html -admin_mail_html=$(ynh_app_setting_get $app admin_mail_html) +#REMOVEME? admin_mail_html=$(ynh_app_setting_get $app admin_mail_html) admin_mail_html="${admin_mail_html:-0}" # If a html email is required. Apply html to the changelog. if [ "$admin_mail_html" -eq 1 ]; then From ff58e1d00c80a2d611f45277e62834839efdcd75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sat, 4 Feb 2023 21:20:44 +0100 Subject: [PATCH 02/83] Fix --- manifest.toml | 17 ++++------ scripts/_common.sh | 10 +++--- scripts/backup | 19 ++--------- scripts/install | 68 ++++++------------------------------- scripts/remove | 39 +++------------------ scripts/restore | 40 ++++++---------------- scripts/upgrade | 84 +++++++++------------------------------------- tests.toml | 11 ++++++ 8 files changed, 67 insertions(+), 221 deletions(-) create mode 100644 tests.toml diff --git a/manifest.toml b/manifest.toml index d128921..97a11d6 100644 --- a/manifest.toml +++ b/manifest.toml @@ -17,22 +17,20 @@ cpe = "???" # FIXME: optional but recommended if relevant, this is meant to cont fund = "???" # FIXME: optional but recommended (or remove if irrelevant / not applicable). This is meant to be an URL where people can financially support this app, especially when its development is based on volunteers and/or financed by its community. YunoHost may later advertise it in the webadmin. [integration] -yunohost = ">= 11.0.9" -architectures = "all" # FIXME: can be replaced by a list of supported archs using the dpkg --print-architecture nomenclature (amd64/i386/armhf/arm64), for example: ["amd64", "i386"] +yunohost = ">= 11.1.5" +architectures = "all" multi_instance = true -ldap = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "sso" key : the "ldap" key corresponds to wether or not a user *can* login on the app using its YunoHost credentials. -sso = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "ldap" key : the "sso" key corresponds to wether or not a user is *automatically logged-in* on the app when logged-in on the YunoHost portal. -disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ... -ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... -ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... +ldap = "not_relevant" +sso = "not_relevant" +disk = "50M" +ram.build = "50M" +ram.runtime = "50M" [install] [install.domain] - # this is a generic question - ask strings are automatically handled by Yunohost's core type = "domain" [install.path] - # this is a generic question - ask strings are automatically handled by Yunohost's core type = "path" default = "/site" @@ -43,7 +41,6 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen default = true [install.password] - # this is a generic question - ask strings are automatically handled by Yunohost's core type = "password" optional = true diff --git a/scripts/_common.sh b/scripts/_common.sh index 701f83a..60ee568 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -31,7 +31,7 @@ ynh_send_readme_to_admin() { type="${type:-install}" # Get the value of admin_mail_html -#REMOVEME? admin_mail_html=$(ynh_app_setting_get $app admin_mail_html) + admin_mail_html=$(ynh_app_setting_get $app admin_mail_html) admin_mail_html="${admin_mail_html:-0}" # Retrieve the email of users @@ -152,10 +152,10 @@ __PRE_TAG1__$(yunohost tools diagnosis | grep -B 100 "services:" | sed '/service ynh_maintenance_mode_ON () { # Load value of $path and $domain from the config if their not set if [ -z $path ]; then -#REMOVEME? path=$(ynh_app_setting_get $app path) + path=$(ynh_app_setting_get $app path) fi if [ -z $domain ]; then -#REMOVEME? domain=$(ynh_app_setting_get $app domain) + domain=$(ynh_app_setting_get $app domain) fi mkdir -p /var/www/html/ @@ -208,10 +208,10 @@ include conf.d/yunohost_panel.conf.inc; ynh_maintenance_mode_OFF () { # Load value of $path and $domain from the config if their not set if [ -z $path ]; then -#REMOVEME? path=$(ynh_app_setting_get $app path) + path=$(ynh_app_setting_get $app path) fi if [ -z $domain ]; then -#REMOVEME? domain=$(ynh_app_setting_get $app domain) + domain=$(ynh_app_setting_get $app domain) fi # Rewrite the nginx config file to redirect from ${path}_maintenance to the real url of the app. diff --git a/scripts/backup b/scripts/backup index 0ea702d..a9a1629 100644 --- a/scripts/backup +++ b/scripts/backup @@ -9,26 +9,13 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - #================================================= # LOAD SETTINGS #================================================= -#REMOVEME? ynh_print_info --message="Loading installation settings..." +ynh_print_info --message="Loading installation settings..." -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) -#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) -#REMOVEME? with_mysql=$(ynh_app_setting_get --app=$app --key=with_mysql) -#REMOVEME? with_sftp=$(ynh_app_setting_get --app=$app --key=with_sftp) -#REMOVEME? phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) +with_mysql=$(ynh_app_setting_get --app=$app --key=with_mysql) +with_sftp=$(ynh_app_setting_get --app=$app --key=with_sftp) #================================================= # DECLARE DATA AND CONF FILES TO BACKUP diff --git a/scripts/install b/scripts/install index 052d9a0..5b55f2e 100644 --- a/scripts/install +++ b/scripts/install @@ -9,56 +9,28 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - #================================================= # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= -#REMOVEME? domain=$YNH_APP_ARG_DOMAIN -#REMOVEME? path=$YNH_APP_ARG_PATH -#REMOVEME? with_sftp=$YNH_APP_ARG_WITH_SFTP -#REMOVEME? password=$YNH_APP_ARG_PASSWORD -#REMOVEME? is_public=$YNH_APP_ARG_IS_PUBLIC -#REMOVEME? phpversion=$YNH_APP_ARG_PHPVERSION - -#REMOVEME? with_mysql=$YNH_APP_ARG_WITH_MYSQL - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME app_nb=$YNH_APP_INSTANCE_NUMBER #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= -#REMOVEME? ynh_script_progression --message="Validating installation parameters..." --weight=2 - -#REMOVEME? install_dir=/var/www/$app -#REMOVEME? test ! -e "$install_dir" || ynh_die --message="This path already contains a folder" +REMOVEME? ynh_script_progression --message="Validating installation parameters..." --weight=2 [ $with_sftp -eq 0 ] || [ "$password" != "" ] || ynh_die --message="You need to set a password to enable SFTP" -# Register (book) web path -#REMOVEME? ynh_webpath_register --app=$app --domain=$domain --path=$path - #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -#REMOVEME? ynh_script_progression --message="Storing installation settings..." +ynh_script_progression --message="Storing installation settings..." -#REMOVEME? ynh_app_setting_set --app=$app --key=domain --value=$domain -#REMOVEME? ynh_app_setting_set --app=$app --key=path --value=$path ynh_app_setting_set --app=$app --key=with_mysql --value=$with_mysql ynh_app_setting_set --app=$app --key=with_sftp --value=$with_sftp -#REMOVEME? ynh_app_setting_set --app=$app --key=password --value="$password" -#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir ynh_app_setting_set --app=$app --key=phpversion --value=$phpversion - -#REMOVEME? ynh_app_setting_set --app=$app --key=admin_mail_html --value=1 +ynh_app_setting_set --app=$app --key=admin_mail_html --value=1 #================================================= # STANDARD MODIFICATIONS @@ -68,9 +40,9 @@ ynh_app_setting_set --app=$app --key=phpversion --value=$phpversion if [ $phpversion != "none" ] then -#REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=2 + ynh_script_progression --message="Installing dependencies..." --weight=2 -#REMOVEME? ynh_install_app_dependencies "php${phpversion}-fpm" + ynh_install_app_dependencies "php${phpversion}-fpm" fi #================================================= @@ -79,13 +51,13 @@ fi if [ $with_mysql -eq 1 ] then -#REMOVEME? ynh_script_progression --message="Creating a MySQL database..." --weight=2 + ynh_script_progression --message="Creating a MySQL database..." --weight=2 -#REMOVEME? ynh_install_app_dependencies "php${phpversion}-mysql" + ynh_install_app_dependencies "php${phpversion}-mysql" db_name=$(ynh_sanitize_dbid --db_name=$app) -#REMOVEME? ynh_app_setting_set --app=$app --key=db_name --value=$db_name -#REMOVEME? ynh_mysql_setup_db --db_user=$db_name --db_name=$db_name + ynh_app_setting_set --app=$app --key=db_name --value=$db_name + ynh_mysql_setup_db --db_user=$db_name --db_name=$db_name fi #================================================= @@ -117,7 +89,7 @@ else groups="" fi -#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" --groups="$groups" + ynh_system_user_create --username=$app --home_dir="$install_dir" --groups="$groups" if [ $with_sftp -eq 1 ] then @@ -185,26 +157,6 @@ else ynh_app_setting_set --app=$app --key=fpm_free_footprint --value=0 fi -#================================================= -# GENERIC FINALIZATION -#================================================= -# SETUP SSOWAT -#================================================= -#REMOVEME? ynh_script_progression --message="Configuring permissions..." - -# Make app public if necessary -#REMOVEME? if [ $is_public -eq 1 ] -then -#REMOVEME? ynh_permission_update --permission="main" --add="visitors" -fi - -#================================================= -# RELOAD NGINX -#================================================= -#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." - -#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload - #================================================= # SEND A README FOR THE ADMIN #================================================= diff --git a/scripts/remove b/scripts/remove index 9861420..ba62ebb 100644 --- a/scripts/remove +++ b/scripts/remove @@ -12,17 +12,10 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=2 +ynh_script_progression --message="Loading installation settings..." --weight=2 -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) -#REMOVEME? with_mysql=$(ynh_app_setting_get --app=$app --key=with_mysql) -#REMOVEME? with_sftp=$(ynh_app_setting_get --app=$app --key=with_sftp) - -#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) -#REMOVEME? db_user=$db_name -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) +with_mysql=$(ynh_app_setting_get --app=$app --key=with_mysql) +with_sftp=$(ynh_app_setting_get --app=$app --key=with_sftp) #================================================= # STANDARD REMOVE @@ -31,20 +24,12 @@ source /usr/share/yunohost/helpers #================================================= if [ $with_mysql -eq 1 ]; then -#REMOVEME? ynh_script_progression --message="Removing the MySQL database..." --weight=2 + ynh_script_progression --message="Removing the MySQL database..." --weight=2 # Remove a database if it exists, along with the associated user -#REMOVEME? ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name + ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name fi -#================================================= -# REMOVE APP MAIN DIR -#================================================= -#REMOVEME? ynh_script_progression --message="Removing app main directory..." - -# Remove the app directory securely -#REMOVEME? ynh_secure_remove --file="$install_dir" - #================================================= # REMOVE NGINX CONFIGURATION #================================================= @@ -61,20 +46,6 @@ ynh_script_progression --message="Removing PHP-FPM configuration..." # Remove the dedicated PHP-FPM config ynh_remove_fpm_config -#================================================= -# SPECIFIC REMOVE -#================================================= - -#================================================= -# GENERIC FINALIZATION -#================================================= -# REMOVE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Removing the dedicated system user..." - -# Delete a system user -#REMOVEME? ynh_system_user_delete --username=$app - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/restore b/scripts/restore index 15cc11a..82b26a1 100644 --- a/scripts/restore +++ b/scripts/restore @@ -21,24 +21,8 @@ source /usr/share/yunohost/helpers #================================================= ynh_script_progression --message="Loading settings..." --weight=2 -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) -#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) -#REMOVEME? with_mysql=$(ynh_app_setting_get --app=$app --key=with_mysql) -#REMOVEME? with_sftp=$(ynh_app_setting_get --app=$app --key=with_sftp) -#REMOVEME? password=$(ynh_app_setting_get --app=$app --key=password) -#REMOVEME? phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) - -#================================================= -# CHECK IF THE APP CAN BE RESTORED -#================================================= -#REMOVEME? ynh_script_progression --message="Validating restoration parameters..." --weight=2 - -#REMOVEME? test ! -d $install_dir \ - || ynh_die --message="There is already a directory: $install_dir " +with_mysql=$(ynh_app_setting_get --app=$app --key=with_mysql) +with_sftp=$(ynh_app_setting_get --app=$app --key=with_sftp) #================================================= # STANDARD RESTORATION STEPS @@ -48,9 +32,9 @@ ynh_script_progression --message="Loading settings..." --weight=2 if [ $phpversion != "none" ] then -#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." --weight=2 + ynh_script_progression --message="Reinstalling dependencies..." --weight=2 -#REMOVEME? ynh_install_app_dependencies "php${phpversion}-fpm" + ynh_install_app_dependencies "php${phpversion}-fpm" fi #================================================= @@ -64,19 +48,19 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= if [ $with_mysql -eq 1 ]; then -#REMOVEME? ynh_script_progression --message="Restoring the MySQL database..." + ynh_script_progression --message="Restoring the MySQL database..." -#REMOVEME? ynh_install_app_dependencies "php${phpversion}-mysql" + ynh_install_app_dependencies "php${phpversion}-mysql" -#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) -#REMOVEME? ynh_mysql_setup_db --db_user=$db_name --db_name=$db_name --db_pwd=$db_pwd + db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) + ynh_mysql_setup_db --db_user=$db_name --db_name=$db_name --db_pwd=$db_pwd ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name < ./db.sql fi #================================================= # RECREATE THE DEDICATED USER #================================================= -#REMOVEME? ynh_script_progression --message="Recreating the dedicated system user..." --weight=2 +ynh_script_progression --message="Recreating the dedicated system user..." --weight=2 if [ $with_sftp -eq 1 ] then @@ -85,7 +69,7 @@ else groups="" fi -#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" --groups="$groups" +ynh_system_user_create --username=$app --home_dir="$install_dir" --groups="$groups" if [ -n "$password" ] then @@ -118,10 +102,6 @@ then ynh_restore_file --origin_path="/etc/php/${phpversion}/fpm/pool.d/$app.conf" fi -#================================================= -# SPECIFIC RESTORATION -#================================================= - #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 63878d5..2bd5a72 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,24 +12,16 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=2 +ynh_script_progression --message="Loading installation settings..." --weight=2 -#REMOVEME? app=$YNH_APP_INSTANCE_NAME +with_mysql=$(ynh_app_setting_get --app=$app --key=with_mysql) +with_sftp=$(ynh_app_setting_get --app=$app --key=with_sftp) -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) -#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) -#REMOVEME? with_mysql=$(ynh_app_setting_get --app=$app --key=with_mysql) -#REMOVEME? with_sftp=$(ynh_app_setting_get --app=$app --key=with_sftp) -#REMOVEME? password=$(ynh_app_setting_get --app=$app --key=password) -#REMOVEME? phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) +admin_mail_html=$(ynh_app_setting_get --app=$app --key=admin_mail_html) -#REMOVEME? admin_mail_html=$(ynh_app_setting_get --app=$app --key=admin_mail_html) - -#REMOVEME? fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint) -#REMOVEME? fpm_free_footprint=$(ynh_app_setting_get --app=$app --key=fpm_free_footprint) -#REMOVEME? fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage) +fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint) +fpm_free_footprint=$(ynh_app_setting_get --app=$app --key=fpm_free_footprint) +fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage) #================================================= # CHECK VERSION @@ -37,41 +29,15 @@ source /usr/share/yunohost/helpers upgrade_type=$(ynh_check_app_version_changed) -#================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP -#================================================= -#REMOVEME? ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=3 - -# Backup the current version of the app -#REMOVEME? ynh_backup_before_upgrade -#REMOVEME? ynh_clean_setup () { - # restore it if the upgrade fails -#REMOVEME? ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= ynh_script_progression --message="Ensuring downward compatibility..." -# If db_name doesn't exist, create it -if [ -z "$db_name" ]; then - db_name=$(ynh_sanitize_dbid --db_name=$app) -#REMOVEME? ynh_app_setting_set --app=$app --key=db_name --value=$db_name -fi - -# If install_dir doesn't exist, create it -if [ -z "$install_dir" ]; then -#REMOVEME? install_dir=/var/www/$app -#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir -fi - # If admin_mail_html doesn't exist, create it if [ -z "$admin_mail_html" ]; then admin_mail_html=1 -#REMOVEME? ynh_app_setting_set --app=$app --key=admin_mail_html --value=$admin_mail_html + #REMOVEME? ynh_app_setting_set --app=$app --key=admin_mail_html --value=$admin_mail_html fi # If fpm_footprint doesn't exist, create it @@ -105,22 +71,15 @@ if [ -z "$phpversion" ]; then fi # Delete old user -#REMOVEME? if [ -n "$(ynh_app_setting_get --app=$app --key=user)" ] +if [ -n "$(ynh_app_setting_get --app=$app --key=user)" ] then ynh_systemd_action --service_name=php${phpversion}-fpm --action=stop -#REMOVEME? #REMOVEME? ynh_system_user_delete --username="$(ynh_app_setting_get --app=$app --key=user)" + ynh_system_user_delete --username="$(ynh_app_setting_get --app=$app --key=user)" ynh_app_setting_delete --app=$app --key=user fi -# Cleaning legacy permissions -#REMOVEME? if ynh_legacy_permissions_exists; then -#REMOVEME? ynh_legacy_permissions_delete_all - - ynh_app_setting_delete --app=$app --key=is_public -fi - # Ensure password is a setting even if empty, for the config panel -#REMOVEME? ynh_app_setting_set --app=$app --key=password --value="$password" +ynh_app_setting_set --app=$app --key=password --value="$password" #================================================= # ACTIVATE MAINTENANCE MODE @@ -137,14 +96,14 @@ ynh_maintenance_mode_ON if [ $phpversion != "none" ] then -#REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=2 + ynh_script_progression --message="Installing dependencies..." --weight=2 -#REMOVEME? ynh_install_app_dependencies "php${phpversion}-fpm" + ynh_install_app_dependencies "php${phpversion}-fpm" fi if [ $with_mysql -eq 1 ] then -#REMOVEME? ynh_install_app_dependencies "php${phpversion}-mysql" + ynh_install_app_dependencies "php${phpversion}-mysql" fi #================================================= @@ -177,7 +136,7 @@ else groups="" fi -#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" --groups="$groups" +ynh_system_user_create --username=$app --home_dir="$install_dir" --groups="$groups" if [ -n "$password" ] then @@ -201,10 +160,6 @@ then ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --phpversion=$phpversion fi -#================================================= -# SPECIFIC UPGRADE -#================================================= - #================================================= # GENERIC FINALIZATION #================================================= @@ -219,13 +174,6 @@ setfacl -m g:$app:r-x "$install_dir" setfacl -m g:www-data:r-x "$install_dir" chmod 750 "$install_dir" -#================================================= -# RELOAD NGINX -#================================================= -#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." - -#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload - #================================================= # DEACTIVE MAINTENANCE MODE #================================================= @@ -242,7 +190,7 @@ admin_panel="https://$(grep portal_domain /etc/ssowat/conf.json | cut -d'"' -f4) # Build the changelog # Get the value of admin_mail_html -#REMOVEME? admin_mail_html=$(ynh_app_setting_get $app admin_mail_html) +admin_mail_html=$(ynh_app_setting_get $app admin_mail_html) admin_mail_html="${admin_mail_html:-0}" # If a html email is required. Apply html to the changelog. if [ "$admin_mail_html" -eq 1 ]; then diff --git a/tests.toml b/tests.toml new file mode 100644 index 0000000..dffc527 --- /dev/null +++ b/tests.toml @@ -0,0 +1,11 @@ +test_format = 1.0 + +[default] + + # ------------------------------- + # Default args to use for install + # ------------------------------- + + args.with_sftp = "1" + args.phpversion="7.4" + args.with_mysql=1 \ No newline at end of file From 1c77b1a6f8ec7bf19233bae2ed38d7444822d5a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sat, 4 Feb 2023 21:28:07 +0100 Subject: [PATCH 03/83] Update tests.toml --- tests.toml | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/tests.toml b/tests.toml index dffc527..8160f28 100644 --- a/tests.toml +++ b/tests.toml @@ -8,4 +8,24 @@ test_format = 1.0 args.with_sftp = "1" args.phpversion="7.4" - args.with_mysql=1 \ No newline at end of file + args.with_mysql=1 + +[some_additional_testsuite] + + only = ["install.subdir", "backup_restore", "upgrade" ] + args.phpversion="7.3" + +[some_additional_testsuite] + + only = ["install.subdir", "backup_restore", "upgrade" ] + args.phpversion="8.0" + +[some_additional_testsuite] + + only = ["install.subdir", "backup_restore", "upgrade" ] + args.phpversion="8.1" + +[some_additional_testsuite] + + only = ["install.subdir", "backup_restore", "upgrade" ] + args.phpversion="8.2" From 99a41f539235c0db653eb167fba52d76608c5472 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sat, 4 Feb 2023 21:30:30 +0100 Subject: [PATCH 04/83] Remove files --- check_process | 120 ------------------ .../POST_INSTALL.md} | 0 .../POST_INSTALL_fr.md} | 0 manifest.json | 85 ------------- manifest.toml | 3 - 5 files changed, 208 deletions(-) delete mode 100644 check_process rename doc/{DISCLAIMER.md => notifications/POST_INSTALL.md} (100%) rename doc/{DISCLAIMER_fr.md => notifications/POST_INSTALL_fr.md} (100%) delete mode 100644 manifest.json diff --git a/check_process b/check_process deleted file mode 100644 index afaef57..0000000 --- a/check_process +++ /dev/null @@ -1,120 +0,0 @@ -;; Test complet - ; Manifest - domain="domain.tld" - path="/path" - with_sftp=1 - password="myreallystrengthpassword" - is_public=1 - phpversion="7.4" - with_mysql=1 - ; Checks - pkg_linter=1 - setup_sub_dir=1 - setup_root=1 - setup_nourl=0 - setup_private=1 - setup_public=1 - upgrade=1 - upgrade=1 from_commit=a050e55533ae7bbb63fce44fd1508ad78b8a645c - backup_restore=1 - multi_instance=1 - port_already_use=0 - change_url=1 -;; Test without sftp - ; Manifest - domain="domain.tld" - path="/path" - with_sftp=0 - password="" - is_public=1 - phpversion="7.4" - with_mysql=1 - ; Checks - setup_sub_dir=1 - upgrade=1 - backup_restore=1 -;; Test without mysql - ; Manifest - domain="domain.tld" - path="/path" - with_sftp=1 - password="myreallystrengthpassword" - is_public=1 - phpversion="7.4" - with_mysql=0 - ; Checks - setup_sub_dir=1 - upgrade=1 - backup_restore=1 -;; Test without PHP - ; Manifest - domain="domain.tld" - path="/path" - with_sftp=0 - password="myreallystrengthpassword" - is_public=1 - phpversion="none" - with_mysql=0 - ; Checks - setup_sub_dir=1 - upgrade=1 - backup_restore=1 -;; Test with PHP7.4 - ; Manifest - domain="domain.tld" - path="/path" - with_sftp=0 - password="myreallystrengthpassword" - is_public=1 - phpversion="7.4" - with_mysql=0 - ; Checks - setup_sub_dir=1 - upgrade=1 - backup_restore=1 -;; Test with PHP8.0 - ; Manifest - domain="domain.tld" - path="/path" - with_sftp=0 - password="myreallystrengthpassword" - is_public=1 - phpversion="8.0" - with_mysql=0 - ; Checks - setup_sub_dir=1 - upgrade=1 - backup_restore=1 -;; Test with PHP8.1 - ; Manifest - domain="domain.tld" - path="/path" - with_sftp=0 - password="myreallystrengthpassword" - is_public=1 - phpversion="8.1" - with_mysql=0 - ; Checks - setup_sub_dir=1 - upgrade=1 - backup_restore=1 -;; Test with PHP8.2 - ; Manifest - domain="domain.tld" - path="/path" - with_sftp=0 - password="myreallystrengthpassword" - is_public=1 - phpversion="8.2" - with_mysql=0 - ; Checks - setup_sub_dir=1 - upgrade=1 - backup_restore=1 -;;; Options -Email= -Notification=change -;;; Upgrade options - ; commit=a050e55533ae7bbb63fce44fd1508ad78b8a645c - name=May 26, 2019 - manifest_arg=domain=DOMAIN&path=PATH&password=myreallystrengthpassword&is_public=1&with_mysql=1 diff --git a/doc/DISCLAIMER.md b/doc/notifications/POST_INSTALL.md similarity index 100% rename from doc/DISCLAIMER.md rename to doc/notifications/POST_INSTALL.md diff --git a/doc/DISCLAIMER_fr.md b/doc/notifications/POST_INSTALL_fr.md similarity index 100% rename from doc/DISCLAIMER_fr.md rename to doc/notifications/POST_INSTALL_fr.md diff --git a/manifest.json b/manifest.json deleted file mode 100644 index 36fe534..0000000 --- a/manifest.json +++ /dev/null @@ -1,85 +0,0 @@ -{ - "name": "My Webapp", - "id": "my_webapp", - "packaging_format": 1, - "description": { - "en": "Custom Web app with SFTP access to serve static (HTML, CSS, JS) and PHP files", - "fr": "Application Web personnalisée avec accès SFTP pour servir des fichiers statiques (HTML, CSS, JS) et PHP" - }, - "version": "1.0~ynh12", - "url": "https://github.com/YunoHost-Apps/my_webapp_ynh", - "upstream": { - "license": "GPL-3.0-only", - "code": "https://github.com/YunoHost-Apps/my_webapp_ynh" - }, - "license": "GPL-3.0-only", - "maintainer": { - "name": "", - "email": "" - }, - "previous_maintainers": [{ - "name": "Maniack Crudelis", - "email": "maniackc_dev@crudelis.fr" - }], - "requirements": { - "yunohost": ">= 11.0.9" - }, - "multi_instance": true, - "services": [ - "nginx", - "php7.4-fpm", - "mysql" - ], - "arguments": { - "install" : [ - { - "name": "domain", - "type": "domain" - }, - { - "name": "path", - "type": "path", - "example": "/site", - "default": "/site" - }, - { - "name": "with_sftp", - "type": "boolean", - "ask": { - "en": "Do you need a SFTP access?", - "fr": "Avez-vous besoin d'un accès SFTP ?" - }, - "default": true - }, - { - "name": "password", - "type": "password", - "optional": true - }, - { - "name": "is_public", - "type": "boolean", - "default": true - }, - { - "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" - }, - "choices" : ["none", "7.3", "7.4", "8.0", "8.1", "8.2"], - "default" : "7.4" - }, - { - "name": "with_mysql", - "type": "boolean", - "ask": { - "en": "Do you need a MySQL database?", - "fr": "Avez-vous besoin d'une base de données MySQL ?" - }, - "default": false - } - ] - } -} diff --git a/manifest.toml b/manifest.toml index 97a11d6..4b99ba7 100644 --- a/manifest.toml +++ b/manifest.toml @@ -12,9 +12,6 @@ maintainers = [] [upstream] license = "GPL-3.0-only" code = "https://github.com/YunoHost-Apps/my_webapp_ynh" -website = "https://github.com/YunoHost-Apps/my_webapp_ynh" -cpe = "???" # FIXME: optional but recommended if relevant, this is meant to contain the Common Platform Enumeration, which is sort of a standard id for applications defined by the NIST. In particular, Yunohost may use this is in the future to easily track CVE (=security reports) related to apps. The CPE may be obtained by searching here: https://nvd.nist.gov/products/cpe/search. For example, for Nextcloud, the CPE is 'cpe:2.3:a:nextcloud:nextcloud' (no need to include the version number) -fund = "???" # FIXME: optional but recommended (or remove if irrelevant / not applicable). This is meant to be an URL where people can financially support this app, especially when its development is based on volunteers and/or financed by its community. YunoHost may later advertise it in the webadmin. [integration] yunohost = ">= 11.1.5" From 82564c792954efc8cb1291e9b25c955c97b4bfca Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Sat, 4 Feb 2023 20:30:40 +0000 Subject: [PATCH 05/83] Auto-update README --- README.md | 6 ------ README_fr.md | 6 ------ 2 files changed, 12 deletions(-) diff --git a/README.md b/README.md index c7e1037..27f258a 100644 --- a/README.md +++ b/README.md @@ -25,12 +25,6 @@ PHP-FPM version can also be selected among 7.3, 7.4, 8.0, 8.1 and 8.2. **Shipped version:** 1.0~ynh12 -## Disclaimers / important information - -#### SFTP port - -You may have change the SSH port as described in this section: [Modify the SSH port](https://yunohost.org/en/security#modify-the-ssh-port); then you should use this port to update your website with SFTP. - ## Documentation and resources * Upstream app code repository: diff --git a/README_fr.md b/README_fr.md index d6cfbab..4a868f5 100644 --- a/README_fr.md +++ b/README_fr.md @@ -25,12 +25,6 @@ La version de PHP-FPM peut aussi être choisie, parmi 7.3, 7.4, 8.0, 8.1 et 8.2. **Version incluse :** 1.0~ynh12 -## Avertissements / informations importantes - -#### Port SFTP - -Vous avez peut-être changé le port SSH comme décrit dans cette section : [Modifier le port SSH](https://yunohost.org/fr/security#modify-the-ssh-port) ; alors vous devriez utiliser ce port pour mettre à jour votre site Web avec SFTP. - ## Documentations et ressources * Dépôt de code officiel de l’app : From 26142cd20f485e88f0f6ba8abef851f36d41023a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sat, 4 Feb 2023 21:53:19 +0100 Subject: [PATCH 06/83] Update tests.toml --- tests.toml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests.toml b/tests.toml index 8160f28..f055cdb 100644 --- a/tests.toml +++ b/tests.toml @@ -7,25 +7,25 @@ test_format = 1.0 # ------------------------------- args.with_sftp = "1" - args.phpversion="7.4" - args.with_mysql=1 + args.phpversion = "7.4" + args.with_mysql = "1" [some_additional_testsuite] only = ["install.subdir", "backup_restore", "upgrade" ] - args.phpversion="7.3" + args.phpversion = "7.3" [some_additional_testsuite] only = ["install.subdir", "backup_restore", "upgrade" ] - args.phpversion="8.0" + args.phpversion = "8.0" [some_additional_testsuite] only = ["install.subdir", "backup_restore", "upgrade" ] - args.phpversion="8.1" + args.phpversion = "8.1" [some_additional_testsuite] only = ["install.subdir", "backup_restore", "upgrade" ] - args.phpversion="8.2" + args.phpversion = "8.2" From 6ec349098d1f2cf1b740a2896ead4319a208a68b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sat, 4 Feb 2023 23:13:06 +0100 Subject: [PATCH 07/83] Update tests.toml --- tests.toml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests.toml b/tests.toml index f055cdb..ded50e8 100644 --- a/tests.toml +++ b/tests.toml @@ -10,22 +10,22 @@ test_format = 1.0 args.phpversion = "7.4" args.with_mysql = "1" -[some_additional_testsuite] +[7.3_test] only = ["install.subdir", "backup_restore", "upgrade" ] args.phpversion = "7.3" -[some_additional_testsuite] +[8.0_test] only = ["install.subdir", "backup_restore", "upgrade" ] args.phpversion = "8.0" -[some_additional_testsuite] +[8.1_test] only = ["install.subdir", "backup_restore", "upgrade" ] args.phpversion = "8.1" -[some_additional_testsuite] +[8.2_test] only = ["install.subdir", "backup_restore", "upgrade" ] args.phpversion = "8.2" From b6e37aedae0b37522e8a2f4ddca8b71136ffe1e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sat, 4 Feb 2023 23:16:22 +0100 Subject: [PATCH 08/83] Update install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 5b55f2e..1c82d23 100644 --- a/scripts/install +++ b/scripts/install @@ -80,7 +80,7 @@ ynh_add_nginx_config #================================================= # CREATE DEDICATED USER #================================================= -#REMOVEME? ynh_script_progression --message="Configuring system user..." +ynh_script_progression --message="Configuring system user..." if [ $with_sftp -eq 1 ] then From 1b7d0b6ac0461d57a560c5e9b08447592aeabdcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sat, 4 Feb 2023 23:16:56 +0100 Subject: [PATCH 09/83] Update upgrade --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 2bd5a72..e714598 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -37,7 +37,7 @@ ynh_script_progression --message="Ensuring downward compatibility..." # If admin_mail_html doesn't exist, create it if [ -z "$admin_mail_html" ]; then admin_mail_html=1 - #REMOVEME? ynh_app_setting_set --app=$app --key=admin_mail_html --value=$admin_mail_html + ynh_app_setting_set --app=$app --key=admin_mail_html --value=$admin_mail_html fi # If fpm_footprint doesn't exist, create it From 8aba067dc2aca011e8d0d72aaf0e22190d3c1cc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sat, 4 Feb 2023 23:30:49 +0100 Subject: [PATCH 10/83] Update install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 1c82d23..27bf9bf 100644 --- a/scripts/install +++ b/scripts/install @@ -18,7 +18,7 @@ app_nb=$YNH_APP_INSTANCE_NUMBER #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= -REMOVEME? ynh_script_progression --message="Validating installation parameters..." --weight=2 +ynh_script_progression --message="Validating installation parameters..." --weight=2 [ $with_sftp -eq 0 ] || [ "$password" != "" ] || ynh_die --message="You need to set a password to enable SFTP" From caf5f747600a7e13566e4712e41ee1ca502a4c76 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 5 Feb 2023 08:08:58 +0100 Subject: [PATCH 11/83] Update install --- scripts/install | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/install b/scripts/install index 27bf9bf..8038976 100644 --- a/scripts/install +++ b/scripts/install @@ -13,6 +13,7 @@ source /usr/share/yunohost/helpers # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= +password=$YNH_APP_ARG_PASSWORD app_nb=$YNH_APP_INSTANCE_NUMBER #================================================= From 369bb90604c46ee890221bc296e9f96d7baae385 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 5 Feb 2023 08:09:24 +0100 Subject: [PATCH 12/83] Update install --- scripts/install | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/install b/scripts/install index 8038976..a466c82 100644 --- a/scripts/install +++ b/scripts/install @@ -15,6 +15,7 @@ source /usr/share/yunohost/helpers password=$YNH_APP_ARG_PASSWORD app_nb=$YNH_APP_INSTANCE_NUMBER +phpversion=$YNH_APP_ARG_PHPVERSION #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS From 52e14f82a79639d2bb7be89805e964868aeda93a Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 5 Feb 2023 11:13:44 +0100 Subject: [PATCH 13/83] Update tests.toml --- tests.toml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests.toml b/tests.toml index ded50e8..dc19f9e 100644 --- a/tests.toml +++ b/tests.toml @@ -10,22 +10,22 @@ test_format = 1.0 args.phpversion = "7.4" args.with_mysql = "1" -[7.3_test] +[73_test] only = ["install.subdir", "backup_restore", "upgrade" ] args.phpversion = "7.3" -[8.0_test] +[80_test] only = ["install.subdir", "backup_restore", "upgrade" ] args.phpversion = "8.0" -[8.1_test] +[81_test] only = ["install.subdir", "backup_restore", "upgrade" ] args.phpversion = "8.1" -[8.2_test] +[82_test] only = ["install.subdir", "backup_restore", "upgrade" ] args.phpversion = "8.2" From a53a10d256bf5667bad62e324ce125246f473fc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 5 Feb 2023 12:17:35 +0100 Subject: [PATCH 14/83] Update install --- scripts/install | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/install b/scripts/install index a466c82..92ca1da 100644 --- a/scripts/install +++ b/scripts/install @@ -154,9 +154,9 @@ then ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --phpversion=$phpversion else # This is needed for the config panel to work even though PHP is not actually used - ynh_app_setting_set --app=$app --key=fpm_footprint --value=low - ynh_app_setting_set --app=$app --key=fpm_usage --value=low - ynh_app_setting_set --app=$app --key=fpm_free_footprint --value=0 + ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint + ynh_app_setting_set --app=$app --key=fpm_free_footprint --value=$fpm_free_footprint + ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage fi #================================================= @@ -169,7 +169,7 @@ admin_panel="https://$(grep portal_domain /etc/ssowat/conf.json | cut -d'"' -f4) if [ $with_mysql -eq 1 ] then sql_infos=" -You've asked for a database, please find here the information about this SQL database. +You have requested a database, please find information about this SQL database here. $(cat "$install_dir/db_access.txt") " else From d3695fe281db3947e1aac89dd8a374bfeb89d564 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 5 Feb 2023 12:28:17 +0100 Subject: [PATCH 15/83] Update install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 92ca1da..c0cebbe 100644 --- a/scripts/install +++ b/scripts/install @@ -163,7 +163,7 @@ fi # SEND A README FOR THE ADMIN #================================================= -# Get main domain and buid the url of the admin panel of the app. +# Get main domain and buid the URL of the admin panel of the app. admin_panel="https://$(grep portal_domain /etc/ssowat/conf.json | cut -d'"' -f4)/yunohost/admin/#/apps/$app" if [ $with_mysql -eq 1 ] From fac6118cceffd1d40cb93779deb3f136df936032 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 5 Feb 2023 12:29:41 +0100 Subject: [PATCH 16/83] Fix --- scripts/install | 1 + scripts/restore | 8 +------- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/scripts/install b/scripts/install index c0cebbe..4cd4cef 100644 --- a/scripts/install +++ b/scripts/install @@ -29,6 +29,7 @@ ynh_script_progression --message="Validating installation parameters..." --weigh #================================================= ynh_script_progression --message="Storing installation settings..." +ynh_app_setting_set --app=$app --key=password --value=$password ynh_app_setting_set --app=$app --key=with_mysql --value=$with_mysql ynh_app_setting_set --app=$app --key=with_sftp --value=$with_sftp ynh_app_setting_set --app=$app --key=phpversion --value=$phpversion diff --git a/scripts/restore b/scripts/restore index 82b26a1..266850a 100644 --- a/scripts/restore +++ b/scripts/restore @@ -9,13 +9,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - #================================================= # LOAD SETTINGS #================================================= @@ -23,6 +16,7 @@ ynh_script_progression --message="Loading settings..." --weight=2 with_mysql=$(ynh_app_setting_get --app=$app --key=with_mysql) with_sftp=$(ynh_app_setting_get --app=$app --key=with_sftp) +password=$(ynh_app_setting_get --app=$app --key=password) #================================================= # STANDARD RESTORATION STEPS From f91ad3ecbe131c8cc994743691c8f1358d94a12d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 5 Feb 2023 12:35:09 +0100 Subject: [PATCH 17/83] Fix --- scripts/backup | 1 + scripts/install | 3 ++- scripts/remove | 3 +++ scripts/restore | 7 +++++-- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/scripts/backup b/scripts/backup index a9a1629..2d2ea7a 100644 --- a/scripts/backup +++ b/scripts/backup @@ -16,6 +16,7 @@ ynh_print_info --message="Loading installation settings..." with_mysql=$(ynh_app_setting_get --app=$app --key=with_mysql) with_sftp=$(ynh_app_setting_get --app=$app --key=with_sftp) +db_name=$(ynh_app_setting_get --app=$app --key=db_name) #================================================= # DECLARE DATA AND CONF FILES TO BACKUP diff --git a/scripts/install b/scripts/install index 4cd4cef..21a069c 100644 --- a/scripts/install +++ b/scripts/install @@ -59,8 +59,9 @@ then ynh_install_app_dependencies "php${phpversion}-mysql" db_name=$(ynh_sanitize_dbid --db_name=$app) + db_user=$db_name ynh_app_setting_set --app=$app --key=db_name --value=$db_name - ynh_mysql_setup_db --db_user=$db_name --db_name=$db_name + ynh_mysql_setup_db --db_user=$ db_user --db_name=$db_name fi #================================================= diff --git a/scripts/remove b/scripts/remove index ba62ebb..b42dc60 100644 --- a/scripts/remove +++ b/scripts/remove @@ -26,6 +26,9 @@ with_sftp=$(ynh_app_setting_get --app=$app --key=with_sftp) if [ $with_mysql -eq 1 ]; then ynh_script_progression --message="Removing the MySQL database..." --weight=2 + db_name=$(ynh_app_setting_get --app=$app --key=db_name) + db_user=$db_name + # Remove a database if it exists, along with the associated user ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name fi diff --git a/scripts/restore b/scripts/restore index 266850a..5a11cce 100644 --- a/scripts/restore +++ b/scripts/restore @@ -46,9 +46,12 @@ if [ $with_mysql -eq 1 ]; then ynh_install_app_dependencies "php${phpversion}-mysql" + + db_name=$(ynh_app_setting_get --app=$app --key=db_name) + db_user=$db_name db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) - ynh_mysql_setup_db --db_user=$db_name --db_name=$db_name --db_pwd=$db_pwd - ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name < ./db.sql + ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd + ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql fi #================================================= From ca06ee4f07d3413ba0bd345aa9662e0db69a7678 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 5 Feb 2023 12:40:52 +0100 Subject: [PATCH 18/83] Fix --- conf/extra_php-fpm.conf | 4 ++-- conf/nginx_no_php.conf | 3 ++- conf/nginx_with_php.conf | 3 ++- scripts/actions/create_database | 2 +- scripts/actions/remove_database | 3 ++- scripts/config | 2 +- 6 files changed, 10 insertions(+), 7 deletions(-) diff --git a/conf/extra_php-fpm.conf b/conf/extra_php-fpm.conf index a2e3d58..4af9c64 100644 --- a/conf/extra_php-fpm.conf +++ b/conf/extra_php-fpm.conf @@ -1,6 +1,6 @@ ; Additional php.ini defines, specific to this pool of workers. -php_value[upload_max_filesize] = 1G -php_value[post_max_size] = 1G +php_value[upload_max_filesize] = 500M +php_value[post_max_size] = 500M php_value[default_charset] = UTF-8 php_value[always_populate_raw_post_data] = -1 diff --git a/conf/nginx_no_php.conf b/conf/nginx_no_php.conf index 992aab7..a80930c 100644 --- a/conf/nginx_no_php.conf +++ b/conf/nginx_no_php.conf @@ -5,7 +5,7 @@ location __PATH__/ { alias __INSTALL_DIR__/www/; # Common parameter to increase upload size limit in conjunction with dedicated PHP-FPM file - #client_max_body_size 1G; + client_max_body_size 500M; # Default indexes and catch-all index index.html index.php; @@ -16,6 +16,7 @@ location __PATH__/ { log_not_found off; access_log off; } + location = __PATH__/robots.txt { allow all; log_not_found off; diff --git a/conf/nginx_with_php.conf b/conf/nginx_with_php.conf index 9a9ad34..7f5752e 100644 --- a/conf/nginx_with_php.conf +++ b/conf/nginx_with_php.conf @@ -5,7 +5,7 @@ location __PATH__/ { alias __INSTALL_DIR__/www/; # Common parameter to increase upload size limit in conjunction with dedicated PHP-FPM file - #client_max_body_size 1G; + client_max_body_size 500M; # Default indexes and catch-all index index.html index.php; @@ -16,6 +16,7 @@ location __PATH__/ { log_not_found off; access_log off; } + location = __PATH__/robots.txt { allow all; log_not_found off; diff --git a/scripts/actions/create_database b/scripts/actions/create_database index f8ddb6f..3013df6 100755 --- a/scripts/actions/create_database +++ b/scripts/actions/create_database @@ -46,7 +46,7 @@ ynh_script_progression --message="Creating a new database..." --weight=4 db_name=$(ynh_sanitize_dbid --db_name=$app) # Reuse the previous password if existing -db_pwd=$(grep "pass:" "$final_path/db_access.txt" | cut -d' ' -f2 2> /dev/null) +db_pwd=$(grep "pass:" "$install_dir/db_access.txt" | cut -d' ' -f2 2> /dev/null) ynh_mysql_setup_db --db_user=$db_name --db_name=$db_name --db_pwd=$db_pwd diff --git a/scripts/actions/remove_database b/scripts/actions/remove_database index d7c4477..5677093 100755 --- a/scripts/actions/remove_database +++ b/scripts/actions/remove_database @@ -38,7 +38,8 @@ fi ynh_script_progression --message="Removing the database..." --weight=9 db_name=$(ynh_app_setting_get --app=$app --key=db_name) -ynh_mysql_remove_db --db_user=$db_name --db_name=$db_name +db_user=$db_name +ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name # Update the config of the app ynh_app_setting_set --app=$app --key=with_mysql --value=0 diff --git a/scripts/config b/scripts/config index 9039486..3f3d88c 100644 --- a/scripts/config +++ b/scripts/config @@ -15,7 +15,7 @@ ynh_abort_if_errors # RETRIEVE ARGUMENTS #================================================= -final_path=$(ynh_app_setting_get $app final_path) +install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) From 4aa09f073dc040550cf2f432d749df71f466d942 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 5 Feb 2023 12:43:12 +0100 Subject: [PATCH 19/83] Update tests.toml --- tests.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests.toml b/tests.toml index dc19f9e..cfcebdd 100644 --- a/tests.toml +++ b/tests.toml @@ -7,8 +7,8 @@ test_format = 1.0 # ------------------------------- args.with_sftp = "1" + args.with_mysql = "1" args.phpversion = "7.4" - args.with_mysql = "1" [73_test] From fb34d3331922eaa3b1cbb416a6675e0cb35847bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sat, 18 Feb 2023 15:46:05 +0100 Subject: [PATCH 20/83] Add ADMIN readme --- doc/{notifications/POST_INSTALL.md => ADMIN.md} | 0 doc/{notifications/POST_INSTALL_fr.md => ADMIN_fr.md} | 0 manifest.toml | 2 +- scripts/change_url | 4 ---- 4 files changed, 1 insertion(+), 5 deletions(-) rename doc/{notifications/POST_INSTALL.md => ADMIN.md} (100%) rename doc/{notifications/POST_INSTALL_fr.md => ADMIN_fr.md} (100%) diff --git a/doc/notifications/POST_INSTALL.md b/doc/ADMIN.md similarity index 100% rename from doc/notifications/POST_INSTALL.md rename to doc/ADMIN.md diff --git a/doc/notifications/POST_INSTALL_fr.md b/doc/ADMIN_fr.md similarity index 100% rename from doc/notifications/POST_INSTALL_fr.md rename to doc/ADMIN_fr.md diff --git a/manifest.toml b/manifest.toml index 4b99ba7..581aa5f 100644 --- a/manifest.toml +++ b/manifest.toml @@ -14,7 +14,7 @@ license = "GPL-3.0-only" code = "https://github.com/YunoHost-Apps/my_webapp_ynh" [integration] -yunohost = ">= 11.1.5" +yunohost = ">= 11.1.7" architectures = "all" multi_instance = true ldap = "not_relevant" diff --git a/scripts/change_url b/scripts/change_url index 39f7c11..d763d2b 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -19,15 +19,11 @@ old_path=$YNH_APP_OLD_PATH new_domain=$YNH_APP_NEW_DOMAIN new_path=$YNH_APP_NEW_PATH -app=$YNH_APP_INSTANCE_NAME - #================================================= # LOAD SETTINGS #================================================= ynh_script_progression --message="Loading installation settings..." -# Needed for helper "ynh_add_nginx_config" -final_path=$(ynh_app_setting_get --app=$app --key=final_path) phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= From 59e321b39895d7261ea0b6a9dbd174b4f4bd923a Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Sat, 18 Feb 2023 14:46:10 +0000 Subject: [PATCH 21/83] Auto-update README --- README.md | 1 + README_fr.md | 1 + 2 files changed, 2 insertions(+) diff --git a/README.md b/README.md index 27f258a..1cdce63 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ It shall NOT be edited by hand. # My Webapp for YunoHost [![Integration level](https://dash.yunohost.org/integration/my_webapp.svg)](https://dash.yunohost.org/appci/app/my_webapp) ![Working status](https://ci-apps.yunohost.org/ci/badges/my_webapp.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/my_webapp.maintain.svg) + [![Install My Webapp with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=my_webapp) *[Lire ce readme en français.](./README_fr.md)* diff --git a/README_fr.md b/README_fr.md index 4a868f5..1ef366f 100644 --- a/README_fr.md +++ b/README_fr.md @@ -6,6 +6,7 @@ It shall NOT be edited by hand. # My Webapp pour YunoHost [![Niveau d’intégration](https://dash.yunohost.org/integration/my_webapp.svg)](https://dash.yunohost.org/appci/app/my_webapp) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/my_webapp.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/my_webapp.maintain.svg) + [![Installer My Webapp avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=my_webapp) *[Read this readme in english.](./README.md)* From dafc95ba31fdb8edd0104e4dfa4f3cf420a1f93d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 3 Mar 2023 09:41:27 +0100 Subject: [PATCH 22/83] Cleaning --- manifest.toml | 2 +- scripts/change_url | 100 +-------------------------------------------- scripts/upgrade | 24 +++-------- 3 files changed, 7 insertions(+), 119 deletions(-) diff --git a/manifest.toml b/manifest.toml index 581aa5f..457a67e 100644 --- a/manifest.toml +++ b/manifest.toml @@ -14,7 +14,7 @@ license = "GPL-3.0-only" code = "https://github.com/YunoHost-Apps/my_webapp_ynh" [integration] -yunohost = ">= 11.1.7" +yunohost = ">= 11.1.12" architectures = "all" multi_instance = true ldap = "not_relevant" diff --git a/scripts/change_url b/scripts/change_url index d763d2b..5ae0bfb 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -9,65 +9,12 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# RETRIEVE ARGUMENTS -#================================================= - -old_domain=$YNH_APP_OLD_DOMAIN -old_path=$YNH_APP_OLD_PATH - -new_domain=$YNH_APP_NEW_DOMAIN -new_path=$YNH_APP_NEW_PATH - -#================================================= -# LOAD SETTINGS -#================================================= -ynh_script_progression --message="Loading installation settings..." - -phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) - -#================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP -#================================================= -ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=5 - -# Backup the current version of the app -ynh_backup_before_upgrade -ynh_clean_setup () { - # Remove the new domain config file, the remove script won't do it as it doesn't know yet its location. - ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" - - # restore it if the upgrade fails - ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - #================================================= # ACTIVATE MAINTENANCE MODE #================================================= -ynh_script_progression --message="Activating maintenance mode..." -path_url=$old_path -domain=$old_domain ynh_maintenance_mode_ON -#================================================= -# CHECK WHICH PARTS SHOULD BE CHANGED -#================================================= - -change_domain=0 -if [ "$old_domain" != "$new_domain" ] -then - change_domain=1 -fi - -change_path=0 -if [ "$old_path" != "$new_path" ] -then - change_path=1 -fi - #================================================= # STANDARD MODIFICATIONS #================================================= @@ -75,57 +22,12 @@ fi #================================================= ynh_script_progression --message="Updating NGINX web server configuration..." --weight=2 -nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf - -# Prepare nginx.conf -if [ $phpversion != "none" ] -then - cp ../conf/nginx{_with_php,}.conf -else - cp ../conf/nginx{_no_php,}.conf -fi - -# Change the path in the NGINX config file -if [ $change_path -eq 1 ] -then - # Make a backup of the original NGINX config file if modified - ynh_backup_if_checksum_is_different --file="$nginx_conf_path" - - # Set global variables for NGINX helper - domain="$old_domain" - path_url="$new_path" - - # Create a dedicated NGINX config - ynh_add_nginx_config -fi - -# Change the domain for NGINX -if [ $change_domain -eq 1 ] -then - # Delete file checksum for the old conf file location - ynh_delete_file_checksum --file="$nginx_conf_path" - mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf - - # Store file checksum for the new config file location - ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" -fi - -#================================================= -# GENERIC FINALISATION -#================================================= -# RELOAD NGINX -#================================================= -ynh_script_progression --message="Reloading NGINX web server..." - -ynh_systemd_action --service_name=nginx --action=reload +ynh_change_url_nginx_config #================================================= # DEACTIVE MAINTENANCE MODE #================================================= -ynh_script_progression --message="Disabling maintenance mode..." -path_url=$old_path -domain=$old_domain ynh_maintenance_mode_OFF #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index e714598..50e02d1 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -9,20 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= -ynh_script_progression --message="Loading installation settings..." --weight=2 - -with_mysql=$(ynh_app_setting_get --app=$app --key=with_mysql) -with_sftp=$(ynh_app_setting_get --app=$app --key=with_sftp) - -admin_mail_html=$(ynh_app_setting_get --app=$app --key=admin_mail_html) - -fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint) -fpm_free_footprint=$(ynh_app_setting_get --app=$app --key=fpm_free_footprint) -fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage) - #================================================= # CHECK VERSION #================================================= @@ -35,31 +21,31 @@ upgrade_type=$(ynh_check_app_version_changed) ynh_script_progression --message="Ensuring downward compatibility..." # If admin_mail_html doesn't exist, create it -if [ -z "$admin_mail_html" ]; then +if [ -z "${admin_mail_html:-}" ]; then admin_mail_html=1 ynh_app_setting_set --app=$app --key=admin_mail_html --value=$admin_mail_html fi # If fpm_footprint doesn't exist, create it -if [ -z "$fpm_footprint" ]; then +if [ -z "${fpm_footprint:-}" ]; then fpm_footprint=low ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint fi # If fpm_free_footprint doesn't exist, create it -if [ -z "$fpm_free_footprint" ]; then +if [ -z "${fpm_free_footprint:-}" ]; then fpm_free_footprint=0 ynh_app_setting_set --app=$app --key=fpm_free_footprint --value=$fpm_free_footprint fi # If fpm_usage doesn't exist, create it -if [ -z "$fpm_usage" ]; then +if [ -z "${fpm_usage:-}" ]; then fpm_usage=low ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage fi # If with_sftp doesn't exist, create it -if [ -z "$with_sftp" ]; then +if [ -z "${with_sftp:-}" ]; then with_sftp=1 ynh_app_setting_set --app=$app --key=with_sftp --value=$with_sftp fi From 58809e2b1ef802ce8b32459d79f431775e8a120b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 28 Mar 2023 18:08:39 +0200 Subject: [PATCH 23/83] Update manifest.toml --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index 457a67e..4199281 100644 --- a/manifest.toml +++ b/manifest.toml @@ -14,7 +14,7 @@ license = "GPL-3.0-only" code = "https://github.com/YunoHost-Apps/my_webapp_ynh" [integration] -yunohost = ">= 11.1.12" +yunohost = ">= 11.1.15" architectures = "all" multi_instance = true ldap = "not_relevant" From ba620f9fd10d08087febae1eca6db8e03bd4878c Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Tue, 28 Mar 2023 16:09:42 +0000 Subject: [PATCH 24/83] Auto-update README --- README.md | 1 - README_fr.md | 1 - 2 files changed, 2 deletions(-) diff --git a/README.md b/README.md index c43f71a..1cdce63 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,6 @@ PHP-FPM version can also be selected among 7.3, 7.4, 8.0, 8.1 and 8.2. **Shipped version:** 1.0~ynh12 - ## Documentation and resources * Upstream app code repository: diff --git a/README_fr.md b/README_fr.md index a9e844c..1ef366f 100644 --- a/README_fr.md +++ b/README_fr.md @@ -26,7 +26,6 @@ La version de PHP-FPM peut aussi être choisie, parmi 7.3, 7.4, 8.0, 8.1 et 8.2. **Version incluse :** 1.0~ynh12 - ## Documentations et ressources * Dépôt de code officiel de l’app : From fb5e9c54368a6ebbc05a232b9b54ca13d5c4d1d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 28 Mar 2023 18:20:55 +0200 Subject: [PATCH 25/83] Update manifest.toml --- manifest.toml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/manifest.toml b/manifest.toml index 4199281..0154f5c 100644 --- a/manifest.toml +++ b/manifest.toml @@ -66,5 +66,16 @@ ram.runtime = "50M" [resources.permissions] main.url = "/" + [resources.apt] + packages_from_raw_bash = """ + if [[ "$phpversion" == "7.3" || "$phpversion" == "7.4" || "$phpversion" == "8.1" || "$phpversion" == "8.2" ]] + then + echo "mariadb-server" + elif [[ "$phpversion" == "none" ]] + then + echo "" + fi + """ + [resources.database] type = "mysql" From bafc403789ef998e267eda6f99be8dc081a82899 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 28 Mar 2023 18:38:47 +0200 Subject: [PATCH 26/83] Update manifest.toml --- manifest.toml | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/manifest.toml b/manifest.toml index 0154f5c..c79758a 100644 --- a/manifest.toml +++ b/manifest.toml @@ -49,8 +49,8 @@ ram.runtime = "50M" ask.en = "Choose a PHP version you want to use for your app" ask.fr = "Choisissez une version PHP que vous souhaitez utiliser pour votre application" type = "string" - choices = ["none", "7.3", "7.4", "8.0", "8.1", "8.2"] - default = "7.4" + choices = ["none", "7.4", "8.0", "8.1", "8.2"] + default = "8.0" [install.with_mysql] ask.en = "Do you need a MySQL database?" @@ -68,13 +68,17 @@ ram.runtime = "50M" [resources.apt] packages_from_raw_bash = """ - if [[ "$phpversion" == "7.3" || "$phpversion" == "7.4" || "$phpversion" == "8.1" || "$phpversion" == "8.2" ]] - then - echo "mariadb-server" - elif [[ "$phpversion" == "none" ]] - then - echo "" - fi + if [[ "$with_mysql" = 1 ]] + then + echo "mariadb-server" + else + echo "" + fi + + if [[ "$phpversion" != none ]] + then + echo "php${phpversion}-fpm php${phpversion}-mysql" + fi """ [resources.database] From 0305cc08dc27eefe298a663678bf5b8a8d5dc68a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 28 Mar 2023 18:39:26 +0200 Subject: [PATCH 27/83] Update tests.toml --- tests.toml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/tests.toml b/tests.toml index cfcebdd..62babf5 100644 --- a/tests.toml +++ b/tests.toml @@ -8,12 +8,7 @@ test_format = 1.0 args.with_sftp = "1" args.with_mysql = "1" - args.phpversion = "7.4" - -[73_test] - - only = ["install.subdir", "backup_restore", "upgrade" ] - args.phpversion = "7.3" + args.phpversion = "8.0" [80_test] From d4fa580701c9c8dbf5f9dbdd948294343d61a5ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 28 Mar 2023 18:41:04 +0200 Subject: [PATCH 28/83] Update manifest.toml --- manifest.toml | 2 -- 1 file changed, 2 deletions(-) diff --git a/manifest.toml b/manifest.toml index c79758a..05293a7 100644 --- a/manifest.toml +++ b/manifest.toml @@ -71,8 +71,6 @@ ram.runtime = "50M" if [[ "$with_mysql" = 1 ]] then echo "mariadb-server" - else - echo "" fi if [[ "$phpversion" != none ]] From 65eb6319034904825682d737b6e51938ad882c5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 28 Mar 2023 18:44:15 +0200 Subject: [PATCH 29/83] Update config_panel.toml --- config_panel.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config_panel.toml b/config_panel.toml index bff497e..b229f0f 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -24,7 +24,7 @@ name = "My Webapp configuration" [main.php_fpm_config.phpversion] ask = "PHP version" type = "select" - choices = ["none", "7.3", "7.4", "8.0", "8.1", "8.2"] + choices = ["none", "7.4", "8.0", "8.1", "8.2"] default = "none" [main.php_fpm_config.fpm_footprint] From 8eec20a4edcbf30e1c99cb7f63c86ca9715d7e82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 28 Mar 2023 19:23:38 +0200 Subject: [PATCH 30/83] Update DESCRIPTION.md --- doc/DESCRIPTION.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/DESCRIPTION.md b/doc/DESCRIPTION.md index 9a5eea2..de48a9d 100644 --- a/doc/DESCRIPTION.md +++ b/doc/DESCRIPTION.md @@ -2,6 +2,6 @@ This application allows you to easily install a custom Web application, providin It can also create a MySQL database - which will be backed up and restored with your application. The connection details will be stored in the file `db_access.txt` located in the root directory. -PHP-FPM version can also be selected among 7.3, 7.4, 8.0, 8.1 and 8.2. +PHP-FPM version can also be selected among `none`, `7.4`, `8.0`, `8.1` and `8.2`. **Once installed, go to the chosen URL to know the user, domain and port you will have to use for the SFTP access.** The password is one you chosen during the installation. Under the Web directory, you will see a `www` folder which contains the public files served by this app. You can put all the files of your custom Web application inside. From b136cc2b3d214f4a405a9f758d44fbeeeb94996a Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Tue, 28 Mar 2023 17:23:45 +0000 Subject: [PATCH 31/83] Auto-update README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1cdce63..9d1055f 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ This application allows you to easily install a custom Web application, providin It can also create a MySQL database - which will be backed up and restored with your application. The connection details will be stored in the file `db_access.txt` located in the root directory. -PHP-FPM version can also be selected among 7.3, 7.4, 8.0, 8.1 and 8.2. +PHP-FPM version can also be selected among `none`, `7.4`, `8.0`, `8.1` and `8.2`. **Once installed, go to the chosen URL to know the user, domain and port you will have to use for the SFTP access.** The password is one you chosen during the installation. Under the Web directory, you will see a `www` folder which contains the public files served by this app. You can put all the files of your custom Web application inside. From c5456233310243a057effc6a7228b3e706329eab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 28 Mar 2023 19:24:28 +0200 Subject: [PATCH 32/83] Update DESCRIPTION_fr.md --- doc/DESCRIPTION_fr.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/DESCRIPTION_fr.md b/doc/DESCRIPTION_fr.md index b1eef70..2bf7f20 100644 --- a/doc/DESCRIPTION_fr.md +++ b/doc/DESCRIPTION_fr.md @@ -2,6 +2,6 @@ Cette application vous permet d'installer facilement une application vide person Elle peut également créer une base de données MySQL - qui sera sauvegardée et restaurée avec votre application. Les détails de connexion seront stockés dans le fichier `db_accesss.txt` situé dans le répertoire racine. -La version de PHP-FPM peut aussi être choisie, parmi 7.3, 7.4, 8.0, 8.1 et 8.2. +La version de PHP-FPM peut aussi être choisie, parmi `none`, `7.4`, `8.0`, `8.1` et `8.2`. **Une fois installé, rendez-vous sur l'URL choisie pour connaître l'utilisateur, le domaine et le port que vous devrez utiliser pour l'accès SFTP.** Le mot de passe est celui que vous avez choisi lors de l'installation. Sous le répertoire Web, vous verrez un dossier `www` qui contient les fichiers publics servis par cette application. Vous pouvez mettre tous les fichiers de votre application Web personnalisée à l'intérieur. From 6b39fca6873d7e1c02c65f49299c67907bd1e8fe Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Tue, 28 Mar 2023 17:24:41 +0000 Subject: [PATCH 33/83] Auto-update README --- README_fr.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README_fr.md b/README_fr.md index 1ef366f..f907ca8 100644 --- a/README_fr.md +++ b/README_fr.md @@ -20,7 +20,7 @@ Cette application vous permet d'installer facilement une application vide person Elle peut également créer une base de données MySQL - qui sera sauvegardée et restaurée avec votre application. Les détails de connexion seront stockés dans le fichier `db_accesss.txt` situé dans le répertoire racine. -La version de PHP-FPM peut aussi être choisie, parmi 7.3, 7.4, 8.0, 8.1 et 8.2. +La version de PHP-FPM peut aussi être choisie, parmi `none`, `7.4`, `8.0`, `8.1` et `8.2`. **Une fois installé, rendez-vous sur l'URL choisie pour connaître l'utilisateur, le domaine et le port que vous devrez utiliser pour l'accès SFTP.** Le mot de passe est celui que vous avez choisi lors de l'installation. Sous le répertoire Web, vous verrez un dossier `www` qui contient les fichiers publics servis par cette application. Vous pouvez mettre tous les fichiers de votre application Web personnalisée à l'intérieur. From 60bc8fab646718f5d6671e33cfe745d05d0431f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 28 Mar 2023 21:58:36 +0200 Subject: [PATCH 34/83] Update tests.toml --- tests.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests.toml b/tests.toml index 62babf5..de2537d 100644 --- a/tests.toml +++ b/tests.toml @@ -20,7 +20,7 @@ test_format = 1.0 only = ["install.subdir", "backup_restore", "upgrade" ] args.phpversion = "8.1" -[82_test] +[none_test] only = ["install.subdir", "backup_restore", "upgrade" ] - args.phpversion = "8.2" + args.phpversion = "none" From 94761c15d20c6827d393e26b0bc4ab4aa0e37010 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 28 Mar 2023 21:59:12 +0200 Subject: [PATCH 35/83] Update install --- scripts/install | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/scripts/install b/scripts/install index 21a069c..5961012 100644 --- a/scripts/install +++ b/scripts/install @@ -35,19 +35,6 @@ ynh_app_setting_set --app=$app --key=with_sftp --value=$with_sftp ynh_app_setting_set --app=$app --key=phpversion --value=$phpversion ynh_app_setting_set --app=$app --key=admin_mail_html --value=1 -#================================================= -# STANDARD MODIFICATIONS -#================================================= -# INSTALL DEPENDENCIES -#================================================= - -if [ $phpversion != "none" ] -then - ynh_script_progression --message="Installing dependencies..." --weight=2 - - ynh_install_app_dependencies "php${phpversion}-fpm" -fi - #================================================= # CREATE A MYSQL DATABASE #================================================= @@ -56,8 +43,6 @@ if [ $with_mysql -eq 1 ] then ynh_script_progression --message="Creating a MySQL database..." --weight=2 - ynh_install_app_dependencies "php${phpversion}-mysql" - db_name=$(ynh_sanitize_dbid --db_name=$app) db_user=$db_name ynh_app_setting_set --app=$app --key=db_name --value=$db_name From 2e525c68d4b5d047c3812f22b550cdfa6b0f3e96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 5 Apr 2023 12:37:35 +0200 Subject: [PATCH 36/83] Update manifest.toml --- manifest.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.toml b/manifest.toml index 05293a7..51c8a8b 100644 --- a/manifest.toml +++ b/manifest.toml @@ -79,5 +79,5 @@ ram.runtime = "50M" fi """ - [resources.database] - type = "mysql" + #[resources.database] + #type = "mysql" From aa54f690b406251b66dbe261548c53b41752d26a Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Wed, 5 Apr 2023 16:20:36 +0200 Subject: [PATCH 37/83] manifest: make sure we have a non-empty list for apt deps --- manifest.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/manifest.toml b/manifest.toml index 51c8a8b..34d71ea 100644 --- a/manifest.toml +++ b/manifest.toml @@ -67,6 +67,7 @@ ram.runtime = "50M" main.url = "/" [resources.apt] + packages = "nginx" # Kind of "dummy" value to be sure to have a non-empty dep list packages_from_raw_bash = """ if [[ "$with_mysql" = 1 ]] then From 857d049c7aebe2e2be4ec036d845c013a20a28f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 12 Apr 2023 19:55:50 +0200 Subject: [PATCH 38/83] Update install --- scripts/install | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/scripts/install b/scripts/install index 5961012..baba23d 100644 --- a/scripts/install +++ b/scripts/install @@ -125,25 +125,20 @@ chmod 750 "$install_dir" # PHP-FPM CONFIGURATION #================================================= +fpm_footprint="low" +fpm_free_footprint=0 +fpm_usage="low" + +ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint +ynh_app_setting_set --app=$app --key=fpm_free_footprint --value=$fpm_free_footprint +ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage + if [ $phpversion != "none" ] then ynh_script_progression --message="Configuring PHP-FPM..." --weight=2 - - fpm_footprint="low" - fpm_free_footprint=0 - fpm_usage="low" - - ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint - ynh_app_setting_set --app=$app --key=fpm_free_footprint --value=$fpm_free_footprint - ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage # Create a dedicatedPHP-FPM config ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --phpversion=$phpversion -else - # This is needed for the config panel to work even though PHP is not actually used - ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint - ynh_app_setting_set --app=$app --key=fpm_free_footprint --value=$fpm_free_footprint - ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage fi #================================================= From 2ec2d5cfabc38e80ddfa0f6783d2641576d6bbcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 12 Apr 2023 20:02:39 +0200 Subject: [PATCH 39/83] remove send email --- doc/POST_INSTALL.md | 13 ++++ scripts/_common.sh | 141 -------------------------------------------- scripts/install | 39 +----------- scripts/upgrade | 31 ---------- 4 files changed, 16 insertions(+), 208 deletions(-) create mode 100644 doc/POST_INSTALL.md diff --git a/doc/POST_INSTALL.md b/doc/POST_INSTALL.md new file mode 100644 index 0000000..9eef602 --- /dev/null +++ b/doc/POST_INSTALL.md @@ -0,0 +1,13 @@ +If you have requested a MYSQL database, please find information about this SQL database here. +`__INSTALL_DIR__/db_access.txt` + +You can connect to this repository by using SFTP with the following credentials. +Domain: __DOMAIN__ +Port: __SSH_PORT__ +User: __APP__ +Password: __PASSWORD__ + + +This app is simply a blank web app container. You have to put your own app inside. + +Please put your files into this directory: __INSTALL_DIR__/www/ diff --git a/scripts/_common.sh b/scripts/_common.sh index 60ee568..91ac190 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -8,147 +8,6 @@ # EXPERIMENTAL HELPERS #================================================= -# Send an email to inform the administrator -# -# usage: ynh_send_readme_to_admin --app_message=app_message [--recipients=recipients] [--type=type] -# | arg: -m --app_message= - The file with the content to send to the administrator. -# | arg: -r, --recipients= - The recipients of this email. Use spaces to separate multiples recipients. - default: root -# example: "root admin@domain" -# If you give the name of a YunoHost user, ynh_send_readme_to_admin will find its email adress for you -# example: "root admin@domain user1 user2" -# | arg: -t, --type= - Type of mail, could be 'backup', 'change_url', 'install', 'remove', 'restore', 'upgrade' -ynh_send_readme_to_admin() { - # Declare an array to define the options of this helper. - declare -Ar args_array=( [m]=app_message= [r]=recipients= [t]=type= ) - local app_message - local recipients - local type - # Manage arguments with getopts - - ynh_handle_getopts_args "$@" - app_message="${app_message:-}" - recipients="${recipients:-root}" - type="${type:-install}" - - # Get the value of admin_mail_html - admin_mail_html=$(ynh_app_setting_get $app admin_mail_html) - admin_mail_html="${admin_mail_html:-0}" - - # Retrieve the email of users - find_mails () { - local list_mails="$1" - local mail - local recipients=" " - # Read each mail in argument - for mail in $list_mails - do - # Keep root or a real email address as it is - if [ "$mail" = "root" ] || echo "$mail" | grep --quiet "@" - then - recipients="$recipients $mail" - else - # But replace an user name without a domain after by its email - if mail=$(ynh_user_get_info "$mail" "mail" 2> /dev/null) - then - recipients="$recipients $mail" - fi - fi - done - echo "$recipients" - } - recipients=$(find_mails "$recipients") - - # Subject base - local mail_subject="☁️🆈🅽🅷☁️: \`$app\`" - - # Adapt the subject according to the type of mail required. - if [ "$type" = "backup" ]; then - mail_subject="$mail_subject has just been backup." - elif [ "$type" = "change_url" ]; then - mail_subject="$mail_subject has just been moved to a new URL!" - elif [ "$type" = "remove" ]; then - mail_subject="$mail_subject has just been removed!" - elif [ "$type" = "restore" ]; then - mail_subject="$mail_subject has just been restored!" - elif [ "$type" = "upgrade" ]; then - mail_subject="$mail_subject has just been upgraded!" - else # install - mail_subject="$mail_subject has just been installed!" - fi - - local mail_message="This is an automated message from your beloved YunoHost server. - -Specific information for the application $app. - -$(if [ -n "$app_message" ] -then - cat "$app_message" -else - echo "...No specific information..." -fi) - ---- -Automatic diagnosis data from YunoHost - -__PRE_TAG1__$(yunohost tools diagnosis | grep -B 100 "services:" | sed '/services:/d')__PRE_TAG2__" - - # Store the message into a file for further modifications. - echo "$mail_message" > mail_to_send - - # If a html email is required. Apply html tags to the message. - if [ "$admin_mail_html" -eq 1 ] - then - # Insert 'br' tags at each ending of lines. - ynh_replace_string "$" "
" mail_to_send - - # Insert starting HTML tags - sed --in-place '1s@^@\n\n\n\n@' mail_to_send - - # Keep tabulations - ynh_replace_string " " "\ \ " mail_to_send - ynh_replace_string "\t" "\ \ " mail_to_send - - # Insert url links tags - ynh_replace_string "__URL_TAG1__\(.*\)__URL_TAG2__\(.*\)__URL_TAG3__" "\1" mail_to_send - - # Insert pre tags - ynh_replace_string "__PRE_TAG1__" "
" mail_to_send
-		ynh_replace_string "__PRE_TAG2__" "<\pre>" mail_to_send
-
-		# Insert finishing HTML tags
-		echo -e "\n\n" >> mail_to_send
-
-	# Otherwise, remove tags to keep a plain text.
-	else
-		# Remove URL tags
-		ynh_replace_string "__URL_TAG[1,3]__" "" mail_to_send
-		ynh_replace_string "__URL_TAG2__" ": " mail_to_send
-
-		# Remove PRE tags
-		ynh_replace_string "__PRE_TAG[1-2]__" "" mail_to_send
-	fi
-
-	# Define binary to use for mail command
-	if [ -e /usr/bin/bsd-mailx ]
-	then
-		local mail_bin=/usr/bin/bsd-mailx
-	else
-		local mail_bin=/usr/bin/mail.mailutils
-	fi
-
-	if [ "$admin_mail_html" -eq 1 ]
-	then
-		content_type="text/html"
-	else
-		content_type="text/plain"
-	fi
-
-	# Send the email to the recipients
-	cat mail_to_send | $mail_bin -a "Content-Type: $content_type; charset=UTF-8" -s "$mail_subject" "$recipients"
-}
-
-#=================================================
-
 ynh_maintenance_mode_ON () {
 	# Load value of $path and $domain from the config if their not set
 	if [ -z $path ]; then
diff --git a/scripts/install b/scripts/install
index baba23d..9dc73b6 100644
--- a/scripts/install
+++ b/scripts/install
@@ -142,44 +142,11 @@ then
 fi
 
 #=================================================
-# SEND A README FOR THE ADMIN
+# SSH PORT
 #=================================================
 
-# Get main domain and buid the URL of the admin panel of the app.
-admin_panel="https://$(grep portal_domain /etc/ssowat/conf.json | cut -d'"' -f4)/yunohost/admin/#/apps/$app"
-
-if [ $with_mysql -eq 1 ]
-then
-    sql_infos="
-You have requested a database, please find information about this SQL database here.
-$(cat "$install_dir/db_access.txt")
-"
-else
-    sql_infos=""
-fi
-
-if [ $with_sftp -eq 1 ]
-then
-    sftp_infos="You can connect to this repository by using SFTP with the following credentials.
-Domain: $domain
-Port: $(grep "^Port" /etc/ssh/sshd_config | awk '{print $2}')
-User: $app
-Password: The one you set at installation."
-else
-    sftp_infos=""
-fi
-
-echo "This app is simply a blank web app container. You have to put your own app inside.
-$sql_infos
-Please put your files into this directory: $install_dir/www/
-$sftp_infos
-
-You can configure this app easily by using the experimental __URL_TAG1__config-panel feature__URL_TAG2__$admin_panel/config-panel__URL_TAG3__.
-You can also find some specific actions for this app by using the experimental __URL_TAG1__action feature__URL_TAG2__$admin_panel/actions__URL_TAG3__.
-
-If you're facing an issue or want to improve this app, please open a new issue in this __URL_TAG1__project__URL_TAG2__https://github.com/YunoHost-Apps/my_webapp_ynh__URL_TAG3__." > mail_to_send
-
-ynh_send_readme_to_admin --app_message="mail_to_send" --recipients=root --type=install
+ssh_port=$(grep "^Port" /etc/ssh/sshd_config | awk '{print $2}')
+ynh_app_setting_set --app=$app --key=ssh_port --value=$ssh_port
 
 #=================================================
 # END OF SCRIPT
diff --git a/scripts/upgrade b/scripts/upgrade
index 50e02d1..969e5c7 100644
--- a/scripts/upgrade
+++ b/scripts/upgrade
@@ -167,37 +167,6 @@ ynh_script_progression --message="Disabling maintenance mode..."
 
 ynh_maintenance_mode_OFF
 
-#=================================================
-# SEND A README FOR THE ADMIN
-#=================================================
-
-# Get main domain and buid the url of the admin panel of the app.
-admin_panel="https://$(grep portal_domain /etc/ssowat/conf.json | cut -d'"' -f4)/yunohost/admin/#/apps/$app"
-
-# Build the changelog
-# Get the value of admin_mail_html
-admin_mail_html=$(ynh_app_setting_get $app admin_mail_html)
-admin_mail_html="${admin_mail_html:-0}"
-# If a html email is required. Apply html to the changelog.
-if [ "$admin_mail_html" -eq 1 ]; then
-    format=html
-else
-    format=plain
-fi
-ynh_app_changelog --format=$format
-
-echo "You can configure this app easily by using the experimental __URL_TAG1__config-panel feature__URL_TAG2__$admin_panel/config-panel__URL_TAG3__.
-You can also find some specific actions for this app by using the experimental __URL_TAG1__action feature__URL_TAG2__$admin_panel/actions__URL_TAG3__.
-
-If you're facing an issue or want to improve this app, please open a new issue in this __URL_TAG1__project__URL_TAG2__https://github.com/YunoHost-Apps/my_webapp_ynh__URL_TAG3__.
-
----
-
-Changelog since your last upgrade:
-$(cat changelog)" > mail_to_send
-
-ynh_send_readme_to_admin --app_message="mail_to_send" --recipients=root --type=upgrade
-
 #=================================================
 # END OF SCRIPT
 #=================================================

From 5b38abe3683e49d983d6d3512cb089689ba40fe4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?E=CC=81ric=20Gaspar?=
 <46165813+ericgaspar@users.noreply.github.com>
Date: Wed, 12 Apr 2023 20:41:16 +0200
Subject: [PATCH 40/83] add DB info

---
 doc/POST_INSTALL.md    |  4 ++++
 scripts/install        | 25 ++++++++++---------------
 sources/www/index.html |  2 +-
 3 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/doc/POST_INSTALL.md b/doc/POST_INSTALL.md
index 9eef602..cf9449f 100644
--- a/doc/POST_INSTALL.md
+++ b/doc/POST_INSTALL.md
@@ -1,6 +1,10 @@
 If you have requested a MYSQL database, please find information about this SQL database here.
 `__INSTALL_DIR__/db_access.txt`
 
+Database user: __DB_USER__
+Database name: __DB_NAME__
+Password: __DB_PWD__
+
 You can connect to this repository by using SFTP with the following credentials.
 Domain: __DOMAIN__
 Port: __SSH_PORT__
diff --git a/scripts/install b/scripts/install
index 9dc73b6..27ebadb 100644
--- a/scripts/install
+++ b/scripts/install
@@ -16,6 +16,7 @@ source /usr/share/yunohost/helpers
 password=$YNH_APP_ARG_PASSWORD
 app_nb=$YNH_APP_INSTANCE_NUMBER
 phpversion=$YNH_APP_ARG_PHPVERSION
+ssh_port=$(grep "^Port" /etc/ssh/sshd_config | awk '{print $2}')
 
 #=================================================
 # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
@@ -30,6 +31,7 @@ ynh_script_progression --message="Validating installation parameters..." --weigh
 ynh_script_progression --message="Storing installation settings..."
 
 ynh_app_setting_set --app=$app --key=password --value=$password
+ynh_app_setting_set --app=$app --key=ssh_port --value=$ssh_port
 ynh_app_setting_set --app=$app --key=with_mysql --value=$with_mysql
 ynh_app_setting_set --app=$app --key=with_sftp --value=$with_sftp
 ynh_app_setting_set --app=$app --key=phpversion --value=$phpversion
@@ -104,14 +106,14 @@ else
     cp "../sources/www/index_no_sftp.html" "$install_dir/www/index.html"
 fi
 
-if [ $with_mysql -eq 1 ]; then
-    # Store the database access
-    echo -e "# MySQL Database
-name: ${db_name}\nuser: ${db_name}\npass: ${db_pwd}" > ../sources/db_access.txt
-
-    # Copy files to the right place
-    cp -r "../sources/db_access.txt" "$install_dir/db_access.txt"
-fi
+#if [ $with_mysql -eq 1 ]; then
+#    # Store the database access
+#    echo -e "# MySQL Database
+#name: ${db_name}\nuser: ${db_name}\npass: ${db_pwd}" > ../sources/db_access.txt
+#
+#    # Copy files to the right place
+#    cp -r "../sources/db_access.txt" "$install_dir/db_access.txt"
+#fi
 
 chown -R $app:www-data "$install_dir"
 # Home directory of the user needs to be owned by root to allow
@@ -141,13 +143,6 @@ then
     ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --phpversion=$phpversion
 fi
 
-#=================================================
-# SSH PORT
-#=================================================
-
-ssh_port=$(grep "^Port" /etc/ssh/sshd_config | awk '{print $2}')
-ynh_app_setting_set --app=$app --key=ssh_port --value=$ssh_port
-
 #=================================================
 # END OF SCRIPT
 #=================================================
diff --git a/sources/www/index.html b/sources/www/index.html
index 1942aed..0c0e79f 100644
--- a/sources/www/index.html
+++ b/sources/www/index.html
@@ -20,7 +20,7 @@
       
Domain
__DOMAIN__
Port
-
22 (or the port you defined if you changed the SSH port)
+
__SSH_PORT__
User
__APP__
Password
From e2df6be87c6c5512e8d1ce961f0e7b9cf3942d3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 12 Apr 2023 20:42:46 +0200 Subject: [PATCH 41/83] cleaning --- manifest.toml | 2 +- scripts/restore | 14 -------------- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/manifest.toml b/manifest.toml index 34d71ea..ba91db3 100644 --- a/manifest.toml +++ b/manifest.toml @@ -14,7 +14,7 @@ license = "GPL-3.0-only" code = "https://github.com/YunoHost-Apps/my_webapp_ynh" [integration] -yunohost = ">= 11.1.15" +yunohost = ">= 11.1.17" architectures = "all" multi_instance = true ldap = "not_relevant" diff --git a/scripts/restore b/scripts/restore index 5a11cce..706f3ca 100644 --- a/scripts/restore +++ b/scripts/restore @@ -113,20 +113,6 @@ fi ynh_systemd_action --service_name=nginx --action=reload -#================================================= -# SEND A README FOR THE ADMIN -#================================================= - -# Get main domain and buid the url of the admin panel of the app. -admin_panel="https://$(grep portal_domain /etc/ssowat/conf.json | cut -d'"' -f4)/yunohost/admin/#/apps/$app" - -echo "You can configure this app easily by using the experimental __URL_TAG1__config-panel feature__URL_TAG2__$admin_panel/config-panel__URL_TAG3__. -You can also find some specific actions for this app by using the experimental __URL_TAG1__action feature__URL_TAG2__$admin_panel/actions__URL_TAG3__. - -If you're facing an issue or want to improve this app, please open a new issue in this __URL_TAG1__project__URL_TAG2__https://github.com/YunoHost-Apps/my_webapp_ynh__URL_TAG3__." > mail_to_send - -ynh_send_readme_to_admin --app_message="mail_to_send" --recipients=root --type=restore - #================================================= # END OF SCRIPT #================================================= From c66196538c96598f82dfe28a99edc2f015443bc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 12 Apr 2023 20:54:49 +0200 Subject: [PATCH 42/83] fix --- scripts/install | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 27ebadb..ea45f5b 100644 --- a/scripts/install +++ b/scripts/install @@ -48,7 +48,9 @@ then db_name=$(ynh_sanitize_dbid --db_name=$app) db_user=$db_name ynh_app_setting_set --app=$app --key=db_name --value=$db_name - ynh_mysql_setup_db --db_user=$ db_user --db_name=$db_name + ynh_app_setting_set --app=$app --key=db_user --value=$db_user + ynh_app_setting_set --app=$app --key=mysqlpwd --value=$db_pwd + ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name fi #================================================= From e3ede5ca2965e31a6af9775f7aaf3df4238197a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 12 Apr 2023 20:56:12 +0200 Subject: [PATCH 43/83] Update install --- scripts/install | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/install b/scripts/install index ea45f5b..3191aae 100644 --- a/scripts/install +++ b/scripts/install @@ -49,7 +49,6 @@ then db_user=$db_name ynh_app_setting_set --app=$app --key=db_name --value=$db_name ynh_app_setting_set --app=$app --key=db_user --value=$db_user - ynh_app_setting_set --app=$app --key=mysqlpwd --value=$db_pwd ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name fi From 6314f2bc263c3c1de13c750a3e345977b9d1a2a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 12 Apr 2023 20:59:50 +0200 Subject: [PATCH 44/83] fix --- scripts/install | 2 ++ scripts/restore | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 3191aae..d647366 100644 --- a/scripts/install +++ b/scripts/install @@ -47,8 +47,10 @@ then db_name=$(ynh_sanitize_dbid --db_name=$app) db_user=$db_name + db_pwd=$(ynh_string_random --length=30) ynh_app_setting_set --app=$app --key=db_name --value=$db_name ynh_app_setting_set --app=$app --key=db_user --value=$db_user + ynh_app_setting_set --app=$app --key=db_pwd --value=$db_pwd ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name fi diff --git a/scripts/restore b/scripts/restore index 706f3ca..41778c8 100644 --- a/scripts/restore +++ b/scripts/restore @@ -49,7 +49,7 @@ if [ $with_mysql -eq 1 ]; then db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_user=$db_name - db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) + db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd) ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql fi From 67c99b38e796b0c0b349d288c23d6e0424b10d32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 12 Apr 2023 21:06:33 +0200 Subject: [PATCH 45/83] cleaning --- doc/POST_INSTALL.md | 3 +-- scripts/restore | 13 ++++++------- scripts/upgrade | 20 +++++++++----------- 3 files changed, 16 insertions(+), 20 deletions(-) diff --git a/doc/POST_INSTALL.md b/doc/POST_INSTALL.md index cf9449f..bf74996 100644 --- a/doc/POST_INSTALL.md +++ b/doc/POST_INSTALL.md @@ -1,5 +1,4 @@ -If you have requested a MYSQL database, please find information about this SQL database here. -`__INSTALL_DIR__/db_access.txt` +If you have requested a MYSQL database, please find information about this SQL database: Database user: __DB_USER__ Database name: __DB_NAME__ diff --git a/scripts/restore b/scripts/restore index 41778c8..35f7fed 100644 --- a/scripts/restore +++ b/scripts/restore @@ -24,12 +24,12 @@ password=$(ynh_app_setting_get --app=$app --key=password) # REINSTALL DEPENDENCIES #================================================= -if [ $phpversion != "none" ] -then - ynh_script_progression --message="Reinstalling dependencies..." --weight=2 +#if [ $phpversion != "none" ] +#then +# ynh_script_progression --message="Reinstalling dependencies..." --weight=2 - ynh_install_app_dependencies "php${phpversion}-fpm" -fi +# ynh_install_app_dependencies "php${phpversion}-fpm" +#fi #================================================= # RESTORE THE NGINX CONFIGURATION @@ -44,8 +44,7 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" if [ $with_mysql -eq 1 ]; then ynh_script_progression --message="Restoring the MySQL database..." - ynh_install_app_dependencies "php${phpversion}-mysql" - + #ynh_install_app_dependencies "php${phpversion}-mysql" db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_user=$db_name diff --git a/scripts/upgrade b/scripts/upgrade index 969e5c7..0ea32c8 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -70,7 +70,6 @@ ynh_app_setting_set --app=$app --key=password --value="$password" #================================================= # ACTIVATE MAINTENANCE MODE #================================================= -ynh_script_progression --message="Activating maintenance mode..." ynh_maintenance_mode_ON @@ -80,17 +79,17 @@ ynh_maintenance_mode_ON # INSTALL DEPENDENCIES #================================================= -if [ $phpversion != "none" ] -then - ynh_script_progression --message="Installing dependencies..." --weight=2 +#if [ $phpversion != "none" ] +#then +# ynh_script_progression --message="Installing dependencies..." --weight=2 - ynh_install_app_dependencies "php${phpversion}-fpm" -fi +# ynh_install_app_dependencies "php${phpversion}-fpm" +#fi -if [ $with_mysql -eq 1 ] -then - ynh_install_app_dependencies "php${phpversion}-mysql" -fi +#if [ $with_mysql -eq 1 ] +#then +# ynh_install_app_dependencies "php${phpversion}-mysql" +#fi #================================================= # NGINX CONFIGURATION @@ -163,7 +162,6 @@ chmod 750 "$install_dir" #================================================= # DEACTIVE MAINTENANCE MODE #================================================= -ynh_script_progression --message="Disabling maintenance mode..." ynh_maintenance_mode_OFF From 402abc21d571d6168e336cf446b7caaabf8ed54e Mon Sep 17 00:00:00 2001 From: tituspijean Date: Wed, 12 Apr 2023 21:22:38 +0200 Subject: [PATCH 46/83] Apply suggestions from code review --- doc/POST_INSTALL.md | 2 +- sources/www/index.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/POST_INSTALL.md b/doc/POST_INSTALL.md index bf74996..71639cc 100644 --- a/doc/POST_INSTALL.md +++ b/doc/POST_INSTALL.md @@ -7,7 +7,7 @@ Password: __DB_PWD__ You can connect to this repository by using SFTP with the following credentials. Domain: __DOMAIN__ Port: __SSH_PORT__ -User: __APP__ +User: __ID__ Password: __PASSWORD__ diff --git a/sources/www/index.html b/sources/www/index.html index 0c0e79f..00e137f 100644 --- a/sources/www/index.html +++ b/sources/www/index.html @@ -22,7 +22,7 @@
Port
__SSH_PORT__
User
-
__APP__
+
__ID__
Password
the one you set at installation
From fc5dac0ef957e6e2b7c7d95b2f5cdb72449ac5f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 12 Apr 2023 22:38:43 +0200 Subject: [PATCH 47/83] Update change_url --- scripts/change_url | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/scripts/change_url b/scripts/change_url index 5ae0bfb..a430715 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -13,6 +13,8 @@ source /usr/share/yunohost/helpers # ACTIVATE MAINTENANCE MODE #================================================= +path_url=$old_path +domain=$old_domain ynh_maintenance_mode_ON #================================================= @@ -22,12 +24,47 @@ ynh_maintenance_mode_ON #================================================= ynh_script_progression --message="Updating NGINX web server configuration..." --weight=2 -ynh_change_url_nginx_config +nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf + +# Prepare nginx.conf +if [ $phpversion != "none" ] +then + cp ../conf/nginx{_with_php,}.conf +else + cp ../conf/nginx{_no_php,}.conf +fi + +# Change the path in the NGINX config file +if [ $change_path -eq 1 ] +then + # Make a backup of the original NGINX config file if modified + ynh_backup_if_checksum_is_different --file="$nginx_conf_path" + + # Set global variables for NGINX helper + domain="$old_domain" + path_url="$new_path" + + # Create a dedicated NGINX config + ynh_add_nginx_config +fi + +# Change the domain for NGINX +if [ $change_domain -eq 1 ] +then + # Delete file checksum for the old conf file location + ynh_delete_file_checksum --file="$nginx_conf_path" + mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf + + # Store file checksum for the new config file location + ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" +fi #================================================= # DEACTIVE MAINTENANCE MODE #================================================= +path_url=$old_path +domain=$old_domain ynh_maintenance_mode_OFF #================================================= From ff5946f35ae34825c2f9a9bbe6dc3d990fa4c5f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 12 Apr 2023 22:39:56 +0200 Subject: [PATCH 48/83] cleaning --- scripts/install | 9 --------- scripts/restore | 15 --------------- scripts/upgrade | 18 ------------------ 3 files changed, 42 deletions(-) diff --git a/scripts/install b/scripts/install index d647366..5b5aeb5 100644 --- a/scripts/install +++ b/scripts/install @@ -109,15 +109,6 @@ else cp "../sources/www/index_no_sftp.html" "$install_dir/www/index.html" fi -#if [ $with_mysql -eq 1 ]; then -# # Store the database access -# echo -e "# MySQL Database -#name: ${db_name}\nuser: ${db_name}\npass: ${db_pwd}" > ../sources/db_access.txt -# -# # Copy files to the right place -# cp -r "../sources/db_access.txt" "$install_dir/db_access.txt" -#fi - chown -R $app:www-data "$install_dir" # Home directory of the user needs to be owned by root to allow # SFTP connections diff --git a/scripts/restore b/scripts/restore index 35f7fed..3759d0a 100644 --- a/scripts/restore +++ b/scripts/restore @@ -18,19 +18,6 @@ with_mysql=$(ynh_app_setting_get --app=$app --key=with_mysql) with_sftp=$(ynh_app_setting_get --app=$app --key=with_sftp) password=$(ynh_app_setting_get --app=$app --key=password) -#================================================= -# STANDARD RESTORATION STEPS -#================================================= -# REINSTALL DEPENDENCIES -#================================================= - -#if [ $phpversion != "none" ] -#then -# ynh_script_progression --message="Reinstalling dependencies..." --weight=2 - -# ynh_install_app_dependencies "php${phpversion}-fpm" -#fi - #================================================= # RESTORE THE NGINX CONFIGURATION #================================================= @@ -44,8 +31,6 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" if [ $with_mysql -eq 1 ]; then ynh_script_progression --message="Restoring the MySQL database..." - #ynh_install_app_dependencies "php${phpversion}-mysql" - db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_user=$db_name db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd) diff --git a/scripts/upgrade b/scripts/upgrade index 0ea32c8..d1e5518 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -73,24 +73,6 @@ ynh_app_setting_set --app=$app --key=password --value="$password" ynh_maintenance_mode_ON -#================================================= -# STANDARD UPGRADE STEPS -#================================================= -# INSTALL DEPENDENCIES -#================================================= - -#if [ $phpversion != "none" ] -#then -# ynh_script_progression --message="Installing dependencies..." --weight=2 - -# ynh_install_app_dependencies "php${phpversion}-fpm" -#fi - -#if [ $with_mysql -eq 1 ] -#then -# ynh_install_app_dependencies "php${phpversion}-mysql" -#fi - #================================================= # NGINX CONFIGURATION #================================================= From aeb9ac274a00923614206c53dd9044699958ec83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 13 Apr 2023 09:24:51 +0200 Subject: [PATCH 49/83] cleaning --- scripts/remove | 1 - scripts/upgrade | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/scripts/remove b/scripts/remove index b42dc60..a037124 100644 --- a/scripts/remove +++ b/scripts/remove @@ -12,7 +12,6 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --weight=2 with_mysql=$(ynh_app_setting_get --app=$app --key=with_mysql) with_sftp=$(ynh_app_setting_get --app=$app --key=with_sftp) diff --git a/scripts/upgrade b/scripts/upgrade index d1e5518..a8d9a3e 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -76,7 +76,6 @@ ynh_maintenance_mode_ON #================================================= # NGINX CONFIGURATION #================================================= - ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2 # Prepare nginx.conf @@ -94,7 +93,7 @@ ynh_add_nginx_config #================================================= # CREATE DEDICATED USER #================================================= -#REMOVEME? ynh_script_progression --message="Making sure dedicated system user exists..." --weight=2 +ynh_script_progression --message="Making sure dedicated system user exists..." --weight=2 if [ $with_sftp -eq 1 ] then From f301a8b213f996cedc90eb23e381986127004219 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 13 Apr 2023 09:31:36 +0200 Subject: [PATCH 50/83] Create POST_INSTALL_fr.md --- doc/POST_INSTALL_fr.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 doc/POST_INSTALL_fr.md diff --git a/doc/POST_INSTALL_fr.md b/doc/POST_INSTALL_fr.md new file mode 100644 index 0000000..31bb663 --- /dev/null +++ b/doc/POST_INSTALL_fr.md @@ -0,0 +1,13 @@ +Si vous avez demandé une base de données MYSQL, voici les informations de cette base de données SQL : + +Utilisateur de la base de données : __DB_USER__ +Nom de la base de données : __DB_NAME__ +Mot de passe : __DB_PWD__ + +Vous pouvez vous connecter à ce répertoir en utilisant SFTP avec les informations d'identification suivantes : +Domaine : __DOMAIN__ +Port : __SSH_PORT__ +ID de l'utilisateur : __ID__ +Mot de passe : __PASSWORD__ + +Cette application est un simple conteneur vierge d'application Web. Vous devez mettre votre propre application à l'intérieur de ce répertoire : __INSTALL_DIR__/www/ From cc7808c3786a7f31d7d155126bf28338317e266b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 13 Apr 2023 09:42:10 +0200 Subject: [PATCH 51/83] cleaning --- CHANGELOG.md | 44 ----------- scripts/_common.sh | 137 --------------------------------- scripts/install | 6 +- sources/www/index.html | 4 +- sources/www/index_no_sftp.html | 4 +- 5 files changed, 5 insertions(+), 190 deletions(-) delete mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index e36f907..0000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,44 +0,0 @@ -Changelog -========= - -## [1.0~ynh4](https://github.com/YunoHost-Apps/my_webapp_ynh/pull/60) - 2021-04-23 - -#### Added -* [Add a README_fr](https://github.com/YunoHost-Apps/my_webapp_ynh/pull/60/commits/c84b7d4e97f00e2c7de10d949891cf660f1d8459) - -#### Changed -* [Use php7.3](https://github.com/YunoHost-Apps/my_webapp_ynh/pull/60/commits/b324c78780110e8eae05da47f8f151c1d50bf3c7) -* [New permissions](https://github.com/YunoHost-Apps/my_webapp_ynh/pull/60/commits/a5cc8741477a0f37ffd1b84e08bb3dec8af34a46) -# [Normalization from example_ynh](https://github.com/YunoHost-Apps/my_webapp_ynh/pull/60/commits/a5cc8741477a0f37ffd1b84e08bb3dec8af34a46) - -## [1.0~ynh3](https://github.com/YunoHost-Apps/my_webapp_ynh/pull/42) - 2020-01-01 - -#### Added -* [Add a changelog](https://github.com/YunoHost-Apps/my_webapp_ynh/pull/42/commits/60710bb18e1a4b7a3614e55d23e059af91969ea4) -* [Actions and config-panel](https://github.com/YunoHost-Apps/my_webapp_ynh/pull/42/commits/56e40ac3a10e89a106418695268dec271a04ebb2) - -#### Changed -* [use scalable phpfpm](https://github.com/YunoHost-Apps/my_webapp_ynh/pull/42/commits/6e33fd4c24f9f83bc1378b05aba20d7da3dcb406) -* [Optionnal sftp](https://github.com/YunoHost-Apps/my_webapp_ynh/pull/42/commits/f2e31fa4924c9985233e574c2c2f318eb3579996) -- [Various upgrades](https://github.com/YunoHost-Apps/my_webapp_ynh/pull/42/commits/5ee2886daa40de744139bfee1390703ba958bd30) - -## [1.0~ynh2](https://github.com/YunoHost-Apps/my_webapp_ynh/pull/39) - 2019-05-26 - -#### Changed -- [Normalization from example_ynh](https://github.com/YunoHost-Apps/my_webapp_ynh/pull/39/commits/cccc014552bf85fc682d1fc59e1b9c67ad8ec6f8) - - -## [1.0~ynh1](https://github.com/YunoHost-Apps/my_webapp_ynh/pull/34) - 2019-03-22 - -#### Added -- [Add progression with ynh_print_info](https://github.com/YunoHost-Apps/my_webapp_ynh/pull/34/commits/8c2f9fa5c7a6ab90ebbbee4eb4b82ed2be6ee292) - -#### Changed -- [Normalization from example_ynh](https://github.com/YunoHost-Apps/my_webapp_ynh/pull/34/commits/034e5fc83c8515d2a7781548600ab82b44c8611b) -- [Use php7](https://github.com/YunoHost-Apps/my_webapp_ynh/pull/34/commits/0f0bef3b8ca06d8f36f3de90c3502c529a6bc280) - - -## [1.0](https://github.com/YunoHost-Apps/my_webapp_ynh/pull/31) - 2019-03-13 - -#### Changed -- [Apply example_ynh](https://github.com/YunoHost-Apps/my_webapp_ynh/pull/31) diff --git a/scripts/_common.sh b/scripts/_common.sh index 91ac190..d400d3d 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -87,143 +87,6 @@ ynh_maintenance_mode_OFF () { systemctl reload nginx } -#================================================= - -# Create a changelog for an app after an upgrade from the file CHANGELOG.md. -# -# usage: ynh_app_changelog [--format=markdown/html/plain] [--output=changelog_file] --changelog=changelog_source] -# | arg: -f --format= - Format in which the changelog will be printed -# markdown: Default format. -# html: Turn urls into html format. -# plain: Plain text changelog -# | arg: -o --output= - Output file for the changelog file (Default ./changelog) -# | arg: -c --changelog= - CHANGELOG.md source (Default ../CHANGELOG.md) -# -# The changelog is printed into the file ./changelog and ./changelog_lite -ynh_app_changelog () { - # Declare an array to define the options of this helper. - local legacy_args=foc - declare -Ar args_array=( [f]=format= [o]=output= [c]=changelog= ) - local format - local output - local changelog - # Manage arguments with getopts - ynh_handle_getopts_args "$@" - format=${format:-markdown} - output=${output:-changelog} - changelog=${changelog:-../CHANGELOG.md} - - local original_changelog="$changelog" - local temp_changelog="changelog_temp" - local final_changelog="$output" - - if [ ! -n "$original_changelog" ] - then - echo "No changelog available..." > "$final_changelog" - echo "No changelog available..." > "${final_changelog}_lite" - return 0 - fi - -#REMOVEME? local current_version=$(ynh_read_manifest --manifest="/etc/yunohost/apps/$YNH_APP_INSTANCE_NAME/manifest.json" --manifest_key="version") - local update_version=$(ynh_read_manifest --manifest="../manifest.json" --manifest_key="version") - - # Get the line of the version to update to into the changelog - local update_version_line=$(grep --max-count=1 --line-number "^## \[$update_version" "$original_changelog" | cut -d':' -f1) - # If there's no entry for this version yet into the changelog - # Get the first available version - if [ -z "$update_version_line" ] - then - update_version_line=$(grep --max-count=1 --line-number "^##" "$original_changelog" | cut -d':' -f1) - fi - - # Get the length of the complete changelog. - local changelog_length=$(wc --lines "$original_changelog" | awk '{print $1}') - # Cut the file before the version to update to. - tail --lines=$(( $changelog_length - $update_version_line + 1 )) "$original_changelog" > "$temp_changelog" - - # Get the length of the troncated changelog. - changelog_length=$(wc --lines "$temp_changelog" | awk '{print $1}') - # Get the line of the current version into the changelog - # Keep only the last line found - local current_version_line=$(grep --line-number "^## \[$current_version" "$temp_changelog" | cut -d':' -f1 | tail --lines=1) - # If there's no entry for this version into the changelog - # Get the last available version - if [ -z "$current_version_line" ] - then - current_version_line=$(grep --line-number "^##" "$original_changelog" | cut -d':' -f1 | tail --lines=1) - fi - # Cut the file before the current version. - # Then grep the previous version into the changelog to get the line number of the previous version - local previous_version_line=$(tail --lines=$(( $changelog_length - $current_version_line )) \ - "$temp_changelog" | grep --max-count=1 --line-number "^## " | cut -d':' -f1) - # If there's no previous version into the changelog - # Go until the end of the changelog - if [ -z "$previous_version_line" ] - then - previous_version_line=$changelog_length - fi - - # Cut the file after the previous version to keep only the changelog between the current version and the version to update to. - head --lines=$(( $current_version_line + $previous_version_line - 1 )) "$temp_changelog" | tee "$final_changelog" - - if [ "$format" = "html" ] - then - # Replace markdown links by html links - ynh_replace_string --match_string="\[\(.*\)\](\(.*\)))" --replace_string="\1)" --target_file="$final_changelog" - ynh_replace_string --match_string="\[\(.*\)\](\(.*\))" --replace_string="\1" --target_file="$final_changelog" - elif [ "$format" = "plain" ] - then - # Change title format. - ynh_replace_string --match_string="^##.*\[\(.*\)\](\(.*\)) - \(.*\)$" --replace_string="## \1 (\3) - \2" --target_file="$final_changelog" - # Change modifications lines format. - ynh_replace_string --match_string="^\([-*]\).*\[\(.*\)\]\(.*\)" --replace_string="\1 \2 \3" --target_file="$final_changelog" - fi - # else markdown. As the file is already in markdown, nothing to do. - - # Keep only important changes into the changelog - # Remove all minor changes - sed '/^-/d' "$final_changelog" > "${final_changelog}_lite" - # Remove all blank lines (to keep a clear workspace) - sed --in-place '/^$/d' "${final_changelog}_lite" - # Add a blank line at the end - echo "" >> "${final_changelog}_lite" - - # Clean titles if there's no significative changes - local line - local previous_line="" - while read line <&3 - do - if [ -n "$previous_line" ] - then - # Remove the line if it's a title or a blank line, and the previous one was a title as well. - if ( [ "${line:0:1}" = "#" ] || [ ${#line} -eq 0 ] ) && [ "${previous_line:0:1}" = "#" ] - then - ynh_replace_special_string --match_string="${previous_line//[/.}" --replace_string="" --target_file="${final_changelog}_lite" - fi - fi - previous_line="$line" - done 3< "${final_changelog}_lite" - - # Remove all blank lines again - sed --in-place '/^$/d' "${final_changelog}_lite" - - # Restore changelog format with blank lines - ynh_replace_string --match_string="^##.*" --replace_string="\n\n&\n" --target_file="${final_changelog}_lite" - # Remove the 2 first blank lines - sed --in-place '1,2d' "${final_changelog}_lite" - # Add a blank line at the end - echo "" >> "${final_changelog}_lite" - - # If changelog are empty, add an info - if [ $(wc --words "$final_changelog" | awk '{print $1}') -eq 0 ] - then - echo "No changes from the changelog..." > "$final_changelog" - fi - if [ $(wc --words "${final_changelog}_lite" | awk '{print $1}') -eq 0 ] - then - echo "No significative changes from the changelog..." > "${final_changelog}_lite" - fi -} ynh_system_user_add_group() { # Declare an array to define the options of this helper. diff --git a/scripts/install b/scripts/install index 5b5aeb5..ed2d9f2 100644 --- a/scripts/install +++ b/scripts/install @@ -35,7 +35,6 @@ ynh_app_setting_set --app=$app --key=ssh_port --value=$ssh_port ynh_app_setting_set --app=$app --key=with_mysql --value=$with_mysql ynh_app_setting_set --app=$app --key=with_sftp --value=$with_sftp ynh_app_setting_set --app=$app --key=phpversion --value=$phpversion -ynh_app_setting_set --app=$app --key=admin_mail_html --value=1 #================================================= # CREATE A MYSQL DATABASE @@ -101,12 +100,9 @@ mkdir -p "$install_dir/www" if [ $with_sftp -eq 1 ] then - ynh_add_config --template="../sources/www/index.html" --destination="$install_dir/www/index.html" - else - # Copy files to the right place - cp "../sources/www/index_no_sftp.html" "$install_dir/www/index.html" + ynh_add_config --template="../sources/www/index_no_sftp.html" --destination="$install_dir/www/index.html" fi chown -R $app:www-data "$install_dir" diff --git a/sources/www/index.html b/sources/www/index.html index 00e137f..c9b25d7 100644 --- a/sources/www/index.html +++ b/sources/www/index.html @@ -1,11 +1,11 @@ - Custom Web App + My_Webapp

It works!

-

Congratulation, you have just installed your custom web app.

+

Congratulation, you have just installed My_Webapp.

Edit this site

diff --git a/sources/www/index_no_sftp.html b/sources/www/index_no_sftp.html index 7dab7ea..1455617 100644 --- a/sources/www/index_no_sftp.html +++ b/sources/www/index_no_sftp.html @@ -1,11 +1,11 @@ - Custom Web App + My_Webapp

It works!

-

Congratulation, you have just installed your custom web app.

+

Congratulation, you have just installed your My_webapp.

Edit this site

From c7103688a205a8a6f56267fc456327bbb187f791 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 13 Apr 2023 09:47:31 +0200 Subject: [PATCH 52/83] cleaning --- sources/www/index.html | 4 ++-- sources/www/index_no_sftp.html | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sources/www/index.html b/sources/www/index.html index c9b25d7..24608b1 100644 --- a/sources/www/index.html +++ b/sources/www/index.html @@ -1,11 +1,11 @@ - My_Webapp + My Webapp

It works!

-

Congratulation, you have just installed My_Webapp.

+

Congratulation, you have just installed My Webapp.

Edit this site

diff --git a/sources/www/index_no_sftp.html b/sources/www/index_no_sftp.html index 1455617..a6a61d1 100644 --- a/sources/www/index_no_sftp.html +++ b/sources/www/index_no_sftp.html @@ -1,11 +1,11 @@ - My_Webapp + My Webapp

It works!

-

Congratulation, you have just installed your My_webapp.

+

Congratulation, you have just installed My Webapp.

Edit this site

From 32a9ff377131a080d4dd23f19ab32597794c778d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 13 Apr 2023 09:48:58 +0200 Subject: [PATCH 53/83] cleaning --- doc/POST_INSTALL.md | 2 +- doc/POST_INSTALL_fr.md | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/POST_INSTALL.md b/doc/POST_INSTALL.md index 71639cc..3c36ca6 100644 --- a/doc/POST_INSTALL.md +++ b/doc/POST_INSTALL.md @@ -5,12 +5,12 @@ Database name: __DB_NAME__ Password: __DB_PWD__ You can connect to this repository by using SFTP with the following credentials. + Domain: __DOMAIN__ Port: __SSH_PORT__ User: __ID__ Password: __PASSWORD__ - This app is simply a blank web app container. You have to put your own app inside. Please put your files into this directory: __INSTALL_DIR__/www/ diff --git a/doc/POST_INSTALL_fr.md b/doc/POST_INSTALL_fr.md index 31bb663..6fbda66 100644 --- a/doc/POST_INSTALL_fr.md +++ b/doc/POST_INSTALL_fr.md @@ -5,6 +5,7 @@ Nom de la base de données : __DB_NAME__ Mot de passe : __DB_PWD__ Vous pouvez vous connecter à ce répertoir en utilisant SFTP avec les informations d'identification suivantes : + Domaine : __DOMAIN__ Port : __SSH_PORT__ ID de l'utilisateur : __ID__ From 0244a4408e725f7d54c3c8fe7152695822dba79e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 13 Apr 2023 10:50:51 +0200 Subject: [PATCH 54/83] Update manifest.toml --- manifest.toml | 3 --- 1 file changed, 3 deletions(-) diff --git a/manifest.toml b/manifest.toml index ba91db3..9649a01 100644 --- a/manifest.toml +++ b/manifest.toml @@ -79,6 +79,3 @@ ram.runtime = "50M" echo "php${phpversion}-fpm php${phpversion}-mysql" fi """ - - #[resources.database] - #type = "mysql" From 47533880be4803e85f97e71fb0aebcb77d63e463 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 13 Apr 2023 11:11:30 +0200 Subject: [PATCH 55/83] #110 --- conf/example-custom-nginx-config.conf | 2 ++ conf/nginx-php.conf | 10 ++++++ conf/{nginx_no_php.conf => nginx.conf} | 5 ++- conf/nginx_with_php.conf | 44 -------------------------- doc/DESCRIPTION.md | 2 ++ doc/DESCRIPTION_fr.md | 2 ++ scripts/backup | 1 + scripts/change_url | 37 ++++++++++++++++------ scripts/config | 7 ++-- scripts/install | 10 +++--- scripts/remove | 1 + scripts/restore | 1 + scripts/upgrade | 10 ++++-- 13 files changed, 66 insertions(+), 66 deletions(-) create mode 100644 conf/example-custom-nginx-config.conf create mode 100644 conf/nginx-php.conf rename conf/{nginx_no_php.conf => nginx.conf} (84%) delete mode 100644 conf/nginx_with_php.conf diff --git a/conf/example-custom-nginx-config.conf b/conf/example-custom-nginx-config.conf new file mode 100644 index 0000000..0d72ff4 --- /dev/null +++ b/conf/example-custom-nginx-config.conf @@ -0,0 +1,2 @@ +# Common parameter to increase upload size limit in conjunction with dedicated PHP-FPM file +#client_max_body_size 1G; \ No newline at end of file diff --git a/conf/nginx-php.conf b/conf/nginx-php.conf new file mode 100644 index 0000000..f68f202 --- /dev/null +++ b/conf/nginx-php.conf @@ -0,0 +1,10 @@ +# Execute and serve PHP files +location ~ [^/]\.php(/|$) { + fastcgi_split_path_info ^(.+?\.php)(/.*)$; + fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock; + fastcgi_index index.php; + include fastcgi_params; + fastcgi_param REMOTE_USER $remote_user; + fastcgi_param PATH_INFO $fastcgi_path_info; + fastcgi_param SCRIPT_FILENAME $request_filename; +} diff --git a/conf/nginx_no_php.conf b/conf/nginx.conf similarity index 84% rename from conf/nginx_no_php.conf rename to conf/nginx.conf index a80930c..9f696ae 100644 --- a/conf/nginx_no_php.conf +++ b/conf/nginx.conf @@ -4,9 +4,6 @@ location __PATH__/ { # Path to source alias __INSTALL_DIR__/www/; - # Common parameter to increase upload size limit in conjunction with dedicated PHP-FPM file - client_max_body_size 500M; - # Default indexes and catch-all index index.html index.php; try_files $uri $uri/ __PATH__/index.php?$args; @@ -28,6 +25,8 @@ location __PATH__/ { deny all; } + include conf.d/__DOMAIN__.d/__APP__.d/*.conf; + # Include SSOWAT user panel. include conf.d/yunohost_panel.conf.inc; } diff --git a/conf/nginx_with_php.conf b/conf/nginx_with_php.conf deleted file mode 100644 index 7f5752e..0000000 --- a/conf/nginx_with_php.conf +++ /dev/null @@ -1,44 +0,0 @@ -#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; -location __PATH__/ { - - # Path to source - alias __INSTALL_DIR__/www/; - - # Common parameter to increase upload size limit in conjunction with dedicated PHP-FPM file - client_max_body_size 500M; - - # Default indexes and catch-all - index index.html index.php; - try_files $uri $uri/ __PATH__/index.php?$args; - - # Prevent useless logs - location = __PATH__/favicon.ico { - log_not_found off; - access_log off; - } - - location = __PATH__/robots.txt { - allow all; - log_not_found off; - access_log off; - } - - # Deny access to hidden files and directories - location ~ ^__PATH__/(.+/|)\.(?!well-known\/) { - deny all; - } - - # Execute and serve PHP files - location ~ [^/]\.php(/|$) { - fastcgi_split_path_info ^(.+?\.php)(/.*)$; - fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock; - fastcgi_index index.php; - include fastcgi_params; - fastcgi_param REMOTE_USER $remote_user; - fastcgi_param PATH_INFO $fastcgi_path_info; - fastcgi_param SCRIPT_FILENAME $request_filename; - } - - # Include SSOWAT user panel. - include conf.d/yunohost_panel.conf.inc; -} diff --git a/doc/DESCRIPTION.md b/doc/DESCRIPTION.md index de48a9d..f24ccce 100644 --- a/doc/DESCRIPTION.md +++ b/doc/DESCRIPTION.md @@ -5,3 +5,5 @@ It can also create a MySQL database - which will be backed up and restored with PHP-FPM version can also be selected among `none`, `7.4`, `8.0`, `8.1` and `8.2`. **Once installed, go to the chosen URL to know the user, domain and port you will have to use for the SFTP access.** The password is one you chosen during the installation. Under the Web directory, you will see a `www` folder which contains the public files served by this app. You can put all the files of your custom Web application inside. + +If you want to add customized nginx configuration, put it in `/etc/nginx/conf.d/YOUR_DOMAIN.d/my_webapp.d/WHATEVER_NAME.conf` (ensure that the file has the `.conf` extension, and change `my_webapp.d` to `my_webapp__xx.d` if you want to change the configuration of the second or more installation of my_webapp). diff --git a/doc/DESCRIPTION_fr.md b/doc/DESCRIPTION_fr.md index 2bf7f20..956bd4a 100644 --- a/doc/DESCRIPTION_fr.md +++ b/doc/DESCRIPTION_fr.md @@ -5,3 +5,5 @@ Elle peut également créer une base de données MySQL - qui sera sauvegardée e La version de PHP-FPM peut aussi être choisie, parmi `none`, `7.4`, `8.0`, `8.1` et `8.2`. **Une fois installé, rendez-vous sur l'URL choisie pour connaître l'utilisateur, le domaine et le port que vous devrez utiliser pour l'accès SFTP.** Le mot de passe est celui que vous avez choisi lors de l'installation. Sous le répertoire Web, vous verrez un dossier `www` qui contient les fichiers publics servis par cette application. Vous pouvez mettre tous les fichiers de votre application Web personnalisée à l'intérieur. + +Si vous voulez ajouter une configuration personnalisée de nginx, mettez-la dans `/etc/nginx/conf.d/votre_domaine.d/my_webapp.d/WHATEVER_NAME.conf` (assurez-vous que le fichier a l'extension `.conf`, et changez `my_webapp.d` en `my_webapp__xx.d` si vous voulez changer la configuration de la deuxième installation ou plus de my_webapp). diff --git a/scripts/backup b/scripts/backup index 2d2ea7a..40b562e 100644 --- a/scripts/backup +++ b/scripts/backup @@ -34,6 +34,7 @@ ynh_backup --src_path="$install_dir" #================================================= ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" +ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.d" #================================================= # BACKUP THE PHP-FPM CONFIGURATION diff --git a/scripts/change_url b/scripts/change_url index a430715..4433872 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -9,6 +9,21 @@ source _common.sh source /usr/share/yunohost/helpers +#================================================= +# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +#================================================= +ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=5 + +# Backup the current version of the app +ynh_clean_setup () { + # Remove the new domain config file, the remove script won't do it as it doesn't know yet its location. + ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" + ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.d" + + # restore it if the upgrade fails + ynh_restore_upgradebackup +} + #================================================= # ACTIVATE MAINTENANCE MODE #================================================= @@ -25,14 +40,7 @@ ynh_maintenance_mode_ON ynh_script_progression --message="Updating NGINX web server configuration..." --weight=2 nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf - -# Prepare nginx.conf -if [ $phpversion != "none" ] -then - cp ../conf/nginx{_with_php,}.conf -else - cp ../conf/nginx{_no_php,}.conf -fi +nginx_extra_conf_dir=/etc/nginx/conf.d/$old_domain.d/$app.d # Change the path in the NGINX config file if [ $change_path -eq 1 ] @@ -53,10 +61,19 @@ if [ $change_domain -eq 1 ] then # Delete file checksum for the old conf file location ynh_delete_file_checksum --file="$nginx_conf_path" - mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf + ynh_delete_file_checksum --file="$nginx_extra_conf_dir/php.conf" + + path_url="$new_path" + domain="$old_domain" + ynh_remove_nginx_config + + domain="$new_domain" + ynh_add_nginx_config + + mv $nginx_extra_conf_dir /etc/nginx/conf.d/$new_domain.d/$app.d # Store file checksum for the new config file location - ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" + ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.d/php.conf" fi #================================================= diff --git a/scripts/config b/scripts/config index 3f3d88c..7763f7c 100644 --- a/scripts/config +++ b/scripts/config @@ -119,11 +119,14 @@ ynh_app_config_apply() { # ^ ynh_add_config replaces __PHPVERSION__ by __PHP_YNH_VERSION__... ynh_app_setting_set --app=$app --key=phpversion --value="$phpversion" + nginx_extra_conf_dir="/etc/nginx/conf.d/$domain.d/$app.d" + mkdir -p "$nginx_extra_conf_dir" if [ "$phpversion" == "none" ] then - cp ../conf/nginx{_no_php,}.conf + ynh_delete_file_checksum --file="$nginx_extra_conf_dir/php.conf" + ynh_secure_remove --file="$nginx_extra_conf_dir/php.conf" else - cp ../conf/nginx{_with_php,}.conf + ynh_add_config --template="nginx-php.conf" --destination="$nginx_extra_conf_dir/php.conf" ynh_install_app_dependencies "php${phpversion}-fpm" ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --phpversion=$phpversion # ^ the helper takes care of ynh_app_setting_set the phpversion diff --git a/scripts/install b/scripts/install index ed2d9f2..8280d3d 100644 --- a/scripts/install +++ b/scripts/install @@ -58,17 +58,19 @@ fi #================================================= ynh_script_progression --message="Configuring NGINX web server..." --weight=2 -# Prepare nginx.conf +nginx_extra_conf_dir="/etc/nginx/conf.d/$domain.d/$app.d" +mkdir -p "$nginx_extra_conf_dir" + +# Prepare nginx extra conf if [ $phpversion != "none" ] then - cp ../conf/nginx{_with_php,}.conf + ynh_add_config --template="nginx-php.conf" --destination="$nginx_extra_conf_dir/php.conf" YNH_PHP_VERSION="$phpversion" -else - cp ../conf/nginx{_no_php,}.conf fi # Create a dedicated NGINX config ynh_add_nginx_config +ynh_add_config --template="example-custom-nginx-config.conf" --destination="$nginx_extra_conf_dir/sample.conf" #================================================= # CREATE DEDICATED USER diff --git a/scripts/remove b/scripts/remove index a037124..962cf23 100644 --- a/scripts/remove +++ b/scripts/remove @@ -39,6 +39,7 @@ ynh_script_progression --message="Removing NGINX web server configuration..." -- # Remove the dedicated NGINX config ynh_remove_nginx_config +ynh_secure_remove --file="/etc/nginx/conf.d/$domain.d/$app.d" #================================================= # REMOVE PHP-FPM CONFIGURATION diff --git a/scripts/restore b/scripts/restore index 3759d0a..68e97f0 100644 --- a/scripts/restore +++ b/scripts/restore @@ -23,6 +23,7 @@ password=$(ynh_app_setting_get --app=$app --key=password) #================================================= ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" +ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.d/" #================================================= # RESTORE THE MYSQL DATABASE diff --git a/scripts/upgrade b/scripts/upgrade index a8d9a3e..f517cc3 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -79,16 +79,20 @@ ynh_maintenance_mode_ON ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2 # Prepare nginx.conf +nginx_extra_conf_dir="/etc/nginx/conf.d/$domain.d/$app.d" + +mkdir -p "$nginx_extra_conf_dir" + +# Prepare nginx extra conf if [ $phpversion != "none" ] then - cp ../conf/nginx{_with_php,}.conf + ynh_add_config --template="nginx-php.conf" --destination="$nginx_extra_conf_dir/php.conf" YNH_PHP_VERSION="$phpversion" -else - cp ../conf/nginx{_no_php,}.conf fi # Create a dedicated NGINX config ynh_add_nginx_config +ynh_add_config --template="example-custom-nginx-config.conf" --destination="$nginx_extra_conf_dir/sample.conf" #================================================= # CREATE DEDICATED USER From e634b772c32d197c6f6bd7194de2fb4828c63fee Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Thu, 13 Apr 2023 09:11:36 +0000 Subject: [PATCH 56/83] Auto-update README --- README.md | 2 ++ README_fr.md | 2 ++ 2 files changed, 4 insertions(+) diff --git a/README.md b/README.md index 9d1055f..a297cf9 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,8 @@ PHP-FPM version can also be selected among `none`, `7.4`, `8.0`, `8.1` and `8.2` **Once installed, go to the chosen URL to know the user, domain and port you will have to use for the SFTP access.** The password is one you chosen during the installation. Under the Web directory, you will see a `www` folder which contains the public files served by this app. You can put all the files of your custom Web application inside. +If you want to add customized nginx configuration, put it in `/etc/nginx/conf.d/YOUR_DOMAIN.d/my_webapp.d/WHATEVER_NAME.conf` (ensure that the file has the `.conf` extension, and change `my_webapp.d` to `my_webapp__xx.d` if you want to change the configuration of the second or more installation of my_webapp). + **Shipped version:** 1.0~ynh12 ## Documentation and resources diff --git a/README_fr.md b/README_fr.md index f907ca8..ff90d05 100644 --- a/README_fr.md +++ b/README_fr.md @@ -24,6 +24,8 @@ La version de PHP-FPM peut aussi être choisie, parmi `none`, `7.4`, `8.0`, `8.1 **Une fois installé, rendez-vous sur l'URL choisie pour connaître l'utilisateur, le domaine et le port que vous devrez utiliser pour l'accès SFTP.** Le mot de passe est celui que vous avez choisi lors de l'installation. Sous le répertoire Web, vous verrez un dossier `www` qui contient les fichiers publics servis par cette application. Vous pouvez mettre tous les fichiers de votre application Web personnalisée à l'intérieur. +Si vous voulez ajouter une configuration personnalisée de nginx, mettez-la dans `/etc/nginx/conf.d/votre_domaine.d/my_webapp.d/WHATEVER_NAME.conf` (assurez-vous que le fichier a l'extension `.conf`, et changez `my_webapp.d` en `my_webapp__xx.d` si vous voulez changer la configuration de la deuxième installation ou plus de my_webapp). + **Version incluse :** 1.0~ynh12 ## Documentations et ressources From 427c8522dc896b48cba58b458d912e7816c523a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 13 Apr 2023 11:50:30 +0200 Subject: [PATCH 57/83] add info on how to use SFTP #113 --- doc/ADMIN.md | 18 ++++++++++++++++-- doc/ADMIN_fr.md | 22 ++++++++++++++++++++-- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/doc/ADMIN.md b/doc/ADMIN.md index 1f6de18..cc8d76b 100644 --- a/doc/ADMIN.md +++ b/doc/ADMIN.md @@ -1,3 +1,17 @@ -#### SFTP port +### Login using SFTP -You may have change the SSH port as described in this section: [Modify the SSH port](https://yunohost.org/en/security#modify-the-ssh-port); then you should use this port to update your website with SFTP. +Once installed, go to the chosen URL to know the username, domain and port you will have to use for the SFTP access. + +- Username: __ID__ +- Password: password chosen during installation +- Port: __SSH_PORT__ + +To connect, you'll need an SFTP app such as [Filezilla](https://filezilla-project.org/) for Windows, Mac or Linux. You can also use your default file manager on [Mac](https://support.apple.com/guide/mac-help/connect-mac-shared-computers-servers-mchlp1140/mac) or Linux. + +### Adding or editing files + +Once logged in SFTP, under the Web directory, you will see a `www` folder which contains the public files served by this app. You can put all the files of your custom Web application inside. + +### Forgot your SFTP password? + +If you forgot your SFTP password, you can change it in YunoHost's webadmin interface in `Apps > My webapp > My Webapp configuration`. diff --git a/doc/ADMIN_fr.md b/doc/ADMIN_fr.md index a95b44b..4cb8954 100644 --- a/doc/ADMIN_fr.md +++ b/doc/ADMIN_fr.md @@ -1,3 +1,21 @@ -#### Port SFTP +### Connexion avec SFTP -Vous avez peut-être changé le port SSH comme décrit dans cette section : [Modifier le port SSH](https://yunohost.org/fr/security#modify-the-ssh-port) ; alors vous devriez utiliser ce port pour mettre à jour votre site Web avec SFTP. +Une fois installée, rendez-vous sur l'URL choisie pour connaître le nom d'utilisateur, le domaine et le port que vous devrez utiliser pour l'accès SFTP. + +- Nom d'utilisateur: __ID__ +- Mot de passe: mot de passe défini lors de l'installation +- Port: __SSH_PORT__ + +Pour vous connectez, vous devrez utiliser une application SFTP tel que [Filezilla](https://filezilla-project.org/) pour Windows, Mac ou Linux. Vous pouvez aussi directement utiliser votre gestionnaire de fichiers sous Linux ou [Mac](https://support.apple.com/guide/mac-help/connect-mac-shared-computers-servers-mchlp1140/mac). + +### Ajouter ou modifier les fichiers + +Après vous être connecté avec SFTP, sous le répertoire Web, vous verrez un dossier `www` qui contient les fichiers publics servis par cette application. Vous pouvez mettre tous les fichiers de votre application Web personnalisée à l'intérieur. + +### Oubli du mot de passe SFTP + +Si vous avez oublié votre mot de passe SFTP, vous pouvez le changer dans la webadmin de Yunohost dans `Applications > Votre webapp > My Webapp configuration`. + +## Résolution de problèmes + +Si vous n'arrivez pas à vous connecter et que vous avez vérifié que le nom d'utilisateur et le mot de passe sont bons, vérifiez si SFTP est activé pour votre app From eace720c615de8ad47dcc2fe0ea48893d03f3f7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 13 Apr 2023 11:51:01 +0200 Subject: [PATCH 58/83] Update ADMIN_fr.md --- doc/ADMIN_fr.md | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/doc/ADMIN_fr.md b/doc/ADMIN_fr.md index a95b44b..4cb8954 100644 --- a/doc/ADMIN_fr.md +++ b/doc/ADMIN_fr.md @@ -1,3 +1,21 @@ -#### Port SFTP +### Connexion avec SFTP -Vous avez peut-être changé le port SSH comme décrit dans cette section : [Modifier le port SSH](https://yunohost.org/fr/security#modify-the-ssh-port) ; alors vous devriez utiliser ce port pour mettre à jour votre site Web avec SFTP. +Une fois installée, rendez-vous sur l'URL choisie pour connaître le nom d'utilisateur, le domaine et le port que vous devrez utiliser pour l'accès SFTP. + +- Nom d'utilisateur: __ID__ +- Mot de passe: mot de passe défini lors de l'installation +- Port: __SSH_PORT__ + +Pour vous connectez, vous devrez utiliser une application SFTP tel que [Filezilla](https://filezilla-project.org/) pour Windows, Mac ou Linux. Vous pouvez aussi directement utiliser votre gestionnaire de fichiers sous Linux ou [Mac](https://support.apple.com/guide/mac-help/connect-mac-shared-computers-servers-mchlp1140/mac). + +### Ajouter ou modifier les fichiers + +Après vous être connecté avec SFTP, sous le répertoire Web, vous verrez un dossier `www` qui contient les fichiers publics servis par cette application. Vous pouvez mettre tous les fichiers de votre application Web personnalisée à l'intérieur. + +### Oubli du mot de passe SFTP + +Si vous avez oublié votre mot de passe SFTP, vous pouvez le changer dans la webadmin de Yunohost dans `Applications > Votre webapp > My Webapp configuration`. + +## Résolution de problèmes + +Si vous n'arrivez pas à vous connecter et que vous avez vérifié que le nom d'utilisateur et le mot de passe sont bons, vérifiez si SFTP est activé pour votre app From 3055c9a1496272c30ecf7628ba048c25f2c27a90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 13 Apr 2023 11:51:32 +0200 Subject: [PATCH 59/83] Update ADMIN.md --- doc/ADMIN.md | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/doc/ADMIN.md b/doc/ADMIN.md index 1f6de18..cc8d76b 100644 --- a/doc/ADMIN.md +++ b/doc/ADMIN.md @@ -1,3 +1,17 @@ -#### SFTP port +### Login using SFTP -You may have change the SSH port as described in this section: [Modify the SSH port](https://yunohost.org/en/security#modify-the-ssh-port); then you should use this port to update your website with SFTP. +Once installed, go to the chosen URL to know the username, domain and port you will have to use for the SFTP access. + +- Username: __ID__ +- Password: password chosen during installation +- Port: __SSH_PORT__ + +To connect, you'll need an SFTP app such as [Filezilla](https://filezilla-project.org/) for Windows, Mac or Linux. You can also use your default file manager on [Mac](https://support.apple.com/guide/mac-help/connect-mac-shared-computers-servers-mchlp1140/mac) or Linux. + +### Adding or editing files + +Once logged in SFTP, under the Web directory, you will see a `www` folder which contains the public files served by this app. You can put all the files of your custom Web application inside. + +### Forgot your SFTP password? + +If you forgot your SFTP password, you can change it in YunoHost's webadmin interface in `Apps > My webapp > My Webapp configuration`. From d3b74fb36fcf58dae010ccaf5bb8d734f7e3f455 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 13 Apr 2023 11:59:42 +0200 Subject: [PATCH 60/83] Update tests.toml --- tests.toml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/tests.toml b/tests.toml index de2537d..ce3886c 100644 --- a/tests.toml +++ b/tests.toml @@ -15,11 +15,6 @@ test_format = 1.0 only = ["install.subdir", "backup_restore", "upgrade" ] args.phpversion = "8.0" -[81_test] - - only = ["install.subdir", "backup_restore", "upgrade" ] - args.phpversion = "8.1" - [none_test] only = ["install.subdir", "backup_restore", "upgrade" ] From e280d90298b352568d591d257e09edac470fefdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 13 Apr 2023 11:59:53 +0200 Subject: [PATCH 61/83] Update tests.toml --- tests.toml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/tests.toml b/tests.toml index de2537d..ce3886c 100644 --- a/tests.toml +++ b/tests.toml @@ -15,11 +15,6 @@ test_format = 1.0 only = ["install.subdir", "backup_restore", "upgrade" ] args.phpversion = "8.0" -[81_test] - - only = ["install.subdir", "backup_restore", "upgrade" ] - args.phpversion = "8.1" - [none_test] only = ["install.subdir", "backup_restore", "upgrade" ] From 7de1bb0c3a27219a43b21744e2dab0db89777816 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 13 Apr 2023 15:17:47 +0200 Subject: [PATCH 62/83] remove visible password --- doc/POST_INSTALL.md | 2 +- doc/POST_INSTALL_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/POST_INSTALL.md b/doc/POST_INSTALL.md index 3c36ca6..3cee50d 100644 --- a/doc/POST_INSTALL.md +++ b/doc/POST_INSTALL.md @@ -9,7 +9,7 @@ You can connect to this repository by using SFTP with the following credentials. Domain: __DOMAIN__ Port: __SSH_PORT__ User: __ID__ -Password: __PASSWORD__ +Password: password chosen during installation This app is simply a blank web app container. You have to put your own app inside. diff --git a/doc/POST_INSTALL_fr.md b/doc/POST_INSTALL_fr.md index 6fbda66..0558305 100644 --- a/doc/POST_INSTALL_fr.md +++ b/doc/POST_INSTALL_fr.md @@ -9,6 +9,6 @@ Vous pouvez vous connecter à ce répertoir en utilisant SFTP avec les informati Domaine : __DOMAIN__ Port : __SSH_PORT__ ID de l'utilisateur : __ID__ -Mot de passe : __PASSWORD__ +Mot de passe : mot de passe défini lors de l'installation Cette application est un simple conteneur vierge d'application Web. Vous devez mettre votre propre application à l'intérieur de ce répertoire : __INSTALL_DIR__/www/ From b29eb643b2acd2dd17c65079864ddcd5d9b1a994 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 5 May 2023 15:44:22 +0200 Subject: [PATCH 63/83] Update scripts/upgrade Co-authored-by: Alexandre Aubin --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index f517cc3..19a6549 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -60,7 +60,7 @@ fi if [ -n "$(ynh_app_setting_get --app=$app --key=user)" ] then ynh_systemd_action --service_name=php${phpversion}-fpm --action=stop - ynh_system_user_delete --username="$(ynh_app_setting_get --app=$app --key=user)" + ynh_system_user_delete --username="$(ynh_app_setting_get --app=$app --key=user)" ynh_app_setting_delete --app=$app --key=user fi From 9e3097c524b483e358f7641b90cccba894803c41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 5 May 2023 15:44:39 +0200 Subject: [PATCH 64/83] fix --- scripts/backup | 9 --------- scripts/config | 2 +- scripts/install | 12 ------------ scripts/remove | 7 ------- scripts/restore | 9 --------- 5 files changed, 1 insertion(+), 38 deletions(-) diff --git a/scripts/backup b/scripts/backup index 40b562e..17b1472 100644 --- a/scripts/backup +++ b/scripts/backup @@ -9,15 +9,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= -ynh_print_info --message="Loading installation settings..." - -with_mysql=$(ynh_app_setting_get --app=$app --key=with_mysql) -with_sftp=$(ynh_app_setting_get --app=$app --key=with_sftp) -db_name=$(ynh_app_setting_get --app=$app --key=db_name) - #================================================= # DECLARE DATA AND CONF FILES TO BACKUP #================================================= diff --git a/scripts/config b/scripts/config index 7763f7c..21b6f17 100644 --- a/scripts/config +++ b/scripts/config @@ -17,7 +17,7 @@ ynh_abort_if_errors install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) domain=$(ynh_app_setting_get --app=$app --key=domain) -path_url=$(ynh_app_setting_get --app=$app --key=path) +path=$(ynh_app_setting_get --app=$app --key=path) current_fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint) fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint) diff --git a/scripts/install b/scripts/install index 8280d3d..7568e4d 100644 --- a/scripts/install +++ b/scripts/install @@ -15,7 +15,6 @@ source /usr/share/yunohost/helpers password=$YNH_APP_ARG_PASSWORD app_nb=$YNH_APP_INSTANCE_NUMBER -phpversion=$YNH_APP_ARG_PHPVERSION ssh_port=$(grep "^Port" /etc/ssh/sshd_config | awk '{print $2}') #================================================= @@ -25,17 +24,6 @@ ynh_script_progression --message="Validating installation parameters..." --weigh [ $with_sftp -eq 0 ] || [ "$password" != "" ] || ynh_die --message="You need to set a password to enable SFTP" -#================================================= -# STORE SETTINGS FROM MANIFEST -#================================================= -ynh_script_progression --message="Storing installation settings..." - -ynh_app_setting_set --app=$app --key=password --value=$password -ynh_app_setting_set --app=$app --key=ssh_port --value=$ssh_port -ynh_app_setting_set --app=$app --key=with_mysql --value=$with_mysql -ynh_app_setting_set --app=$app --key=with_sftp --value=$with_sftp -ynh_app_setting_set --app=$app --key=phpversion --value=$phpversion - #================================================= # CREATE A MYSQL DATABASE #================================================= diff --git a/scripts/remove b/scripts/remove index 962cf23..f86af18 100644 --- a/scripts/remove +++ b/scripts/remove @@ -9,13 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= - -with_mysql=$(ynh_app_setting_get --app=$app --key=with_mysql) -with_sftp=$(ynh_app_setting_get --app=$app --key=with_sftp) - #================================================= # STANDARD REMOVE #================================================= diff --git a/scripts/restore b/scripts/restore index 68e97f0..8db3265 100644 --- a/scripts/restore +++ b/scripts/restore @@ -9,15 +9,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= -ynh_script_progression --message="Loading settings..." --weight=2 - -with_mysql=$(ynh_app_setting_get --app=$app --key=with_mysql) -with_sftp=$(ynh_app_setting_get --app=$app --key=with_sftp) -password=$(ynh_app_setting_get --app=$app --key=password) - #================================================= # RESTORE THE NGINX CONFIGURATION #================================================= From 9f7b30459bd53310a5cd6c3433348df95a135628 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 5 May 2023 15:45:45 +0200 Subject: [PATCH 65/83] remove actions folder --- scripts/actions/create_database | 64 --------------------------------- scripts/actions/remove_database | 51 -------------------------- scripts/actions/sftp | 63 -------------------------------- 3 files changed, 178 deletions(-) delete mode 100755 scripts/actions/create_database delete mode 100755 scripts/actions/remove_database delete mode 100755 scripts/actions/sftp diff --git a/scripts/actions/create_database b/scripts/actions/create_database deleted file mode 100755 index 3013df6..0000000 --- a/scripts/actions/create_database +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/bash - -#================================================= -# GENERIC STARTING -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - -source scripts/_common.sh -source /usr/share/yunohost/helpers - -#================================================= -# RETRIEVE ARGUMENTS -#================================================= - -with_mysql=$(ynh_app_setting_get --app=$app --key=with_mysql) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) - -app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID} - -#================================================= -# CHECK IF ARGUMENTS ARE CORRECT -#================================================= - -#================================================= -# CHECK IF AN ACTION HAS TO BE DONE -#================================================= - -#================================================= -# SPECIFIC ACTION -#================================================= -# REMOVE THE PREVIOUS DATABASE -#================================================= -ynh_script_progression --message="Removing the previous database..." --weight=6 - -if [ $with_mysql -eq 1 ] -then - yunohost app action run $app remove_database -fi - -#================================================= -# CREATE A NEW DATABASE -#================================================= -ynh_script_progression --message="Creating a new database..." --weight=4 - -db_name=$(ynh_sanitize_dbid --db_name=$app) - -# Reuse the previous password if existing -db_pwd=$(grep "pass:" "$install_dir/db_access.txt" | cut -d' ' -f2 2> /dev/null) - -ynh_mysql_setup_db --db_user=$db_name --db_name=$db_name --db_pwd=$db_pwd - -echo -e "# MySQL Database - name: ${db_name}\nuser: ${db_name}\npass: ${db_pwd}" > "$final_path/db_access.txt" - -# Update the config of the app -ynh_app_setting_set --app=$app --key=with_mysql --value=1 -ynh_app_setting_set --app=$app --key=db_name --value=$db_name - -#================================================= -# END OF SCRIPT -#================================================= - -ynh_script_progression --message="Execution completed" --last diff --git a/scripts/actions/remove_database b/scripts/actions/remove_database deleted file mode 100755 index 5677093..0000000 --- a/scripts/actions/remove_database +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash - -#================================================= -# GENERIC STARTING -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - -source scripts/_common.sh -source /usr/share/yunohost/helpers - -#================================================= -# RETRIEVE ARGUMENTS -#================================================= - -with_mysql=$(ynh_app_setting_get --app=$app --key=with_mysql) - -app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID} - -#================================================= -# CHECK IF ARGUMENTS ARE CORRECT -#================================================= - -#================================================= -# CHECK IF AN ACTION HAS TO BE DONE -#================================================= - -if [ $with_mysql -eq 0 ] -then - ynh_die --message="There's no database to remove." --ret_code=0 -fi - -#================================================= -# SPECIFIC ACTION -#================================================= -# REMOVE THE DATABASE -#================================================= -ynh_script_progression --message="Removing the database..." --weight=9 - -db_name=$(ynh_app_setting_get --app=$app --key=db_name) -db_user=$db_name -ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name - -# Update the config of the app -ynh_app_setting_set --app=$app --key=with_mysql --value=0 - -#================================================= -# END OF SCRIPT -#================================================= - -ynh_script_progression --message="Execution completed" --last diff --git a/scripts/actions/sftp b/scripts/actions/sftp deleted file mode 100755 index 13c8d5b..0000000 --- a/scripts/actions/sftp +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/bash - -#================================================= -# GENERIC STARTING -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - -source scripts/_common.sh -source /usr/share/yunohost/helpers - -#================================================= -# RETRIEVE ARGUMENTS -#================================================= - -app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID} - -with_sftp=${YNH_ACTION_WITH_SFTP} - -#================================================= -# CHECK IF ARGUMENTS ARE CORRECT -#================================================= - -#================================================= -# CHECK IF AN ACTION HAS TO BE DONE -#================================================= - -with_sftp_old=$(ynh_app_setting_get --app=$app --key=with_sftp) - -if [ $with_sftp -eq $with_sftp_old ] -then - ynh_die --message="with_sftp is already set as $with_sftp." --ret_code=0 -fi - -#================================================= -# SPECIFIC ACTION -#================================================= -# MOVE TO PUBLIC OR PRIVATE -#================================================= - -if [ $with_sftp -eq 1 ] -then - ynh_script_progression --message="Configuring SSH to add a SFTP access..." --weight=3 - - ynh_add_config --template="conf/ssh_regenconf_hook" --destination="/usr/share/yunohost/hooks/conf_regen/90-ssh_$app" - -else - ynh_script_progression --message="Removing the custom ssh config for the SFTP access..." --weight=3 - - # Remove regen-conf hook - ynh_secure_remove --file="/usr/share/yunohost/hooks/conf_regen/90-ssh_$app" -fi - -yunohost tools regen-conf ssh - -# Update the config of the app -ynh_app_setting_set --app=$app --key=with_sftp --value=$with_sftp - -#================================================= -# END OF SCRIPT -#================================================= - -ynh_script_progression --message="Execution completed" --last From 97a8e043391fca6dab4306f8a04ea5e139f8a1a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 5 May 2023 15:46:29 +0200 Subject: [PATCH 66/83] Update manifest.toml --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index 9649a01..35d325b 100644 --- a/manifest.toml +++ b/manifest.toml @@ -14,7 +14,7 @@ license = "GPL-3.0-only" code = "https://github.com/YunoHost-Apps/my_webapp_ynh" [integration] -yunohost = ">= 11.1.17" +yunohost = ">= 11.1.18" architectures = "all" multi_instance = true ldap = "not_relevant" From 6904852de50d75fc395dfbbdcab9b5102822b753 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 5 May 2023 21:33:04 +0200 Subject: [PATCH 67/83] Update install --- scripts/install | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/install b/scripts/install index 7568e4d..a976713 100644 --- a/scripts/install +++ b/scripts/install @@ -24,6 +24,13 @@ ynh_script_progression --message="Validating installation parameters..." --weigh [ $with_sftp -eq 0 ] || [ "$password" != "" ] || ynh_die --message="You need to set a password to enable SFTP" +#================================================= +# STORE SETTINGS FROM MANIFEST +#================================================= +ynh_script_progression --message="Storing installation settings..." --weight=1 + +ynh_app_setting_set --app=$app --key=password --value=$password + #================================================= # CREATE A MYSQL DATABASE #================================================= From a2f3b95c19b4e4f6bb12972a44d46b69eb363f44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 5 May 2023 21:35:57 +0200 Subject: [PATCH 68/83] remove SSH port --- doc/ADMIN.md | 2 +- doc/ADMIN_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/ADMIN.md b/doc/ADMIN.md index cc8d76b..b72bee4 100644 --- a/doc/ADMIN.md +++ b/doc/ADMIN.md @@ -4,7 +4,7 @@ Once installed, go to the chosen URL to know the username, domain and port you w - Username: __ID__ - Password: password chosen during installation -- Port: __SSH_PORT__ +- Port: 22 (unless change to another port) To connect, you'll need an SFTP app such as [Filezilla](https://filezilla-project.org/) for Windows, Mac or Linux. You can also use your default file manager on [Mac](https://support.apple.com/guide/mac-help/connect-mac-shared-computers-servers-mchlp1140/mac) or Linux. diff --git a/doc/ADMIN_fr.md b/doc/ADMIN_fr.md index 4cb8954..84e839a 100644 --- a/doc/ADMIN_fr.md +++ b/doc/ADMIN_fr.md @@ -4,7 +4,7 @@ Une fois installée, rendez-vous sur l'URL choisie pour connaître le nom d'util - Nom d'utilisateur: __ID__ - Mot de passe: mot de passe défini lors de l'installation -- Port: __SSH_PORT__ +- Port: 22 (sauf si modifier pour un autre port) Pour vous connectez, vous devrez utiliser une application SFTP tel que [Filezilla](https://filezilla-project.org/) pour Windows, Mac ou Linux. Vous pouvez aussi directement utiliser votre gestionnaire de fichiers sous Linux ou [Mac](https://support.apple.com/guide/mac-help/connect-mac-shared-computers-servers-mchlp1140/mac). From f03e68f14c59263c8f9f35688dc9b8198345d472 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 5 May 2023 22:27:07 +0200 Subject: [PATCH 69/83] cleaning --- doc/POST_INSTALL.md | 2 +- doc/POST_INSTALL_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/POST_INSTALL.md b/doc/POST_INSTALL.md index 3cee50d..3658b58 100644 --- a/doc/POST_INSTALL.md +++ b/doc/POST_INSTALL.md @@ -7,7 +7,7 @@ Password: __DB_PWD__ You can connect to this repository by using SFTP with the following credentials. Domain: __DOMAIN__ -Port: __SSH_PORT__ +Port: 22 (unless change to another port) User: __ID__ Password: password chosen during installation diff --git a/doc/POST_INSTALL_fr.md b/doc/POST_INSTALL_fr.md index 0558305..af9317f 100644 --- a/doc/POST_INSTALL_fr.md +++ b/doc/POST_INSTALL_fr.md @@ -7,7 +7,7 @@ Mot de passe : __DB_PWD__ Vous pouvez vous connecter à ce répertoir en utilisant SFTP avec les informations d'identification suivantes : Domaine : __DOMAIN__ -Port : __SSH_PORT__ +Port : 22 (sauf si modifier pour un autre port) ID de l'utilisateur : __ID__ Mot de passe : mot de passe défini lors de l'installation From 906013809def7022076b5ca1e27d3d66f3d275de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sat, 27 May 2023 09:09:19 +0200 Subject: [PATCH 70/83] Update doc/POST_INSTALL.md Co-authored-by: Alexandre Aubin --- doc/POST_INSTALL.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/POST_INSTALL.md b/doc/POST_INSTALL.md index 3658b58..c7220c3 100644 --- a/doc/POST_INSTALL.md +++ b/doc/POST_INSTALL.md @@ -1,8 +1,8 @@ If you have requested a MYSQL database, please find information about this SQL database: -Database user: __DB_USER__ -Database name: __DB_NAME__ -Password: __DB_PWD__ +- Database user: __DB_USER__ +- Database name: __DB_NAME__ +- Password: __DB_PWD__ You can connect to this repository by using SFTP with the following credentials. From 9b0dddb821c671a5a20549c175171de3c4b64b73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sat, 27 May 2023 09:09:45 +0200 Subject: [PATCH 71/83] Update doc/ADMIN.md Co-authored-by: Alexandre Aubin --- doc/ADMIN.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/doc/ADMIN.md b/doc/ADMIN.md index b72bee4..0ff5eab 100644 --- a/doc/ADMIN.md +++ b/doc/ADMIN.md @@ -1,10 +1,13 @@ +This app is simply a blank web app skeleton : you are expected to add you own content (HTML, CSS, PHP, ...) inside `__INSTALL_DIR__/www/`. One way to do so is by using SFTP. + ### Login using SFTP Once installed, go to the chosen URL to know the username, domain and port you will have to use for the SFTP access. -- Username: __ID__ +- Host: `__DOMAIN__` +- Username: `__ID__` - Password: password chosen during installation -- Port: 22 (unless change to another port) +- Port: 22 (unless you changed the SSH port) To connect, you'll need an SFTP app such as [Filezilla](https://filezilla-project.org/) for Windows, Mac or Linux. You can also use your default file manager on [Mac](https://support.apple.com/guide/mac-help/connect-mac-shared-computers-servers-mchlp1140/mac) or Linux. From e7c022d5f5af811a58d9f7977171f4b23f8b4ab6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sat, 27 May 2023 09:10:08 +0200 Subject: [PATCH 72/83] Update doc/ADMIN.md Co-authored-by: Alexandre Aubin --- doc/ADMIN.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/ADMIN.md b/doc/ADMIN.md index 0ff5eab..6269999 100644 --- a/doc/ADMIN.md +++ b/doc/ADMIN.md @@ -18,3 +18,7 @@ Once logged in SFTP, under the Web directory, you will see a `www` folder which ### Forgot your SFTP password? If you forgot your SFTP password, you can change it in YunoHost's webadmin interface in `Apps > My webapp > My Webapp configuration`. + +### Customizing the nginx configuration + +If you want to add tweak the nginx configuration for this app, it is recommended to edit `/etc/nginx/conf.d/__DOMAIN__.d/__ID__.d/WHATEVER_NAME.conf` (ensure that the file has the `.conf` extension) and reload the nginx after making sure that the configuration is valid using `nginx -t`. From 69b8a22d19e99533a6354d14050ddae1ec43fbdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sat, 27 May 2023 09:10:23 +0200 Subject: [PATCH 73/83] Update doc/ADMIN_fr.md Co-authored-by: Alexandre Aubin --- doc/ADMIN_fr.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/ADMIN_fr.md b/doc/ADMIN_fr.md index 84e839a..c032655 100644 --- a/doc/ADMIN_fr.md +++ b/doc/ADMIN_fr.md @@ -19,3 +19,7 @@ Si vous avez oublié votre mot de passe SFTP, vous pouvez le changer dans la web ## Résolution de problèmes Si vous n'arrivez pas à vous connecter et que vous avez vérifié que le nom d'utilisateur et le mot de passe sont bons, vérifiez si SFTP est activé pour votre app + +### Personnaliser la configuration nginx + +Si vous souhaitez ajuster la configuration nginx pour cette app, il est recommandé d'éditer `/etc/nginx/conf.d/__DOMAIN__.d/__ID__.d/WHATEVER_NAME.conf` (assurez-vous que le fichier a l'extension `.conf`) puis rechargez nginx après vous être assuré que la configuration est valide à l'aide de `nginx -t`. From 3c9c867e3a991083a2912bdb19f7abcc0d7a9dc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sat, 27 May 2023 09:10:36 +0200 Subject: [PATCH 74/83] Update doc/ADMIN_fr.md Co-authored-by: Alexandre Aubin --- doc/ADMIN_fr.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/doc/ADMIN_fr.md b/doc/ADMIN_fr.md index c032655..562ba76 100644 --- a/doc/ADMIN_fr.md +++ b/doc/ADMIN_fr.md @@ -1,10 +1,13 @@ +Cette app est uniquement un squelette : il vous appartient d'ajouter vos propre pages HTML, CSS, PHP, ... à l'intérieur de `__INSTALL_DIR__/www/`. Une manière de procéder est d'utiliser SFTP. + ### Connexion avec SFTP Une fois installée, rendez-vous sur l'URL choisie pour connaître le nom d'utilisateur, le domaine et le port que vous devrez utiliser pour l'accès SFTP. -- Nom d'utilisateur: __ID__ +- Hôte: `__DOMAIN__` +- Nom d'utilisateur: `__ID__` - Mot de passe: mot de passe défini lors de l'installation -- Port: 22 (sauf si modifier pour un autre port) +- Port: 22 (à moins que vous ayez changé le port SSH) Pour vous connectez, vous devrez utiliser une application SFTP tel que [Filezilla](https://filezilla-project.org/) pour Windows, Mac ou Linux. Vous pouvez aussi directement utiliser votre gestionnaire de fichiers sous Linux ou [Mac](https://support.apple.com/guide/mac-help/connect-mac-shared-computers-servers-mchlp1140/mac). From fffa0b0e20bd6a0aef542b0cb22eb0f42d5f1b10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sat, 27 May 2023 09:10:49 +0200 Subject: [PATCH 75/83] Update doc/DESCRIPTION.md Co-authored-by: Alexandre Aubin --- doc/DESCRIPTION.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/doc/DESCRIPTION.md b/doc/DESCRIPTION.md index f24ccce..de48a9d 100644 --- a/doc/DESCRIPTION.md +++ b/doc/DESCRIPTION.md @@ -5,5 +5,3 @@ It can also create a MySQL database - which will be backed up and restored with PHP-FPM version can also be selected among `none`, `7.4`, `8.0`, `8.1` and `8.2`. **Once installed, go to the chosen URL to know the user, domain and port you will have to use for the SFTP access.** The password is one you chosen during the installation. Under the Web directory, you will see a `www` folder which contains the public files served by this app. You can put all the files of your custom Web application inside. - -If you want to add customized nginx configuration, put it in `/etc/nginx/conf.d/YOUR_DOMAIN.d/my_webapp.d/WHATEVER_NAME.conf` (ensure that the file has the `.conf` extension, and change `my_webapp.d` to `my_webapp__xx.d` if you want to change the configuration of the second or more installation of my_webapp). From 08bb8d278dc834a7278a6b8de9533bbcf8ddbb70 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Sat, 27 May 2023 07:10:53 +0000 Subject: [PATCH 76/83] Auto-update README --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index a297cf9..9d1055f 100644 --- a/README.md +++ b/README.md @@ -24,8 +24,6 @@ PHP-FPM version can also be selected among `none`, `7.4`, `8.0`, `8.1` and `8.2` **Once installed, go to the chosen URL to know the user, domain and port you will have to use for the SFTP access.** The password is one you chosen during the installation. Under the Web directory, you will see a `www` folder which contains the public files served by this app. You can put all the files of your custom Web application inside. -If you want to add customized nginx configuration, put it in `/etc/nginx/conf.d/YOUR_DOMAIN.d/my_webapp.d/WHATEVER_NAME.conf` (ensure that the file has the `.conf` extension, and change `my_webapp.d` to `my_webapp__xx.d` if you want to change the configuration of the second or more installation of my_webapp). - **Shipped version:** 1.0~ynh12 ## Documentation and resources From 66d9816339ce2a171188f81296c19b754d03165b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sat, 27 May 2023 09:11:16 +0200 Subject: [PATCH 77/83] Update doc/DESCRIPTION_fr.md Co-authored-by: Alexandre Aubin --- doc/DESCRIPTION_fr.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/doc/DESCRIPTION_fr.md b/doc/DESCRIPTION_fr.md index 956bd4a..2bf7f20 100644 --- a/doc/DESCRIPTION_fr.md +++ b/doc/DESCRIPTION_fr.md @@ -5,5 +5,3 @@ Elle peut également créer une base de données MySQL - qui sera sauvegardée e La version de PHP-FPM peut aussi être choisie, parmi `none`, `7.4`, `8.0`, `8.1` et `8.2`. **Une fois installé, rendez-vous sur l'URL choisie pour connaître l'utilisateur, le domaine et le port que vous devrez utiliser pour l'accès SFTP.** Le mot de passe est celui que vous avez choisi lors de l'installation. Sous le répertoire Web, vous verrez un dossier `www` qui contient les fichiers publics servis par cette application. Vous pouvez mettre tous les fichiers de votre application Web personnalisée à l'intérieur. - -Si vous voulez ajouter une configuration personnalisée de nginx, mettez-la dans `/etc/nginx/conf.d/votre_domaine.d/my_webapp.d/WHATEVER_NAME.conf` (assurez-vous que le fichier a l'extension `.conf`, et changez `my_webapp.d` en `my_webapp__xx.d` si vous voulez changer la configuration de la deuxième installation ou plus de my_webapp). From 2ddaa0c1074b5c24b44b978da6bc0d6234da6d26 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Sat, 27 May 2023 07:11:19 +0000 Subject: [PATCH 78/83] Auto-update README --- README_fr.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README_fr.md b/README_fr.md index ff90d05..f907ca8 100644 --- a/README_fr.md +++ b/README_fr.md @@ -24,8 +24,6 @@ La version de PHP-FPM peut aussi être choisie, parmi `none`, `7.4`, `8.0`, `8.1 **Une fois installé, rendez-vous sur l'URL choisie pour connaître l'utilisateur, le domaine et le port que vous devrez utiliser pour l'accès SFTP.** Le mot de passe est celui que vous avez choisi lors de l'installation. Sous le répertoire Web, vous verrez un dossier `www` qui contient les fichiers publics servis par cette application. Vous pouvez mettre tous les fichiers de votre application Web personnalisée à l'intérieur. -Si vous voulez ajouter une configuration personnalisée de nginx, mettez-la dans `/etc/nginx/conf.d/votre_domaine.d/my_webapp.d/WHATEVER_NAME.conf` (assurez-vous que le fichier a l'extension `.conf`, et changez `my_webapp.d` en `my_webapp__xx.d` si vous voulez changer la configuration de la deuxième installation ou plus de my_webapp). - **Version incluse :** 1.0~ynh12 ## Documentations et ressources From 2e4cc18d59e115a260c80a9ec9a4d6b6b9381b58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sat, 27 May 2023 09:11:37 +0200 Subject: [PATCH 79/83] Update doc/POST_INSTALL.md Co-authored-by: Alexandre Aubin --- doc/POST_INSTALL.md | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/doc/POST_INSTALL.md b/doc/POST_INSTALL.md index c7220c3..c463db3 100644 --- a/doc/POST_INSTALL.md +++ b/doc/POST_INSTALL.md @@ -4,13 +4,4 @@ If you have requested a MYSQL database, please find information about this SQL d - Database name: __DB_NAME__ - Password: __DB_PWD__ -You can connect to this repository by using SFTP with the following credentials. - -Domain: __DOMAIN__ -Port: 22 (unless change to another port) -User: __ID__ -Password: password chosen during installation - -This app is simply a blank web app container. You have to put your own app inside. - -Please put your files into this directory: __INSTALL_DIR__/www/ +The admin documentation below also contain information on how to connect using SFTP to edit the website content. From 3065ca3c87cff700c8e19ab6e84988361f118f58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sat, 27 May 2023 09:11:46 +0200 Subject: [PATCH 80/83] Update doc/POST_INSTALL_fr.md Co-authored-by: Alexandre Aubin --- doc/POST_INSTALL_fr.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/POST_INSTALL_fr.md b/doc/POST_INSTALL_fr.md index af9317f..f846e55 100644 --- a/doc/POST_INSTALL_fr.md +++ b/doc/POST_INSTALL_fr.md @@ -1,8 +1,8 @@ Si vous avez demandé une base de données MYSQL, voici les informations de cette base de données SQL : -Utilisateur de la base de données : __DB_USER__ -Nom de la base de données : __DB_NAME__ -Mot de passe : __DB_PWD__ +- Utilisateur de la base de données : __DB_USER__ +- Nom de la base de données : __DB_NAME__ +- Mot de passe : __DB_PWD__ Vous pouvez vous connecter à ce répertoir en utilisant SFTP avec les informations d'identification suivantes : From a6a32531fa3928de8cfe4c160a9fb2a662315118 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sat, 27 May 2023 09:11:57 +0200 Subject: [PATCH 81/83] Update doc/POST_INSTALL_fr.md Co-authored-by: Alexandre Aubin --- doc/POST_INSTALL_fr.md | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/doc/POST_INSTALL_fr.md b/doc/POST_INSTALL_fr.md index f846e55..87467a7 100644 --- a/doc/POST_INSTALL_fr.md +++ b/doc/POST_INSTALL_fr.md @@ -4,11 +4,4 @@ Si vous avez demandé une base de données MYSQL, voici les informations de cett - Nom de la base de données : __DB_NAME__ - Mot de passe : __DB_PWD__ -Vous pouvez vous connecter à ce répertoir en utilisant SFTP avec les informations d'identification suivantes : - -Domaine : __DOMAIN__ -Port : 22 (sauf si modifier pour un autre port) -ID de l'utilisateur : __ID__ -Mot de passe : mot de passe défini lors de l'installation - -Cette application est un simple conteneur vierge d'application Web. Vous devez mettre votre propre application à l'intérieur de ce répertoire : __INSTALL_DIR__/www/ +La documentation ci-dessous contient également les informations pour se connecter en SSH et modifier le contenu du site web. From 128e2eb732c69d8552f6fac2f4907378e7853f09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 28 May 2023 17:55:07 +0200 Subject: [PATCH 82/83] Update manifest.toml --- manifest.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.toml b/manifest.toml index 35d325b..e0085f2 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,7 +5,7 @@ name = "My Webapp" description.en = "Custom Web app with SFTP access to serve static (HTML, CSS, JS) and PHP files" description.fr = "Application Web personnalisée avec accès SFTP pour servir des fichiers statiques (HTML, CSS, JS) et PHP" -version = "1.0~ynh12" +version = "1.0~ynh14" maintainers = [] @@ -14,7 +14,7 @@ license = "GPL-3.0-only" code = "https://github.com/YunoHost-Apps/my_webapp_ynh" [integration] -yunohost = ">= 11.1.18" +yunohost = ">= 11.1.19" architectures = "all" multi_instance = true ldap = "not_relevant" From 03cc1fbd9530529cbc9a3e2426907c9320e3dfb6 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Sun, 28 May 2023 15:55:13 +0000 Subject: [PATCH 83/83] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9d1055f..a955187 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ PHP-FPM version can also be selected among `none`, `7.4`, `8.0`, `8.1` and `8.2` **Once installed, go to the chosen URL to know the user, domain and port you will have to use for the SFTP access.** The password is one you chosen during the installation. Under the Web directory, you will see a `www` folder which contains the public files served by this app. You can put all the files of your custom Web application inside. -**Shipped version:** 1.0~ynh12 +**Shipped version:** 1.0~ynh14 ## Documentation and resources * Upstream app code repository: diff --git a/README_fr.md b/README_fr.md index f907ca8..b99c86e 100644 --- a/README_fr.md +++ b/README_fr.md @@ -25,7 +25,7 @@ La version de PHP-FPM peut aussi être choisie, parmi `none`, `7.4`, `8.0`, `8.1 **Une fois installé, rendez-vous sur l'URL choisie pour connaître l'utilisateur, le domaine et le port que vous devrez utiliser pour l'accès SFTP.** Le mot de passe est celui que vous avez choisi lors de l'installation. Sous le répertoire Web, vous verrez un dossier `www` qui contient les fichiers publics servis par cette application. Vous pouvez mettre tous les fichiers de votre application Web personnalisée à l'intérieur. -**Version incluse :** 1.0~ynh12 +**Version incluse :** 1.0~ynh14 ## Documentations et ressources * Dépôt de code officiel de l’app :