From 84c36f948e533332dc580dff4107fcefae2269a8 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 7 Mar 2019 23:59:59 +0100 Subject: [PATCH] Apply last example_ynh --- check_process | 3 ++- conf/nginx.conf | 7 ++--- manifest.json | 2 +- scripts/backup | 21 +-------------- scripts/install | 68 ------------------------------------------------- scripts/remove | 18 +------------ scripts/upgrade | 16 +----------- 7 files changed, 10 insertions(+), 125 deletions(-) diff --git a/check_process b/check_process index 215b1f5..65e2544 100644 --- a/check_process +++ b/check_process @@ -15,11 +15,12 @@ setup_private=1 setup_public=1 upgrade=1 + upgrade=1 from_commit=d39e8118603e1cc7e00d1c414ad9b55da68bfc7a backup_restore=1 multi_instance=1 incorrect_path=1 port_already_use=0 - change_url=0 + change_url=1 ;;; Levels Level 1=auto Level 2=auto diff --git a/conf/nginx.conf b/conf/nginx.conf index a0af4cb..4a3f39b 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -8,9 +8,10 @@ location __PATH__/ { if ($scheme = http) { rewrite ^ https://$server_name$request_uri? permanent; } - proxy_pass http://127.0.0.1:__PORT__/; - proxy_set_header Host $host; - proxy_buffering off; + + proxy_pass http://127.0.0.1:__PORT__/; + proxy_set_header Host $host; + proxy_buffering off; # Include SSOWAT user panel. include conf.d/yunohost_panel.conf.inc; diff --git a/manifest.json b/manifest.json index 026d297..bc8a7f7 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Distributed pastebin with ActivityPub.", "fr": "Pastebin distribué utilisant le protocole ActivityPub." }, - "version": "1.0~ynh4", + "version": "1.0~ynh5", "url": "https://example.com", "license": "Apache-2.0", "maintainer": { diff --git a/scripts/backup b/scripts/backup index 394d696..38060aa 100644 --- a/scripts/backup +++ b/scripts/backup @@ -6,6 +6,7 @@ # IMPORT GENERIC HELPERS #================================================= +#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh source ../settings/scripts/ynh_systemd_action source /usr/share/yunohost/helpers @@ -48,20 +49,6 @@ ynh_print_info "Backing up nginx web server configuration..." ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# BACKUP THE PHP-FPM CONFIGURATION -#================================================= -ynh_print_info "Backing up php-fpm configuration..." - -#ynh_backup "/etc/php/7.0/fpm/pool.d/$app.conf" - -#================================================= -# BACKUP THE MYSQL DATABASE -#================================================= -ynh_print_info "Backing up the PostgreSQL database..." - -#ynh_mysql_dump_db "$db_name" > db.sql - #================================================= # SPECIFIC BACKUP #================================================= @@ -78,12 +65,6 @@ ynh_print_info "Backing up systemd configuration..." ynh_backup "/etc/systemd/system/$app.service" -#================================================= -# BACKUP A CRON FILE -#================================================= - -#ynh_backup "/etc/cron.d/$app" - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/install b/scripts/install index 5516dbc..4b0fa5f 100644 --- a/scripts/install +++ b/scripts/install @@ -104,24 +104,6 @@ ynh_print_info "Installing dependencies ..." ynh_install_app_dependencies ca-certificates ynh_install_nodejs 8 -#================================================= -# CREATE A MYSQL DATABASE -#================================================= -ynh_print_info "Creating a mysql database ..." - -### Use these lines if you need a database for the application. -### `ynh_mysql_setup_db` will create a database, an associated user and a ramdom password. -### The password will be stored as 'mysqlpwd' into the app settings, -### and will be available as $db_pwd -### If you're not using these lines: -### - Remove the section "BACKUP THE MYSQL DATABASE" in the backup script -### - Remove also the section "REMOVE THE MYSQL DATABASE" in the remove script -### - As well as the section "RESTORE THE MYSQL DATABASE" in the restore script - -#db_name=$(ynh_sanitize_dbid $app) -#ynh_app_setting_set $app db_name $db_name -#ynh_mysql_setup_db $db_name $db_name - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -154,25 +136,6 @@ ynh_print_info "Configuring system user ..." # Create a system user ynh_system_user_create "$app" "$final_path" -#================================================= -# PHP-FPM CONFIGURATION -#================================================= -ynh_print_info "Configuring php-fpm ..." - -### `ynh_add_fpm_config` is used to set up a PHP config. -### You can remove it if your app doesn't use PHP. -### `ynh_add_fpm_config` will use the files conf/php-fpm.conf and conf/php-fpm.ini -### If you're not using these lines: -### - You can remove these files in conf/. -### - Remove the section "BACKUP THE PHP-FPM CONFIGURATION" in the backup script -### - Remove also the section "REMOVE PHP-FPM CONFIGURATION" in the remove script -### - As well as the section "RESTORE THE PHP-FPM CONFIGURATION" in the restore script -### With the reload at the end of the script. -### - And the section "PHP-FPM CONFIGURATION" in the upgrade script - -# Create a dedicated php-fpm config -#ynh_add_fpm_config - #================================================= # SPECIFIC SETUP #================================================= @@ -224,37 +187,6 @@ ynh_print_info "Configuring a systemd service ..." # Create a dedicated systemd config ynh_add_systemd_config -#================================================= -# SETUP APPLICATION WITH CURL -#================================================= - -### Use these lines only if the app installation needs to be finalized through -### web forms. We generally don't want to ask the final user, -### so we're going to use curl to automatically fill the fields and submit the -### forms. - -# Set right permissions for curl install -#chown -R $app: $final_path - -# Set the app as temporarily public for curl call -#ynh_print_info "Configuring ssowat ..." -#ynh_app_setting_set $app skipped_uris "/" -# Reload SSOwat config -#yunohost app ssowatconf - -# Reload Nginx -#systemctl reload nginx - -# Installation with curl -#ynh_print_info "Finalizing install ..." -#ynh_local_curl "/INSTALL_PATH" "key1=value1" "key2=value2" "key3=value3" - -# Remove the public access -#if [ $is_public -eq 0 ] -#then -# ynh_app_setting_delete $app skipped_uris -#fi - #================================================= # MODIFY A CONFIG FILE #================================================= diff --git a/scripts/remove b/scripts/remove index 3300beb..a04366e 100644 --- a/scripts/remove +++ b/scripts/remove @@ -29,7 +29,7 @@ final_path=$(ynh_app_setting_get $app final_path) #================================================= # Remove a service from the admin panel, added by `yunohost service add` -if yunohost service status | grep -q $app +if yunohost service status $app >/dev/null 2>&1 then ynh_print_info "Removing $app service" yunohost service remove $app @@ -43,14 +43,6 @@ ynh_print_info "Stopping and removing the systemd service" # Remove the dedicated systemd config ynh_remove_systemd_config -#================================================= -# REMOVE THE MYSQL DATABASE -#================================================= -ynh_print_info "Removing the PostgreSQL database" - -# Remove a database if it exists, along with the associated user -#ynh_mysql_remove_db $db_name $db_name - #================================================= # REMOVE DEPENDENCIES #================================================= @@ -76,14 +68,6 @@ ynh_print_info "Removing nginx web server configuration" # Remove the dedicated nginx config ynh_remove_nginx_config -#================================================= -# REMOVE PHP-FPM CONFIGURATION -#================================================= -ynh_print_info "Removing php-fpm configuration" - -# Remove the dedicated php-fpm config -#ynh_remove_fpm_config - #================================================= # REMOVE LOGROTATE CONFIGURATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index b3d0197..a1ee209 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -40,12 +40,6 @@ elif [ "$is_public" = "No" ]; then is_public=0 fi -# If db_name doesn't exist, create it -#if [ -z $db_name ]; then -# db_name=$(ynh_sanitize_dbid $app) -# ynh_app_setting_set $app db_name $db_name -#fi - # If final_path doesn't exist, create it if [ -z $final_path ]; then final_path=/var/www/$app @@ -119,18 +113,10 @@ ynh_print_info "Making sure dedicated system user exists..." # Create a dedicated user (if not existing) ynh_system_user_create "$app" "$final_path" -#================================================= -# PHP-FPM CONFIGURATION -#================================================= -ynh_print_info "Upgrading php-fpm configuration..." - -# Create a dedicated php-fpm config -#ynh_add_fpm_config - #================================================= # SPECIFIC UPGRADE #================================================= -# CREATE DB FOLDER +# CREATE STORAGE FOLDER #================================================= DIRECTORY="$final_path/db"