diff --git a/check_process b/check_process index 037e415..215ffde 100644 --- a/check_process +++ b/check_process @@ -15,6 +15,7 @@ setup_private=1 setup_public=1 upgrade=1 + upgrade=1 from_commit=d39e8118603e1cc7e00d1c414ad9b55da68bfc7a backup_restore=1 multi_instance=1 incorrect_path=1 @@ -35,5 +36,5 @@ Level 9=0 Level 10=0 ;;; Options -Email= -Notification=none +Email=yalh@yahoo.com +Notification=all diff --git a/conf/nginx.conf b/conf/nginx.conf index a0af4cb..7cf6397 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,16 +1,14 @@ #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; location __PATH__/ { - # Path to source - alias __FINALPATH__/ ; - # Force usage of https 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 d24337c..cebbbab 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~ynh6", "url": "https://example.com", "license": "Apache-2.0", "maintainer": { diff --git a/pull_request_template.md b/pull_request_template.md new file mode 100644 index 0000000..14221c0 --- /dev/null +++ b/pull_request_template.md @@ -0,0 +1,23 @@ +## Problem +- *Description of why you made this PR* + +## Solution +- *And how do you fix that problem* + +## PR Status +- [ ] Code finished. +- [ ] Tested with Package_check. +- [ ] Fix or enhancement tested. +- [ ] Upgrade from last version tested. +- [ ] Can be reviewed and tested. + +## Validation +--- +- [ ] **Code review** +- [ ] **Approval (LGTM)** +*Code review and approval have to be from a member of @YunoHost/apps group* +- **CI succeeded** : +[![Build Status](https://ci-apps-hq.yunohost.org/jenkins/job/distbin_ynh%20-BRANCH-/badge/icon)](https://ci-apps-hq.yunohost.org/jenkins/job/distbin_ynh%20-BRANCH-/) +*Please replace '-BRANCH-' in this link by the name of the branch used.* +*If the PR is from a forked repository. Please provide public results from package_check.* +When the PR is marked as ready to merge, you have to wait for 3 days before really merging it. diff --git a/scripts/_common.sh b/scripts/_common.sh index b905339..035ba43 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -1,5 +1,12 @@ #!/bin/bash +#================================================= +# COMMON VARIABLES +#================================================= + +# dependencies used by the app +pkg_dependencies="ca-certificates" + #================================================= # PERSONAL HELPERS #================================================= 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 bfacf8c..ef466a1 100644 --- a/scripts/install +++ b/scripts/install @@ -101,27 +101,9 @@ ynh_print_info "Installing dependencies ..." ### - As well as the section "REINSTALL DEPENDENCIES" in the restore script ### - And the section "UPGRADE DEPENDENCIES" in the upgrade script -ynh_install_app_dependencies ca-certificates +ynh_install_app_dependencies $pkg_dependencies 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/restore b/scripts/restore index 2fb865b..e3e21d9 100644 --- a/scripts/restore +++ b/scripts/restore @@ -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 @@ -73,35 +74,24 @@ ynh_system_user_create "$app" "$final_path" # Restore permissions on app files chown -R "$app":"$app" "$final_path" -mkdir -p /var/log/$app -chown -R $app:$app /var/log/$app - -#================================================= -# RESTORE THE PHP-FPM CONFIGURATION -#================================================= - -#ynh_restore_file "/etc/php/7.0/fpm/pool.d/$app.conf" - #================================================= # SPECIFIC RESTORATION +#================================================= +# CREATE LOG FOLDER +#================================================= + +mkdir -p "/var/log/$app" +chown -R "$app":"$app" "/var/log/$app" + #================================================= # REINSTALL DEPENDENCIES #================================================= ynh_print_info "Reinstalling dependencies..." # Define and install dependencies -ynh_install_app_dependencies ca-certificates +ynh_install_app_dependencies $pkg_dependencies ynh_install_nodejs 8 -#================================================= -# RESTORE THE MYSQL DATABASE -#================================================= -ynh_print_info "Restoring the PostgreSQL database..." - -#db_pwd=$(ynh_app_setting_get $app mysqlpwd) -#ynh_mysql_setup_db $db_name $db_name $db_pwd -#ynh_mysql_connect_as $db_name $db_pwd $db_name < ./db.sql - #================================================= # RESTORE SYSTEMD #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index b3d0197..b5a2756 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 @@ -90,10 +84,9 @@ ynh_print_info "Upgrading source files..." # Download, check integrity, uncompress and patch the source from app.src# #ynh_setup_source "$final_path" -pushd $final_path - git reset --hard - git pull --quiet -popd +git clone --quiet https://github.com/gobengo/distbin "$final_path/upgrade" +cp -a "$final_path/upgrade/." "$final_path/." +rm -r "$final_path/upgrade" #================================================= # NGINX CONFIGURATION @@ -108,7 +101,7 @@ ynh_add_nginx_config #================================================= ynh_print_info "Upgrading dependencies..." -ynh_install_app_dependencies ca-certificates +ynh_install_app_dependencies $pkg_dependencies ynh_install_nodejs 8 #================================================= @@ -119,18 +112,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" @@ -201,8 +186,12 @@ ynh_add_systemd_config #chown -R root: $final_path chown -R $app:$app $final_path -mkdir -p /var/log/$app -chown -R $app:$app /var/log/$app +#================================================= +# CREATE LOG FOLDER +#================================================= + +mkdir -p "/var/log/$app" +chown -R "$app":"$app" "/var/log/$app" #================================================= # SETUP SSOWAT