From 3589a2d079a384dc2bf1830419c6d1cde0ebacf6 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 18 Jul 2020 20:31:39 +0200 Subject: [PATCH 01/19] fix --- README.md | 2 +- conf/app.src | 6 ++ conf/nginx.conf | 4 +- conf/php-fpm.conf | 2 +- scripts/{_common => _common.sh} | 29 ++++++- scripts/install | 140 +++++++++++++++++++++++--------- 6 files changed, 136 insertions(+), 47 deletions(-) create mode 100644 conf/app.src rename scripts/{_common => _common.sh} (94%) diff --git a/README.md b/README.md index cf35b2b..dd7db00 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# minchat_ynh : minchat for Yunohost +# MinChat for YunoHost [![Integration level](https://dash.yunohost.org/integration/minchat.svg)](https://dash.yunohost.org/appci/app/minchat) ![](https://ci-apps.yunohost.org/ci/badges/minchat.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/minchat.maintain.svg) diff --git a/conf/app.src b/conf/app.src new file mode 100644 index 0000000..947619c --- /dev/null +++ b/conf/app.src @@ -0,0 +1,6 @@ +SOURCE_URL=https://github.com/wojtek77/chat/archive/master.tar.gz +SOURCE_SUM=50e66895cbbda095e02a8a7375ca51c0eb589956f68a223a8217d0f4c1fe1fa6 +SOURCE_SUM_PRG=sha256sum +SOURCE_FORMAT=tar.gz +SOURCE_IN_SUBDIR=true +SOURCE_FILENAME= \ No newline at end of file diff --git a/conf/nginx.conf b/conf/nginx.conf index 998914e..e3a589f 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,4 +1,4 @@ -location __PATH__ { +location __PATH__/ { alias __FINALPATH__/; @@ -6,7 +6,7 @@ location __PATH__ { try_files $uri $uri/ index.php; location ~ [^/]\.php(/|$) { fastcgi_split_path_info ^(.+?\.php)(/.*)$; - fastcgi_pass unix:/var/run/php5-fpm-__NAME__.sock; + fastcgi_pass unix:/var/run/php7-fpm-__NAME__.sock; fastcgi_index index.php; include fastcgi_params; fastcgi_param REMOTE_USER $remote_user; diff --git a/conf/php-fpm.conf b/conf/php-fpm.conf index 7bad39e..b278147 100644 --- a/conf/php-fpm.conf +++ b/conf/php-fpm.conf @@ -30,7 +30,7 @@ group = __USER__ ; specific port; ; '/path/to/unix/socket' - to listen on a unix socket. ; Note: This value is mandatory. -listen = /var/run/php5-fpm-__NAMETOCHANGE__.sock +listen = /var/run/php7-fpm-__NAMETOCHANGE__.sock ; Set listen(2) backlog. ; Default Value: 128 (-1 on FreeBSD and OpenBSD) diff --git a/scripts/_common b/scripts/_common.sh similarity index 94% rename from scripts/_common rename to scripts/_common.sh index 437774e..35f580d 100644 --- a/scripts/_common +++ b/scripts/_common.sh @@ -1,6 +1,29 @@ -MINCHAT_VERSION="1.1" -MINCHAT_SOURCE_URL="https://github.com/wojtek77/chat/archive/master.tar.gz" -MINCHAT_SOURCE_SHA256="50e66895cbbda095e02a8a7375ca51c0eb589956f68a223a8217d0f4c1fe1fa6" +#!/bin/bash + +#================================================= +# COMMON VARIABLES +#================================================= + +# dependencies used by the app +pkg_dependencies="deb1 deb2 php$YNH_DEFAULT_PHP_VERSION-deb1 php$YNH_DEFAULT_PHP_VERSION-deb2" + +YNH_PHP_VERSION="7.3" + +#================================================= +# PERSONAL HELPERS +#================================================= + +#================================================= +# EXPERIMENTAL HELPERS +#================================================= + +#================================================= +# FUTURE OFFICIAL HELPERS +#================================================= + + + + QUIET () { # Redirige la sortie standard dans /dev/null $@ > /dev/null diff --git a/scripts/install b/scripts/install index 86ceb6f..7891e59 100644 --- a/scripts/install +++ b/scripts/install @@ -1,62 +1,122 @@ #!/bin/bash -# Exit on command errors and treat unset variables as an error -set -eu +#================================================= +# GENERIC START +#================================================= +# IMPORT GENERIC HELPERS +#================================================= -# Source app helpers -source ./_common +source _common.sh source /usr/share/yunohost/helpers -# Retrieve arguments +#================================================= +# MANAGE SCRIPT FAILURE +#================================================= + +ynh_clean_setup () { + ### Remove this function if there's nothing to clean before calling the remove script. + true +} +# Exit if an error occurs during the execution of the script +ynh_abort_if_errors + +#================================================= +# RETRIEVE ARGUMENTS FROM THE MANIFEST +#================================================= + domain=$YNH_APP_ARG_DOMAIN -path=$(ynh_normalize_url_path $YNH_APP_ARG_PATH) +path_url=$YNH_APP_ARG_PATH is_public=$YNH_APP_ARG_IS_PUBLIC app=$YNH_APP_INSTANCE_NAME -CHECK_VAR "$app" "app name not set" +#================================================= +# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS +#================================================= +ynh_script_progression --message="Validating installation parameters..." --time --weight=1 -CHECK_PATH - -CHECK_DOMAINPATH - -CHECK_FINALPATH - -# Save app settings -ynh_app_setting_set $app domain $domain -ynh_app_setting_set $app path $path -ynh_app_setting_set $app is_public $is_public - -# Create system user dedicace for this app -ynh_system_user_create $app - -# Copy files to the right place +### If the app uses nginx as web server (written in HTML/PHP in most cases), the final path should be "/var/www/$app". +### If the app provides an internal web server (or uses another application server such as uwsgi), the final path should be "/opt/yunohost/$app" final_path=/var/www/$app -sudo mkdir -p $final_path -ynh_app_setting_set $app final_path $final_path +test ! -e "$final_path" || ynh_die --message="This path already contains a folder" -# Get source application -extract_source $final_path +# Register (book) web path +ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url -# Modify Nginx configuration file and copy it to Nginx conf directory -ynh_nginx_config +#================================================= +# STORE SETTINGS FROM MANIFEST +#================================================= +ynh_script_progression --message="Storing installation settings..." --time --weight=1 -# Create the php-fpm pool config -ynh_fpm_config +ynh_app_setting_set --app=$app --key=domain --value=$domain +ynh_app_setting_set --app=$app --key=path --value=$path_url +ynh_app_setting_set --app=$app --key=is_public --value=$is_public -# Change owner -sudo chown $app: -R $final_path +#================================================= +# DOWNLOAD, CHECK AND UNPACK SOURCE +#================================================= +ynh_script_progression --message="Setting up source files..." --time --weight=1 -# Set ssowat config -if [ $is_public -eq 0 ] -then - ynh_app_setting_delete $app skipped_uris # Delete public access -fi +ynh_app_setting_set --app=$app --key=final_path --value=$final_path +# Download, check integrity, uncompress and patch the source from app.src +ynh_setup_source --dest_dir="$final_path" +#================================================= +# NGINX CONFIGURATION +#================================================= +ynh_script_progression --message="Configuring nginx web server..." --time --weight=1 + +### `ynh_add_nginx_config` will use the file conf/nginx.conf + +# Create a dedicated nginx config +ynh_add_nginx_config + +#================================================= +# CREATE DEDICATED USER +#================================================= +ynh_script_progression --message="Configuring system user..." --time --weight=1 + +# Create a system user +ynh_system_user_create --username=$app + +#================================================= +# PHP-FPM CONFIGURATION +#================================================= +ynh_script_progression --message="Configuring php-fpm..." --time --weight=1 + +# Create a dedicated php-fpm config +ynh_add_fpm_config + +#================================================= +# GENERIC FINALIZATION +#================================================= +# SECURE FILES AND DIRECTORIES +#================================================= + +# Set permissions to app files +chown -R $app: $final_path + +#================================================= +# SETUP SSOWAT +#================================================= +ynh_script_progression --message="Configuring SSOwat..." --time --weight=1 + +# Make app public if necessary if [ $is_public -eq 1 ] then - ynh_app_setting_set $app skipped_uris "/" # Make app public if necessary + # unprotected_uris allows SSO credentials to be passed anyway. + ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" fi -sudo systemctl reload nginx -sudo yunohost app ssowatconf \ No newline at end of file +#================================================= +# RELOAD NGINX +#================================================= +ynh_script_progression --message="Reloading nginx web server..." --time --weight=1 + +ynh_systemd_action --service_name=nginx --action=reload + +#================================================= +# END OF SCRIPT +#================================================= + +ynh_script_progression --message="Installation of $app completed" --time --last From 316e04eb0cef288f5327e1898b4ca2f10eef8d77 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 18 Jul 2020 20:47:14 +0200 Subject: [PATCH 02/19] fix --- .gitattributes | 17 --- .gitignore | 43 ------ conf/nginx.conf | 31 +++-- manifest.json | 25 ++-- scripts/_common.sh | 322 +-------------------------------------------- scripts/upgrade | 149 ++++++++++++++------- 6 files changed, 136 insertions(+), 451 deletions(-) delete mode 100644 .gitattributes delete mode 100644 .gitignore diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index bdb0cab..0000000 --- a/.gitattributes +++ /dev/null @@ -1,17 +0,0 @@ -# Auto detect text files and perform LF normalization -* text=auto - -# Custom for Visual Studio -*.cs diff=csharp - -# Standard to msysgit -*.doc diff=astextplain -*.DOC diff=astextplain -*.docx diff=astextplain -*.DOCX diff=astextplain -*.dot diff=astextplain -*.DOT diff=astextplain -*.pdf diff=astextplain -*.PDF diff=astextplain -*.rtf diff=astextplain -*.RTF diff=astextplain diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 96374c4..0000000 --- a/.gitignore +++ /dev/null @@ -1,43 +0,0 @@ -# Windows image file caches -Thumbs.db -ehthumbs.db - -# Folder config file -Desktop.ini - -# Recycle Bin used on file shares -$RECYCLE.BIN/ - -# Windows Installer files -*.cab -*.msi -*.msm -*.msp - -# Windows shortcuts -*.lnk - -# ========================= -# Operating System Files -# ========================= - -# OSX -# ========================= - -.DS_Store -.AppleDouble -.LSOverride - -# Thumbnails -._* - -# Files that might appear on external disk -.Spotlight-V100 -.Trashes - -# Directories potentially created on remote AFP share -.AppleDB -.AppleDesktop -Network Trash Folder -Temporary Items -.apdisk diff --git a/conf/nginx.conf b/conf/nginx.conf index e3a589f..d3513a7 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,23 +1,32 @@ +#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; location __PATH__/ { - alias __FINALPATH__/; + # Path to source + alias __FINALPATH__/ ; + + # Force usage of https + if ($scheme = http) { + rewrite ^ https://$server_name$request_uri? permanent; + } + + index index.php; + + # Common parameter to increase upload size limit in conjunction with dedicated php-fpm file + #client_max_body_size 50M; - index index.html index.php ; try_files $uri $uri/ index.php; location ~ [^/]\.php(/|$) { fastcgi_split_path_info ^(.+?\.php)(/.*)$; - fastcgi_pass unix:/var/run/php7-fpm-__NAME__.sock; + fastcgi_pass unix:/var/run/php/php7.0-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 REMOTE_USER $remote_user; + fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param SCRIPT_FILENAME $request_filename; } - # Do not include SSOWAT user panel. - # include conf.d/yunohost_panel.conf.inc; - - location ~ /(conf|history)(/|$) { - deny all; - } + # Include SSOWAT user panel. + include conf.d/yunohost_panel.conf.inc; } + diff --git a/manifest.json b/manifest.json index 79979ff..00bf72f 100644 --- a/manifest.json +++ b/manifest.json @@ -1,23 +1,24 @@ { "name": "Minchat", "id": "minchat", + "packaging_format": 1, "description": { "en": "A minimalist web chat", "fr": "Un web chat minimaliste" }, - "packaging_format": 1, - "requirements": { - "yunohost": ">> 2.3.15" - }, + "version": "1.0~ynh1", + "url": "https://github.com/wojtek77/chat", "license": "MIT", "maintainer": { "name": "chtixof" }, - "url": "https://github.com/wojtek77/chat", + "requirements": { + "yunohost": ">> 3.8.1" + }, "multi_instance": true, "services": [ "nginx", - "php5-fpm" + "php7.0-fpm" ], "license": "MIT", "arguments": { @@ -26,8 +27,8 @@ "name": "domain", "type": "domain", "ask": { - "en": "Choose a domain for minchat", - "fr": "Choisissez un domaine pour minchat" + "en": "Choose a domain for Minchat", + "fr": "Choisissez un domaine pour Minchat" }, "example": "domain.org" }, @@ -35,8 +36,8 @@ "name": "path", "type": "path", "ask": { - "en": "Choose a path for minchat", - "fr": "Choisissez un chemin pour minchat" + "en": "Choose a path for Minchat", + "fr": "Choisissez un chemin pour Minchat" }, "example": "/minchat", "default": "/minchat" @@ -45,10 +46,10 @@ "name": "is_public", "type": "boolean", "ask": { - "en": "Is it a public minchat site ?", + "en": "Is it a public site?", "fr": "Est-ce un site public ?" }, - "default": "true" + "default": true } ] } diff --git a/scripts/_common.sh b/scripts/_common.sh index 35f580d..b0cbf30 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,9 +5,9 @@ #================================================= # dependencies used by the app -pkg_dependencies="deb1 deb2 php$YNH_DEFAULT_PHP_VERSION-deb1 php$YNH_DEFAULT_PHP_VERSION-deb2" +#pkg_dependencies="" -YNH_PHP_VERSION="7.3" +#YNH_PHP_VERSION="7.3" #================================================= # PERSONAL HELPERS @@ -20,321 +20,3 @@ YNH_PHP_VERSION="7.3" #================================================= # FUTURE OFFICIAL HELPERS #================================================= - - - - - -QUIET () { # Redirige la sortie standard dans /dev/null - $@ > /dev/null -} - -ALL_QUIET () { # Redirige la sortie standard et d'erreur dans /dev/null - $@ > /dev/null 2>&1 -} - -CHECK_VAR () { # Check variable is not empty -# $1 = Checking variable -# $2 = Text to display on error - test -n "$1" || (echo "$2" >&2 && false) -} - -CHECK_PATH () { # Checks / at the beginning of the path. And his absence at the end. - if [ "${path:0:1}" != "/" ]; then # If the first character is not / - path="/$path" # Add / at the beginning of path - fi - if [ "${path:${#path}-1}" == "/" ] && [ ${#path} -gt 1 ]; then # If the last character is a / and it is not the only character. - path="${path:0:${#path}-1}" # Delete last character - fi -} - -CHECK_DOMAINPATH () { # Checks the availability of the path and domain. - sudo yunohost app checkurl $domain$path -a $app -} - -CHECK_FINALPATH () { # Checks that the destination folder is not already in use. - final_path=/var/www/$app - if [ -e "$final_path" ] - then - echo "This path already contains a folder" >&2 - false - fi -} - -# Substitute a string by another in a file -# -# usage: ynh_substitute_char string_to_find replace_string file_to_analyse -# | arg: string_to_find - String to replace in the file -# | arg: replace_string - New string that will replace -# | arg: file_to_analyse - File where the string will be replaced. -ynh_substitute_char () { - delimit=@ - match_char=${1//${delimit}/"\\${delimit}"} # Escape the delimiter if it's in the string. - replace_char=${2//${delimit}/"\\${delimit}"} - workfile=$3 - - sudo sed --in-place "s${delimit}${match_char}${delimit}${replace_char}${delimit}g" "$workfile" -} - -ynh_store_checksum_config () { - config_file_checksum=checksum_${1//[\/ ]/_} # Replace all '/' and ' ' by '_' - ynh_app_setting_set $app $config_file_checksum $(sudo md5sum "$1" | cut -d' ' -f1) -} - -extract_source() { - local DESTDIR=$1 - - # retrieve and extract Minichat tarball - rc_tarball="${DESTDIR}/master.tar.gz" - sudo wget -q -O "$rc_tarball" "$MINCHAT_SOURCE_URL" \ - || ynh_die "Unable to download source tarball" - echo "$MINCHAT_SOURCE_SHA256 $rc_tarball" | sha256sum -c >/dev/null \ - || ynh_die "Invalid checksum of downloaded tarball" - sudo tar xf "$rc_tarball" -C "$DESTDIR" --strip-components 1 \ - || ynh_die "Unable to extract source tarball" - sudo rm "$rc_tarball" -} - -ynh_nginx_config () { - finalnginxconf="/etc/nginx/conf.d/$domain.d/$app.conf" - ynh_compare_checksum_config "$finalnginxconf" 1 - sudo cp ../conf/nginx.conf "$finalnginxconf" - - # To avoid a break by set -u, use a void substitution ${var:-}. If the variable is not set, it's simply set with an empty variable. - # Substitute in a nginx config file only if the variable is not empty - if test -n "${path:-}"; then - ynh_substitute_char "__PATH__" "$path" "$finalnginxconf" - fi - if test -n "${domain:-}"; then - ynh_substitute_char "__DOMAIN__" "$domain" "$finalnginxconf" - fi - if test -n "${port:-}"; then - ynh_substitute_char "__PORT__" "$port" "$finalnginxconf" - fi - if test -n "${app:-}"; then - ynh_substitute_char "__NAME__" "$app" "$finalnginxconf" - fi - if test -n "${final_path:-}"; then - ynh_substitute_char "__FINALPATH__" "$final_path" "$finalnginxconf" - fi - ynh_store_checksum_config "$finalnginxconf" - - sudo systemctl reload nginx -} - -ynh_store_checksum_config () { - config_file_checksum=checksum_${1//[\/ ]/_} # Replace all '/' and ' ' by '_' - ynh_app_setting_set $app $config_file_checksum $(sudo md5sum "$1" | cut -d' ' -f1) -} - -ynh_remove_nginx_config () { - ynh_secure_remove "/etc/nginx/conf.d/$domain.d/$app.conf" - sudo systemctl reload nginx -} - -ynh_fpm_config () { - finalphpconf="/etc/php5/fpm/pool.d/$app.conf" - ynh_compare_checksum_config "$finalphpconf" 1 - sudo cp ../conf/php-fpm.conf "$finalphpconf" - ynh_substitute_char "__NAMETOCHANGE__" "$app" "$finalphpconf" - ynh_substitute_char "__FINALPATH__" "$final_path" "$finalphpconf" - ynh_substitute_char "__USER__" "$app" "$finalphpconf" - sudo chown root: "$finalphpconf" - ynh_store_checksum_config "$finalphpconf" - - if [ -e "../conf/php-fpm.ini" ] - then - finalphpini="/etc/php5/fpm/conf.d/20-$app.ini" - ynh_compare_checksum_config "$finalphpini" 1 - sudo cp ../conf/php-fpm.ini "$finalphpini" - sudo chown root: "$finalphpini" - ynh_store_checksum_config "$finalphpini" - fi - - sudo systemctl reload php5-fpm -} - -ynh_remove_fpm_config () { - ynh_secure_remove "/etc/php5/fpm/pool.d/$app.conf" - ynh_secure_remove "/etc/php5/fpm/conf.d/20-$app.ini" - sudo systemctl reload php5-fpm -} - -# Remove a file or a directory securely -# -# usage: ynh_secure_remove path_to_remove -# | arg: path_to_remove - File or directory to remove -ynh_secure_remove () { - path_to_remove=$1 - forbidden_path=" \ - /var/www \ - /home/yunohost.app" - - if [[ "$forbidden_path" =~ "$path_to_remove" \ - # Match all path or subpath in $forbidden_path - || "$path_to_remove" =~ ^/[[:alnum:]]+$ \ - # Match all first level path from / (Like /var, /root, etc...) - || "${path_to_remove:${#path_to_remove}-1}" = "/" ]] - # Match if the path finish by /. Because it's seems there is an empty variable - then - echo "Avoid deleting of $path_to_remove." >&2 - else - if [ -e "$path_to_remove" ] - then - sudo rm -R "$path_to_remove" - else - echo "$path_to_remove doesn't deleted because it's not exist." >&2 - fi - fi -} - -# Create a system user -# -# usage: ynh_system_user_create user_name [home_dir] -# | arg: user_name - Name of the system user that will be create -# | arg: home_dir - Path of the home dir for the user. Usually the final path of the app. If this argument is omitted, the user will be created without home -ynh_system_user_create () { - if ! ynh_system_user_exists "$1" # Check if the user exists on the system - then # If the user doesn't exist - if [ $# -ge 2 ]; then # If a home dir is mentioned - user_home_dir="-d $2" - else - user_home_dir="--no-create-home" - fi - sudo useradd $user_home_dir --system --user-group $1 --shell /usr/sbin/nologin || ynh_die "Unable to create $1 system account" - fi -} - -# Delete a system user -# -# usage: ynh_system_user_delete user_name -# | arg: user_name - Name of the system user that will be create -ynh_system_user_delete () { - if ynh_system_user_exists "$1" # Check if the user exists on the system - then - echo "Remove the user $1" >&2 - sudo userdel $1 - else - echo "The user $1 was not found" >&2 - fi -} - -ynh_compare_checksum_config () { - current_config_file=$1 - compress_backup=${2:-0} # If $2 is empty, compress_backup will set at 0 - config_file_checksum=checksum_${current_config_file//[\/ ]/_} # Replace all '/' and ' ' by '_' - checksum_value=$(ynh_app_setting_get $app $config_file_checksum) - if [ -n "$checksum_value" ] - then # Proceed only if a value was stocked into the app config - if ! echo "$checksum_value $current_config_file" | md5sum -c --status - then # If the checksum is now different - backup_config_file="$current_config_file.backup.$(date '+%d.%m.%y_%Hh%M,%Ss')" - if [ compress_backup -eq 1 ] - then - sudo tar --create --gzip --file "$backup_config_file.tar.gz" "$current_config_file" # Backup the current config file and compress - backup_config_file="$backup_config_file.tar.gz" - else - sudo cp -a "$current_config_file" "$backup_config_file" # Backup the current config file - fi - echo "Config file $current_config_file has been manually modified since the installation or last upgrade. So it has been duplicated in $backup_config_file" >&2 - echo "$backup_config_file" # Return the name of the backup file - fi - fi -} - -ynh_backup_fail_upgrade () { - WARNING echo "Upgrade failed." - app_bck=${app//_/-} # Replace all '_' by '-' - if sudo yunohost backup list | grep -q $app_bck-pre-upgrade$backup_number; then # Vérifie l'existence de l'archive avant de supprimer l'application et de restaurer - sudo yunohost app remove $app # Supprime l'application avant de la restaurer. - sudo yunohost backup restore --ignore-hooks $app_bck-pre-upgrade$backup_number --apps $app --force # Restore the backup if upgrade failed - ynh_die "The app was restored to the way it was before the failed upgrade." - fi -} - -ynh_backup_before_upgrade () { # Backup the current version of the app, restore it if the upgrade fails - backup_number=1 - old_backup_number=2 - app_bck=${app//_/-} # Replace all '_' by '-' - if sudo yunohost backup list | grep -q $app_bck-pre-upgrade1; then # Vérifie l'existence d'une archive déjà numéroté à 1. - backup_number=2 # Et passe le numéro de l'archive à 2 - old_backup_number=1 - fi - - sudo yunohost backup create --ignore-hooks --apps $app --name $app_bck-pre-upgrade$backup_number # Créer un backup différent de celui existant. - if [ "$?" -eq 0 ]; then # Si le backup est un succès, supprime l'archive précédente. - if sudo yunohost backup list | grep -q $app_bck-pre-upgrade$old_backup_number; then # Vérifie l'existence de l'ancienne archive avant de la supprimer, pour éviter une erreur. - QUIET sudo yunohost backup delete $app_bck-pre-upgrade$old_backup_number - fi - else # Si le backup a échoué - ynh_die "Backup failed, the upgrade process was aborted." - fi -} - -# Manage a fail of the script -# -# Print a warning to inform that the script was failed -# Execute the ynh_clean_setup function if used in the app script -# -# usage of ynh_clean_setup function -# This function provide a way to clean some residual of installation that not managed by remove script. -# To use it, simply add in your script: -# ynh_clean_setup () { -# instructions... -# } -# This function is optionnal. -# -# Usage: ynh_exit_properly is used only by the helper ynh_check_error. -# You must not use it directly. -ynh_exit_properly () { - exit_code=$? - if [ "$exit_code" -eq 0 ]; then - ynh_die # Exit without error if the script ended correctly - fi - - trap '' EXIT # Ignore new exit signals - set +eu # Do not exit anymore if a command fail or if a variable is empty - - echo -e "!!\n $app's script has encountered an error. Its execution was cancelled.\n!!" >&2 - - if type -t ynh_clean_setup > /dev/null; then # Check if the function exist in the app script. - ynh_clean_setup # Call the function to do specific cleaning for the app. - fi - - ynh_die # Exit with error status -} - -# Exit if an error occurs during the execution of the script. -# -# Stop immediatly the execution if an error occured or if a empty variable is used. -# The execution of the script is derivate to ynh_exit_properly function before exit. -# -# Usage: ynh_abort_if_errors -ynh_abort_if_errors () { - set -eu # Exit if a command fail, and if a variable is used unset. - trap ynh_exit_properly EXIT # Capturing exit signals on shell script -} - -# Normalize the url path syntax -# Handle the slash at the beginning of path and its absence at ending -# Return a normalized url path -# -# example: url_path=$(ynh_normalize_url_path $url_path) -# ynh_normalize_url_path example -> /example -# ynh_normalize_url_path /example -> /example -# ynh_normalize_url_path /example/ -> /example -# ynh_normalize_url_path / -> / -# -# usage: ynh_normalize_url_path path_to_normalize -# | arg: url_path_to_normalize - URL path to normalize before using it -ynh_normalize_url_path () { - path_url=$1 - test -n "$path_url" || ynh_die "ynh_normalize_url_path expect a URL path as first argument and received nothing." - if [ "${path_url:0:1}" != "/" ]; then # If the first character is not a / - path_url="/$path_url" # Add / at begin of path variable - fi - if [ "${path_url:${#path_url}-1}" == "/" ] && [ ${#path_url} -gt 1 ]; then # If the last character is a / and that not the only character. - path_url="${path_url:0:${#path_url}-1}" # Delete the last character - fi - echo $path_url -} \ No newline at end of file diff --git a/scripts/upgrade b/scripts/upgrade index 1f35f5e..0e484d0 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -1,64 +1,117 @@ #!/bin/bash -# Exit on command errors and treat unset variables as an error -set -eu +#================================================= +# GENERIC START +#================================================= +# IMPORT GENERIC HELPERS +#================================================= -if [ ! -e _common ]; then - # Get file fonction if not been to the current directory - sudo cp ../settings/scripts/_common ./_common - sudo chmod a+rx _common -fi -# Source app helpers -source ./_common +source _common.sh source /usr/share/yunohost/helpers +#================================================= +# LOAD SETTINGS +#================================================= +ynh_script_progression --message="Loading installation settings..." --weight=1 + app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get "$app" domain) -path=$(ynh_app_setting_get "$app" path) -is_public=$(ynh_app_setting_get $app is_public) +domain=$(ynh_app_setting_get --app=$app --key=domain) +path_url=$(ynh_app_setting_get --app=$app --key=path) +is_public=$(ynh_app_setting_get --app=$app --key=is_public) +final_path=$(ynh_app_setting_get --app=$app --key=final_path) -ynh_backup_before_upgrade # Backup the current version of the app -ynh_clean_setup () { - ynh_backup_fail_upgrade # restore it if the upgrade fails -} -ynh_abort_if_errors # Active trap pour arrêter le script si une erreur est détectée. +#================================================= +# CHECK VERSION +#================================================= -CHECK_PATH # Checks and corrects the syntax of the path. +upgrade_type=$(ynh_check_app_version_changed) -# Create system user dedicace for this app -ynh_system_user_create $app +#================================================= +# ENSURE DOWNWARD COMPATIBILITY +#================================================= +ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 -# Init final_path, if ever it got deleted somehow -final_path=/var/www/$app - -# Clean all files and directory except the data directory -ynh_secure_remove $final_path - -# Create directory -sudo mkdir -p $final_path - -# Copy files to the right place -extract_source $final_path - -# Fix owner -sudo chown -R $app: $final_path - -# Modify Nginx configuration file and copy it to Nginx conf directory -ynh_nginx_config - -# Create the php-fpm pool config -ynh_fpm_config - -# Set ssowat config +# Fix is_public as a boolean value if [ "$is_public" = "Yes" ]; then - ynh_app_setting_set $app is_public 1 # Fixe is_public en booléen + ynh_app_setting_set --app=$app --key=is_public --value=1 is_public=1 elif [ "$is_public" = "No" ]; then - ynh_app_setting_set $app is_public 0 - is_public=0 + ynh_app_setting_set --app=$app --key=is_public --value=0 + is_public=0 fi -# Reload Nginx -sudo systemctl reload nginx -sudo yunohost app ssowatconf +# 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 +fi + +#================================================= +# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +#================================================= +ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=5 + +# Backup the current version of the app +ynh_backup_before_upgrade +ynh_clean_setup () { + # restore it if the upgrade fails + ynh_restore_upgradebackup +} +# Exit if an error occurs during the execution of the script +ynh_abort_if_errors + +#================================================= +# DOWNLOAD, CHECK AND UNPACK SOURCE +#================================================= + +if [ "$upgrade_type" == "UPGRADE_APP" ] +then + ynh_script_progression --message="Upgrading source files..." --weight=5 + + # Download, check integrity, uncompress and patch the source from app.src + ynh_setup_source --dest_dir="$final_path" +fi + +#================================================= +# NGINX CONFIGURATION +#================================================= +ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1 + +# Create a dedicated nginx config +ynh_add_nginx_config + +#================================================= +# CREATE DEDICATED USER +#================================================= +ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 + +# Create a dedicated user (if not existing) +ynh_system_user_create --username=$app + +#================================================= +# SECURE FILES AND DIRECTORIES +#================================================= + +# Set permissions to app files +chown -R $app $final_path + +#================================================= +# PHP-FPM CONFIGURATION +#================================================= +ynh_script_progression --message="Upgrading PHP-fpm configuration..." --weight=1 + +# Create a dedicated php-fpm config +ynh_add_fpm_config #--package="$extra_php_dependencies" + +#================================================= +# RELOAD NGINX +#================================================= +ynh_script_progression --message="Reloading NGINX web server..." --weight=1 + +ynh_systemd_action --service_name=nginx --action=reload + +#================================================= +# END OF SCRIPT +#================================================= +ynh_script_progression --message="Upgrade of $app completed" --last From 021d770bd7b85b1259119060c31bfbeba55ba9a1 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 18 Jul 2020 20:55:45 +0200 Subject: [PATCH 03/19] fix --- scripts/backup | 69 ++++++++++++++++------ scripts/install | 2 - scripts/remove | 86 ++++++++++++++++++++++------ scripts/restore | 149 ++++++++++++++++++++++++++++-------------------- 4 files changed, 210 insertions(+), 96 deletions(-) diff --git a/scripts/backup b/scripts/backup index f59aff2..e885b2c 100644 --- a/scripts/backup +++ b/scripts/backup @@ -1,26 +1,63 @@ #!/bin/bash -# causes the shell to exit if any subcommand or pipeline returns a non-zero status -set -eu +#================================================= +# GENERIC START +#================================================= +# IMPORT GENERIC HELPERS +#================================================= -# Source YNH helpers +#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts +source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers +#================================================= +# MANAGE SCRIPT FAILURE +#================================================= + +ynh_clean_setup () { + ### Remove this function if there's nothing to clean before calling the remove script. + true +} +# Exit if an error occurs during the execution of the script +ynh_abort_if_errors + +#================================================= +# LOAD SETTINGS +#================================================= +ynh_print_info --message="Loading installation settings..." + app=$YNH_APP_INSTANCE_NAME -# Retrieve arguments -domain=$(ynh_app_setting_get "$app" domain) +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) +#phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) -# Backup directory location for the app from where the script is executed and -# which will be compressed afterward -backup_dir=$YNH_APP_BACKUP_DIR +#================================================= +# DECLARE DATA AND CONF FILES TO BACKUP +#================================================= +ynh_print_info --message="Declaring files to be backed up..." -# Backup sources & data -ynh_backup "/var/www/${app}" "sources" +#================================================= +# BACKUP THE APP MAIN DIR +#================================================= -# Copy Nginx conf -sudo mkdir -p ./conf -ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf" "conf/nginx.conf" -# Copy the php-fpm conf files -ynh_backup "/etc/php5/fpm/pool.d/${app}.conf" "conf/php-fpm.conf" -ynh_backup "/etc/php5/fpm/conf.d/20-${app}.ini" "conf/php-fpm.ini" \ No newline at end of file +ynh_backup --src_path="$final_path" + +#================================================= +# BACKUP THE NGINX CONFIGURATION +#================================================= + +ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" + +#================================================= +# BACKUP THE PHP-FPM CONFIGURATION +#================================================= + +ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" + +#================================================= +# END OF SCRIPT +#================================================= + +ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." diff --git a/scripts/install b/scripts/install index 7891e59..a20af47 100644 --- a/scripts/install +++ b/scripts/install @@ -66,8 +66,6 @@ ynh_setup_source --dest_dir="$final_path" #================================================= ynh_script_progression --message="Configuring nginx web server..." --time --weight=1 -### `ynh_add_nginx_config` will use the file conf/nginx.conf - # Create a dedicated nginx config ynh_add_nginx_config diff --git a/scripts/remove b/scripts/remove index 246bd95..5f82707 100644 --- a/scripts/remove +++ b/scripts/remove @@ -1,27 +1,81 @@ #!/bin/bash -# Exit on command errors and treat unset variables as an error -set -u +#================================================= +# GENERIC START +#================================================= +# IMPORT GENERIC HELPERS +#================================================= -if [ ! -e _common ]; then - # Get file fonction if not been to the current directory - sudo cp ../settings/scripts/_common ./_common - sudo chmod a+rx _common -fi -# Source app helpers -source ./_common +source _common.sh source /usr/share/yunohost/helpers -# Get multi-instances specific variables +#================================================= +# LOAD SETTINGS +#================================================= +ynh_script_progression --message="Loading installation settings..." --time --weight=1 + app=$YNH_APP_INSTANCE_NAME -# Retrieve arguments -domain=$(ynh_app_setting_get "$app" domain) +domain=$(ynh_app_setting_get --app=$app --key=domain) +final_path=$(ynh_app_setting_get --app=$app --key=final_path) -ynh_secure_remove /var/www/$app -ynh_secure_remove /etc/nginx/conf.d/$domain.d/$app.conf +#================================================= +# STANDARD REMOVE +#================================================= +# REMOVE SERVICE INTEGRATION IN YUNOHOST +#================================================= + +# Remove the service from the list of services known by Yunohost (added from `yunohost service add`) +if ynh_exec_warn_less yunohost service status $app >/dev/null +then + ynh_script_progression --message="Removing $app service..." --time --weight=1 + yunohost service remove $app +fi + +#================================================= +# REMOVE DEPENDENCIES +#================================================= +ynh_script_progression --message="Removing dependencies..." --time --weight=1 + +# Remove metapackage and its dependencies +ynh_remove_app_dependencies + +#================================================= +# REMOVE APP MAIN DIR +#================================================= +ynh_script_progression --message="Removing app main directory..." --time --weight=1 + +# Remove the app directory securely +ynh_secure_remove --file="$final_path" + +#================================================= +# REMOVE NGINX CONFIGURATION +#================================================= +ynh_script_progression --message="Removing nginx web server configuration..." --time --weight=1 + +# Remove the dedicated nginx config +ynh_remove_nginx_config + +#================================================= +# REMOVE PHP-FPM CONFIGURATION +#================================================= +ynh_script_progression --message="Removing php-fpm configuration..." --time --weight=1 + +# Remove the dedicated php-fpm config ynh_remove_fpm_config -ynh_system_user_delete $app +#================================================= +# GENERIC FINALIZATION +#================================================= +# REMOVE DEDICATED USER +#================================================= +ynh_script_progression --message="Removing the dedicated system user..." --time --weight=1 -sudo systemctl reload nginx \ No newline at end of file +# Delete a system user +ynh_system_user_delete --username=$app + +#================================================= +# END OF SCRIPT +#================================================= + +ynh_script_progression --message="Removal of $app completed" --time --last diff --git a/scripts/restore b/scripts/restore index f7dcf99..7ffc012 100644 --- a/scripts/restore +++ b/scripts/restore @@ -1,81 +1,106 @@ #!/bin/bash -# causes the shell to exit if any subcommand or pipeline returns a non-zero status -set -eu +#================================================= +# GENERIC START +#================================================= +# IMPORT GENERIC HELPERS +#================================================= -if [ ! -e _common ]; then - # Get file fonction if not been to the current directory - sudo cp ../settings/scripts/_common ./_common - sudo chmod a+rx _common -fi -# Loads the generic functions usually used in the script -source _common -# Source app helpers +#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts +source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers +#================================================= +# MANAGE SCRIPT FAILURE +#================================================= + +ynh_clean_setup () { + #### Remove this function if there's nothing to clean before calling the remove script. + true +} +# Exit if an error occurs during the execution of the script +ynh_abort_if_errors + +#================================================= +# LOAD SETTINGS +#================================================= +ynh_script_progression --message="Loading installation settings..." --time --weight=1 + app=$YNH_APP_INSTANCE_NAME -# Retrieve arguments -domain=$(ynh_app_setting_get "$app" domain) -path=$(ynh_app_setting_get "$app" path) -is_public=$(ynh_app_setting_get $app is_public) +domain=$(ynh_app_setting_get --app=$app --key=domain) +path_url=$(ynh_app_setting_get --app=$app --key=path) +final_path=$(ynh_app_setting_get --app=$app --key=final_path) +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) -# Check domain/path availability -sudo yunohost app checkurl "${domain}${path}" -a "$app" \ - || ynh_die "Path not available: ${domain}${path}" +#================================================= +# CHECK IF THE APP CAN BE RESTORED +#================================================= +ynh_script_progression --message="Validating restoration parameters..." --time --weight=1 -# Check $final_path -final_path="/var/www/${app}" -if [ -d $final_path ]; then - ynh_die "There is already a directory: $final_path" -fi +ynh_webpath_available --domain=$domain --path_url=$path_url \ + || ynh_die --message="Path not available: ${domain}${path_url}" +test ! -d $final_path \ + || ynh_die --message="There is already a directory: $final_path " -# Check configuration files -nginx_conf="/etc/nginx/conf.d/${domain}.d/${app}.conf" -if [ -f $nginx_conf ]; then - ynh_die "The NGINX configuration already exists at '${nginx_conf}'. - You should safely delete it before restoring this app." -fi -# Check configuration files php-fpm -phpfpm_conf="/etc/php5/fpm/pool.d/${app}.conf" -if [ -f $phpfpm_conf ]; then - ynh_die "The PHP FPM configuration already exists at '${phpfpm_conf}'. - You should safely delete it before restoring this app." -fi +#================================================= +# STANDARD RESTORATION STEPS +#================================================= +# RESTORE THE NGINX CONFIGURATION +#================================================= -phpfpm_ini="/etc/php5/fpm/conf.d/20-${app}.ini" -if [ -f $phpfpm_ini ]; then - ynh_die "The PHP FPM INI configuration already exists at '${phpfpm_ini}'. - You should safely delete it before restoring this app." -fi +ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" -# Create system user dedicace for this app -ynh_system_user_create $app +#================================================= +# RESTORE THE APP MAIN DIR +#================================================= +ynh_script_progression --message="Restoring the app main directory..." --time --weight=1 -# Restore sources & data -sudo cp -a "./sources" $final_path +ynh_restore_file --origin_path="$final_path" -# Set permissions -sudo chown -R $app: $final_path +#================================================= +# RECREATE THE DEDICATED USER +#================================================= +ynh_script_progression --message="Recreating the dedicated system user..." --time --weight=1 -# Restore configuration files -sudo cp -a ./conf/nginx.conf "${nginx_conf}" +# Create the dedicated user (if not existing) +ynh_system_user_create --username=$app -# Restore php-fpm configuration files -sudo cp -a ./conf/php-fpm.conf "${phpfpm_conf}" -sudo cp -a ./conf/php-fpm.ini "${phpfpm_ini}" +#================================================= +# RESTORE USER RIGHTS +#================================================= -# Set ssowat config -if [[ $is_public -eq 0 ]]; then - ynh_app_setting_delete $app skipped_uris -fi +# Restore permissions on app files +chown -R root: $final_path -if [ $is_public -eq 1 ] -then - ynh_app_setting_set $app skipped_uris "/" # Make app public if necessary -fi +#================================================= +# RESTORE THE PHP-FPM CONFIGURATION +#================================================= -# Reload service -sudo systemctl reload php5-fpm -sudo systemctl reload nginx -sudo yunohost app ssowatconf \ No newline at end of file +ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" + +#================================================= +# SPECIFIC RESTORATION +#================================================= +# REINSTALL DEPENDENCIES +#================================================= +ynh_script_progression --message="Reinstalling dependencies..." --time --weight=1 + +# Define and install dependencies +#ynh_install_app_dependencies $pkg_dependencies + +#================================================= +# GENERIC FINALIZATION +#================================================= +# RELOAD NGINX AND PHP-FPM +#================================================= +ynh_script_progression --message="Reloading nginx web server and php-fpm..." --time --weight=1 + +ynh_systemd_action --service_name=php$phpversion-fpm --action=reload +ynh_systemd_action --service_name=nginx --action=reload + +#================================================= +# END OF SCRIPT +#================================================= + +ynh_script_progression --message="Restoration completed for $app" --time --last From 9da521a765b0110ac2f8320ec07bb3de4e278dc0 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 18 Jul 2020 21:00:46 +0200 Subject: [PATCH 04/19] fix --- README.md | 2 +- manifest.json | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index dd7db00..68a9857 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# MinChat for YunoHost +# Minchat for YunoHost [![Integration level](https://dash.yunohost.org/integration/minchat.svg)](https://dash.yunohost.org/appci/app/minchat) ![](https://ci-apps.yunohost.org/ci/badges/minchat.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/minchat.maintain.svg) diff --git a/manifest.json b/manifest.json index 00bf72f..cbda47f 100644 --- a/manifest.json +++ b/manifest.json @@ -20,7 +20,6 @@ "nginx", "php7.0-fpm" ], - "license": "MIT", "arguments": { "install" : [ { From 4d517da6cc3d3ed77d0085655e67d9fc98085983 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 25 Jul 2020 07:27:37 +0200 Subject: [PATCH 05/19] fix --- conf/nginx.conf | 2 +- conf/php-fpm.conf | 2 +- conf/php-fpm.ini | 1 - scripts/_common.sh | 2 +- scripts/backup | 2 +- scripts/install | 13 ++++++------- scripts/remove | 4 ++-- scripts/restore | 5 ----- scripts/upgrade | 6 +++--- 9 files changed, 15 insertions(+), 22 deletions(-) delete mode 100644 conf/php-fpm.ini diff --git a/conf/nginx.conf b/conf/nginx.conf index d3513a7..e8d8aac 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -17,7 +17,7 @@ location __PATH__/ { try_files $uri $uri/ index.php; location ~ [^/]\.php(/|$) { fastcgi_split_path_info ^(.+?\.php)(/.*)$; - fastcgi_pass unix:/var/run/php/php7.0-fpm-__NAME__.sock; + fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock; fastcgi_index index.php; include fastcgi_params; diff --git a/conf/php-fpm.conf b/conf/php-fpm.conf index b278147..ccade7b 100644 --- a/conf/php-fpm.conf +++ b/conf/php-fpm.conf @@ -30,7 +30,7 @@ group = __USER__ ; specific port; ; '/path/to/unix/socket' - to listen on a unix socket. ; Note: This value is mandatory. -listen = /var/run/php7-fpm-__NAMETOCHANGE__.sock +listen = /var/run/php__PHPVERSION__-fpm-__NAMETOCHANGE__.sock ; Set listen(2) backlog. ; Default Value: 128 (-1 on FreeBSD and OpenBSD) diff --git a/conf/php-fpm.ini b/conf/php-fpm.ini deleted file mode 100644 index 18ddf9c..0000000 --- a/conf/php-fpm.ini +++ /dev/null @@ -1 +0,0 @@ -post_max_size=30M \ No newline at end of file diff --git a/scripts/_common.sh b/scripts/_common.sh index b0cbf30..224cc38 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -7,7 +7,7 @@ # dependencies used by the app #pkg_dependencies="" -#YNH_PHP_VERSION="7.3" +YNH_PHP_VERSION="7.3" #================================================= # PERSONAL HELPERS diff --git a/scripts/backup b/scripts/backup index e885b2c..df7da25 100644 --- a/scripts/backup +++ b/scripts/backup @@ -31,7 +31,7 @@ app=$YNH_APP_INSTANCE_NAME final_path=$(ynh_app_setting_get --app=$app --key=final_path) domain=$(ynh_app_setting_get --app=$app --key=domain) db_name=$(ynh_app_setting_get --app=$app --key=db_name) -#phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # DECLARE DATA AND CONF FILES TO BACKUP diff --git a/scripts/install b/scripts/install index a20af47..37023af 100644 --- a/scripts/install +++ b/scripts/install @@ -35,8 +35,6 @@ app=$YNH_APP_INSTANCE_NAME #================================================= ynh_script_progression --message="Validating installation parameters..." --time --weight=1 -### If the app uses nginx as web server (written in HTML/PHP in most cases), the final path should be "/var/www/$app". -### If the app provides an internal web server (or uses another application server such as uwsgi), the final path should be "/opt/yunohost/$app" final_path=/var/www/$app test ! -e "$final_path" || ynh_die --message="This path already contains a folder" @@ -80,11 +78,13 @@ ynh_system_user_create --username=$app #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Configuring php-fpm..." --time --weight=1 +ynh_script_progression --message="Configuring PHP-fpm..." --time --weight=1 # Create a dedicated php-fpm config ynh_add_fpm_config +phpversion=$(ynh_app_setting_get --app="$app" --key=phpversion) + #================================================= # GENERIC FINALIZATION #================================================= @@ -99,17 +99,16 @@ chown -R $app: $final_path #================================================= ynh_script_progression --message="Configuring SSOwat..." --time --weight=1 -# Make app public if necessary +# Make app public if necessary or protect it if [ $is_public -eq 1 ] then - # unprotected_uris allows SSO credentials to be passed anyway. - ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" + ynh_permission_update --permission "main" --add "visitors" fi #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." --time --weight=1 +ynh_script_progression --message="Reloading NGINX web server..." --time --weight=1 ynh_systemd_action --service_name=nginx --action=reload diff --git a/scripts/remove b/scripts/remove index 5f82707..0f6cec9 100644 --- a/scripts/remove +++ b/scripts/remove @@ -51,7 +51,7 @@ ynh_secure_remove --file="$final_path" #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Removing nginx web server configuration..." --time --weight=1 +ynh_script_progression --message="Removing NGINX web server configuration..." --time --weight=1 # Remove the dedicated nginx config ynh_remove_nginx_config @@ -59,7 +59,7 @@ ynh_remove_nginx_config #================================================= # REMOVE PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Removing php-fpm configuration..." --time --weight=1 +ynh_script_progression --message="Removing PHP-fpm configuration..." --time --weight=1 # Remove the dedicated php-fpm config ynh_remove_fpm_config diff --git a/scripts/restore b/scripts/restore index 7ffc012..1c6b490 100644 --- a/scripts/restore +++ b/scripts/restore @@ -14,11 +14,6 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -ynh_clean_setup () { - #### Remove this function if there's nothing to clean before calling the remove script. - true -} -# Exit if an error occurs during the execution of the script ynh_abort_if_errors #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 0e484d0..59289cb 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -94,15 +94,15 @@ ynh_system_user_create --username=$app #================================================= # Set permissions to app files -chown -R $app $final_path +chown -R $app: $final_path #================================================= # PHP-FPM CONFIGURATION #================================================= ynh_script_progression --message="Upgrading PHP-fpm configuration..." --weight=1 -# Create a dedicated php-fpm config -ynh_add_fpm_config #--package="$extra_php_dependencies" +# Create a dedicated PHP-fpm config +ynh_add_fpm_config #================================================= # RELOAD NGINX From 73877f15d5984d5d0f14b79f2cbf5eb56bbd856f Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 25 Jul 2020 07:28:23 +0200 Subject: [PATCH 06/19] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 68a9857..9408d30 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ [![Integration level](https://dash.yunohost.org/integration/minchat.svg)](https://dash.yunohost.org/appci/app/minchat) ![](https://ci-apps.yunohost.org/ci/badges/minchat.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/minchat.maintain.svg) + minchat_ynh is a free minimalist chat application packaged for [Yunohost](https://yunohost.org). It is based on [wojtek77/chat](https://github.com/wojtek77/chat), itself based on [Gabriel Nava's tutorial](http://code.tutsplus.com/tutorials/how-to-create-a-simple-web-based-chat-application--net-5931). @@ -34,7 +35,7 @@ In this example `auth = John:Game,John:Family,Mary:Game,Tim:Family,admin:*,*:Pub - `*:Public` = everybody can acccess the Public room - `*:` = everybody can access the unnamed room -## Screen shot +## Screenshot ![screenshot](https://raw.githubusercontent.com/chtixof/databank/master/minchat_ynh/minchat_ynh_screenshot01.gif) ## Hints for users From 8262156e8c1d9b81d0e87eb4d28365e5cd28cda2 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 26 Jul 2020 19:52:00 +0200 Subject: [PATCH 07/19] fix --- conf/nginx.conf | 7 +++++-- scripts/backup | 4 ---- scripts/install | 8 ++++---- scripts/upgrade | 1 + 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index e8d8aac..face3e5 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -12,7 +12,7 @@ location __PATH__/ { index index.php; # Common parameter to increase upload size limit in conjunction with dedicated php-fpm file - #client_max_body_size 50M; + client_max_body_size 50M; try_files $uri $uri/ index.php; location ~ [^/]\.php(/|$) { @@ -27,6 +27,9 @@ location __PATH__/ { } # Include SSOWAT user panel. - include conf.d/yunohost_panel.conf.inc; + #include conf.d/yunohost_panel.conf.inc; + + location ~ /(conf|history)(/|$) { + deny all; } diff --git a/scripts/backup b/scripts/backup index df7da25..209bacd 100644 --- a/scripts/backup +++ b/scripts/backup @@ -14,10 +14,6 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -ynh_clean_setup () { - ### Remove this function if there's nothing to clean before calling the remove script. - true -} # Exit if an error occurs during the execution of the script ynh_abort_if_errors diff --git a/scripts/install b/scripts/install index 37023af..bcf03eb 100644 --- a/scripts/install +++ b/scripts/install @@ -62,9 +62,9 @@ ynh_setup_source --dest_dir="$final_path" #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Configuring nginx web server..." --time --weight=1 +ynh_script_progression --message="Configuring NGINX web server..." --time --weight=1 -# Create a dedicated nginx config +# Create a dedicated NGINX config ynh_add_nginx_config #================================================= @@ -80,11 +80,11 @@ ynh_system_user_create --username=$app #================================================= ynh_script_progression --message="Configuring PHP-fpm..." --time --weight=1 +phpversion=$(ynh_app_setting_get --app="$app" --key=phpversion) + # Create a dedicated php-fpm config ynh_add_fpm_config -phpversion=$(ynh_app_setting_get --app="$app" --key=phpversion) - #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 59289cb..104f169 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -20,6 +20,7 @@ domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) is_public=$(ynh_app_setting_get --app=$app --key=is_public) final_path=$(ynh_app_setting_get --app=$app --key=final_path) +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # CHECK VERSION From af1cb594808ac73b83db050d3385688e48e3d07f Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 26 Jul 2020 19:52:53 +0200 Subject: [PATCH 08/19] Update nginx.conf --- conf/nginx.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index face3e5..1a4271f 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -9,7 +9,7 @@ location __PATH__/ { rewrite ^ https://$server_name$request_uri? permanent; } - index index.php; + index index.html index.php; # Common parameter to increase upload size limit in conjunction with dedicated php-fpm file client_max_body_size 50M; From d1237ab05ddb6f0959504997cb504f1cb776cd2e Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 26 Jul 2020 19:55:36 +0200 Subject: [PATCH 09/19] Update nginx.conf --- conf/nginx.conf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 1a4271f..3fa2954 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -28,8 +28,8 @@ location __PATH__/ { # Include SSOWAT user panel. #include conf.d/yunohost_panel.conf.inc; - - location ~ /(conf|history)(/|$) { - deny all; + + #location ~ /(conf|history)(/|$) { + #deny all; } From 0c97b15e87f759459708f9b16dba5ddaa8fd65a3 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 26 Jul 2020 19:58:23 +0200 Subject: [PATCH 10/19] Update upgrade --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 104f169..9708089 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -79,7 +79,7 @@ fi #================================================= ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1 -# Create a dedicated nginx config +# Create a dedicated NGINX config ynh_add_nginx_config #================================================= From 22cdb4b9b13fa362e90535bc6cf923129c852246 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 26 Jul 2020 20:01:39 +0200 Subject: [PATCH 11/19] 7.0 --- conf/nginx.conf | 7 +------ conf/php-fpm.conf | 2 +- scripts/backup | 1 - scripts/restore | 25 +++++++------------------ 4 files changed, 9 insertions(+), 26 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 3fa2954..9d03489 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -17,7 +17,7 @@ location __PATH__/ { try_files $uri $uri/ index.php; location ~ [^/]\.php(/|$) { fastcgi_split_path_info ^(.+?\.php)(/.*)$; - fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock; + fastcgi_pass unix:/var/run/php/php7.0-fpm-__NAME__.sock; fastcgi_index index.php; include fastcgi_params; @@ -26,10 +26,5 @@ location __PATH__/ { fastcgi_param SCRIPT_FILENAME $request_filename; } - # Include SSOWAT user panel. - #include conf.d/yunohost_panel.conf.inc; - - #location ~ /(conf|history)(/|$) { - #deny all; } diff --git a/conf/php-fpm.conf b/conf/php-fpm.conf index ccade7b..c2c4a6a 100644 --- a/conf/php-fpm.conf +++ b/conf/php-fpm.conf @@ -30,7 +30,7 @@ group = __USER__ ; specific port; ; '/path/to/unix/socket' - to listen on a unix socket. ; Note: This value is mandatory. -listen = /var/run/php__PHPVERSION__-fpm-__NAMETOCHANGE__.sock +listen = /var/run/php7.0-fpm-__NAMETOCHANGE__.sock ; Set listen(2) backlog. ; Default Value: 128 (-1 on FreeBSD and OpenBSD) diff --git a/scripts/backup b/scripts/backup index 209bacd..2e3fbc4 100644 --- a/scripts/backup +++ b/scripts/backup @@ -27,7 +27,6 @@ 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) -phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # DECLARE DATA AND CONF FILES TO BACKUP diff --git a/scripts/restore b/scripts/restore index 1c6b490..29121ee 100644 --- a/scripts/restore +++ b/scripts/restore @@ -19,19 +19,18 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --time --weight=1 +ynh_script_progression --message="Loading installation settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) final_path=$(ynh_app_setting_get --app=$app --key=final_path) -phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= -ynh_script_progression --message="Validating restoration parameters..." --time --weight=1 +ynh_script_progression --message="Validating restoration parameters..." --weight=1 ynh_webpath_available --domain=$domain --path_url=$path_url \ || ynh_die --message="Path not available: ${domain}${path_url}" @@ -49,14 +48,14 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # RESTORE THE APP MAIN DIR #================================================= -ynh_script_progression --message="Restoring the app main directory..." --time --weight=1 +ynh_script_progression --message="Restoring the app main directory..." --weight=2 ynh_restore_file --origin_path="$final_path" #================================================= # RECREATE THE DEDICATED USER #================================================= -ynh_script_progression --message="Recreating the dedicated system user..." --time --weight=1 +ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 # Create the dedicated user (if not existing) ynh_system_user_create --username=$app @@ -74,28 +73,18 @@ chown -R root: $final_path ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" -#================================================= -# SPECIFIC RESTORATION -#================================================= -# REINSTALL DEPENDENCIES -#================================================= -ynh_script_progression --message="Reinstalling dependencies..." --time --weight=1 - -# Define and install dependencies -#ynh_install_app_dependencies $pkg_dependencies - #================================================= # GENERIC FINALIZATION #================================================= # RELOAD NGINX AND PHP-FPM #================================================= -ynh_script_progression --message="Reloading nginx web server and php-fpm..." --time --weight=1 +ynh_script_progression --message="Reloading nginx web server and php-fpm..." --weight=1 -ynh_systemd_action --service_name=php$phpversion-fpm --action=reload +ynh_systemd_action --service_name=php7.0-fpm --action=reload ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Restoration completed for $app" --time --last +ynh_script_progression --message="Restoration completed for $app" --last From 36c89c5afb0f272064d1f68ca227a3f9913df256 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 26 Jul 2020 20:06:47 +0200 Subject: [PATCH 12/19] fix --- conf/nginx.conf | 1 - scripts/_common.sh | 2 +- scripts/backup | 2 +- scripts/install | 2 -- scripts/upgrade | 1 - 5 files changed, 2 insertions(+), 6 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 9d03489..35862ae 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -25,6 +25,5 @@ location __PATH__/ { fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param SCRIPT_FILENAME $request_filename; } - } diff --git a/scripts/_common.sh b/scripts/_common.sh index 224cc38..b0cbf30 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -7,7 +7,7 @@ # dependencies used by the app #pkg_dependencies="" -YNH_PHP_VERSION="7.3" +#YNH_PHP_VERSION="7.3" #================================================= # PERSONAL HELPERS diff --git a/scripts/backup b/scripts/backup index 2e3fbc4..9cdbc15 100644 --- a/scripts/backup +++ b/scripts/backup @@ -49,7 +49,7 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" # BACKUP THE PHP-FPM CONFIGURATION #================================================= -ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" +ynh_backup --src_path="/etc/php/7.0/fpm/pool.d/$app.conf" #================================================= # END OF SCRIPT diff --git a/scripts/install b/scripts/install index bcf03eb..94741aa 100644 --- a/scripts/install +++ b/scripts/install @@ -80,8 +80,6 @@ ynh_system_user_create --username=$app #================================================= ynh_script_progression --message="Configuring PHP-fpm..." --time --weight=1 -phpversion=$(ynh_app_setting_get --app="$app" --key=phpversion) - # Create a dedicated php-fpm config ynh_add_fpm_config diff --git a/scripts/upgrade b/scripts/upgrade index 9708089..eca06ff 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -20,7 +20,6 @@ domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) is_public=$(ynh_app_setting_get --app=$app --key=is_public) final_path=$(ynh_app_setting_get --app=$app --key=final_path) -phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # CHECK VERSION From 2417bf0829fb4fd911581538af64037fb7fcf004 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Fri, 25 Sep 2020 15:57:18 +0200 Subject: [PATCH 13/19] fix --- README.md | 66 +++++++++++++++++++++++++++++++++++++++++++--- conf/nginx.conf | 2 +- conf/php-fpm.conf | 2 +- scripts/_common.sh | 2 +- scripts/backup | 4 +-- scripts/install | 24 ++++++++--------- scripts/restore | 3 ++- scripts/upgrade | 4 +-- 8 files changed, 83 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 9408d30..834d38a 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,23 @@ # Minchat for YunoHost -[![Integration level](https://dash.yunohost.org/integration/minchat.svg)](https://dash.yunohost.org/appci/app/minchat) ![](https://ci-apps.yunohost.org/ci/badges/minchat.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/minchat.maintain.svg) +[![Integration level](https://dash.yunohost.org/integration/minchat.svg)](https://dash.yunohost.org/appci/app/minchat) ![](https://ci-apps.yunohost.org/ci/badges/minchat.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/minchat.maintain.svg) +[![Install REPLACEBYYOURAPP with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=REPLACEBYYOURAPP) +*[Lire ce readme en français.](./README_fr.md)* + +> *This package allows you to install REPLACEBYYOURAPP quickly and simply on a YunoHost server. +If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.* + +## Overview minchat_ynh is a free minimalist chat application packaged for [Yunohost](https://yunohost.org). It is based on [wojtek77/chat](https://github.com/wojtek77/chat), itself based on [Gabriel Nava's tutorial](http://code.tutsplus.com/tutorials/how-to-create-a-simple-web-based-chat-application--net-5931). +**Shipped version:** 1.0 + +## Screenshot +![screenshot](https://raw.githubusercontent.com/chtixof/databank/master/minchat_ynh/minchat_ynh_screenshot01.gif) + ## Features - Simple web chat: only requires a browser ; no XMPP application @@ -35,9 +47,55 @@ In this example `auth = John:Game,John:Family,Mary:Game,Tim:Family,admin:*,*:Pub - `*:Public` = everybody can acccess the Public room - `*:` = everybody can access the unnamed room -## Screenshot -![screenshot](https://raw.githubusercontent.com/chtixof/databank/master/minchat_ynh/minchat_ynh_screenshot01.gif) - ## Hints for users - The URLs you send are linked or transformed to images when preceeded by a ! - If multiple rooms are allowed by the administrator in the setup.ini, you can have several tabs opened to different rooms in the same browser + +## Documentation + + * Official documentation: Link to the official documentation of this app + * YunoHost documentation: If specific documentation is needed, feel free to contribute. + +## YunoHost specific features + +#### Multi-user support + +Are LDAP and HTTP auth supported? +Can the app be used by multiple users? + +#### Supported architectures + +* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/REPLACEBYYOURAPP%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/REPLACEBYYOURAPP/) +* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/REPLACEBYYOURAPP%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/REPLACEBYYOURAPP/) + +## Limitations + +* Any known limitations. + +## Additional information + +* Other info you would like to add about this app. + +**More info on the documentation page:** +https://yunohost.org/packaging_apps + +## Links + + * Report a bug: https://github.com/YunoHost-Apps/REPLACEBYYOURAPP_ynh/issues + * App website: Link to the official website of this app. + * Upstream app repository: Link to the official repository of the upstream app. + * YunoHost website: https://yunohost.org/ + +--- + +## Developer info + +Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/REPLACEBYYOURAPP_ynh/tree/testing). + +To try the testing branch, please proceed like that. +``` +sudo yunohost app install https://github.com/YunoHost-Apps/REPLACEBYYOURAPP_ynh/tree/testing --debug +or +sudo yunohost app upgrade REPLACEBYYOURAPP -u https://github.com/YunoHost-Apps/REPLACEBYYOURAPP_ynh/tree/testing --debug +``` + diff --git a/conf/nginx.conf b/conf/nginx.conf index 35862ae..47a1732 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -17,7 +17,7 @@ location __PATH__/ { try_files $uri $uri/ index.php; location ~ [^/]\.php(/|$) { fastcgi_split_path_info ^(.+?\.php)(/.*)$; - fastcgi_pass unix:/var/run/php/php7.0-fpm-__NAME__.sock; + fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock; fastcgi_index index.php; include fastcgi_params; diff --git a/conf/php-fpm.conf b/conf/php-fpm.conf index c2c4a6a..ccade7b 100644 --- a/conf/php-fpm.conf +++ b/conf/php-fpm.conf @@ -30,7 +30,7 @@ group = __USER__ ; specific port; ; '/path/to/unix/socket' - to listen on a unix socket. ; Note: This value is mandatory. -listen = /var/run/php7.0-fpm-__NAMETOCHANGE__.sock +listen = /var/run/php__PHPVERSION__-fpm-__NAMETOCHANGE__.sock ; Set listen(2) backlog. ; Default Value: 128 (-1 on FreeBSD and OpenBSD) diff --git a/scripts/_common.sh b/scripts/_common.sh index b0cbf30..224cc38 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -7,7 +7,7 @@ # dependencies used by the app #pkg_dependencies="" -#YNH_PHP_VERSION="7.3" +YNH_PHP_VERSION="7.3" #================================================= # PERSONAL HELPERS diff --git a/scripts/backup b/scripts/backup index 9cdbc15..0853e2c 100644 --- a/scripts/backup +++ b/scripts/backup @@ -26,7 +26,7 @@ app=$YNH_APP_INSTANCE_NAME final_path=$(ynh_app_setting_get --app=$app --key=final_path) domain=$(ynh_app_setting_get --app=$app --key=domain) -db_name=$(ynh_app_setting_get --app=$app --key=db_name) +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # DECLARE DATA AND CONF FILES TO BACKUP @@ -49,7 +49,7 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" # BACKUP THE PHP-FPM CONFIGURATION #================================================= -ynh_backup --src_path="/etc/php/7.0/fpm/pool.d/$app.conf" +ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" #================================================= # END OF SCRIPT diff --git a/scripts/install b/scripts/install index 94741aa..6d55bbf 100644 --- a/scripts/install +++ b/scripts/install @@ -33,7 +33,7 @@ app=$YNH_APP_INSTANCE_NAME #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= -ynh_script_progression --message="Validating installation parameters..." --time --weight=1 +ynh_script_progression --message="Validating installation parameters..." --weight=1 final_path=/var/www/$app test ! -e "$final_path" || ynh_die --message="This path already contains a folder" @@ -44,7 +44,7 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -ynh_script_progression --message="Storing installation settings..." --time --weight=1 +ynh_script_progression --message="Storing installation settings..." --weight=1 ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url @@ -53,7 +53,7 @@ ynh_app_setting_set --app=$app --key=is_public --value=$is_public #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_script_progression --message="Setting up source files..." --time --weight=1 +ynh_script_progression --message="Setting up source files..." --weight=1 ynh_app_setting_set --app=$app --key=final_path --value=$final_path # Download, check integrity, uncompress and patch the source from app.src @@ -62,7 +62,7 @@ ynh_setup_source --dest_dir="$final_path" #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Configuring NGINX web server..." --time --weight=1 +ynh_script_progression --message="Configuring NGINX web server..." --weight=1 # Create a dedicated NGINX config ynh_add_nginx_config @@ -70,7 +70,7 @@ ynh_add_nginx_config #================================================= # CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Configuring system user..." --time --weight=1 +ynh_script_progression --message="Configuring system user..." --weight=1 # Create a system user ynh_system_user_create --username=$app @@ -78,10 +78,10 @@ ynh_system_user_create --username=$app #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Configuring PHP-fpm..." --time --weight=1 +ynh_script_progression --message="Configuring PHP-fpm..." --weight=1 -# Create a dedicated php-fpm config -ynh_add_fpm_config +ynh_add_fpm_config --phpversion=$YNH_PHP_VERSION +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # GENERIC FINALIZATION @@ -95,18 +95,18 @@ chown -R $app: $final_path #================================================= # SETUP SSOWAT #================================================= -ynh_script_progression --message="Configuring SSOwat..." --time --weight=1 +ynh_script_progression --message="Configuring SSOwat..." --weight=3 # Make app public if necessary or protect it if [ $is_public -eq 1 ] then - ynh_permission_update --permission "main" --add "visitors" + ynh_permission_update --permission "main" --add "visitors" fi #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." --time --weight=1 +ynh_script_progression --message="Reloading NGINX web server..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload @@ -114,4 +114,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Installation of $app completed" --time --last +ynh_script_progression --message="Installation of $app completed" --last diff --git a/scripts/restore b/scripts/restore index 29121ee..0d57f5b 100644 --- a/scripts/restore +++ b/scripts/restore @@ -26,6 +26,7 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) final_path=$(ynh_app_setting_get --app=$app --key=final_path) +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # CHECK IF THE APP CAN BE RESTORED @@ -80,7 +81,7 @@ ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" #================================================= ynh_script_progression --message="Reloading nginx web server and php-fpm..." --weight=1 -ynh_systemd_action --service_name=php7.0-fpm --action=reload +ynh_systemd_action --service_name=php$phpversion-fpm --action=reload ynh_systemd_action --service_name=nginx --action=reload #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index eca06ff..7a844d4 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -99,9 +99,9 @@ chown -R $app: $final_path #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading PHP-fpm configuration..." --weight=1 +ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=1 -# Create a dedicated PHP-fpm config +# Create a dedicated PHPFPM config ynh_add_fpm_config #================================================= From 7ad033838c5b41efd2424a4496a4abf06b9bae3a Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Fri, 25 Sep 2020 16:13:08 +0200 Subject: [PATCH 14/19] Update nginx.conf --- conf/nginx.conf | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 47a1732..2425146 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,7 +1,6 @@ #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; -location __PATH__/ { +location __PATH__ { - # Path to source alias __FINALPATH__/ ; # Force usage of https @@ -11,19 +10,19 @@ location __PATH__/ { index index.html index.php; - # Common parameter to increase upload size limit in conjunction with dedicated php-fpm file - client_max_body_size 50M; - try_files $uri $uri/ index.php; location ~ [^/]\.php(/|$) { fastcgi_split_path_info ^(.+?\.php)(/.*)$; - fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock; - + fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm.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; +} + location ~ /(conf|history)(/|$) { + deny all; + } } From 49e9bf7e3227639c4d8d50d3b5df5a3f588848e6 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Fri, 25 Sep 2020 16:21:33 +0200 Subject: [PATCH 15/19] Small typos --- conf/nginx.conf | 2 +- manifest.json | 4 ++-- scripts/backup | 2 +- scripts/install | 5 ++--- scripts/remove | 26 +++++++++----------------- scripts/restore | 6 +++--- scripts/upgrade | 6 +++--- 7 files changed, 21 insertions(+), 30 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 2425146..7aad06c 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,5 +1,5 @@ #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; -location __PATH__ { +location __PATH__/ { alias __FINALPATH__/ ; diff --git a/manifest.json b/manifest.json index cbda47f..7a8c848 100644 --- a/manifest.json +++ b/manifest.json @@ -3,8 +3,8 @@ "id": "minchat", "packaging_format": 1, "description": { - "en": "A minimalist web chat", - "fr": "Un web chat minimaliste" + "en": "Minimalist web chat", + "fr": "Web chat minimaliste" }, "version": "1.0~ynh1", "url": "https://github.com/wojtek77/chat", diff --git a/scripts/backup b/scripts/backup index 0853e2c..642ffb2 100644 --- a/scripts/backup +++ b/scripts/backup @@ -55,4 +55,4 @@ ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" # END OF SCRIPT #================================================= -ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." +ynh_print_info --message="Backup script completed for MinChat. (YunoHost will then actually copy those files to the archive)." diff --git a/scripts/install b/scripts/install index 6d55bbf..935fc46 100644 --- a/scripts/install +++ b/scripts/install @@ -14,7 +14,6 @@ source /usr/share/yunohost/helpers #================================================= ynh_clean_setup () { - ### Remove this function if there's nothing to clean before calling the remove script. true } # Exit if an error occurs during the execution of the script @@ -78,7 +77,7 @@ ynh_system_user_create --username=$app #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Configuring PHP-fpm..." --weight=1 +ynh_script_progression --message="Configuring PHP-FPM..." --weight=1 ynh_add_fpm_config --phpversion=$YNH_PHP_VERSION phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) @@ -114,4 +113,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Installation of $app completed" --last +ynh_script_progression --message="Installation of MinChat completed" --last diff --git a/scripts/remove b/scripts/remove index 0f6cec9..8d192ea 100644 --- a/scripts/remove +++ b/scripts/remove @@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --time --weight=1 +ynh_script_progression --message="Loading installation settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME @@ -28,22 +28,14 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) # Remove the service from the list of services known by Yunohost (added from `yunohost service add`) if ynh_exec_warn_less yunohost service status $app >/dev/null then - ynh_script_progression --message="Removing $app service..." --time --weight=1 + ynh_script_progression --message="Removing MinChat service..." --weight=2 yunohost service remove $app fi -#================================================= -# REMOVE DEPENDENCIES -#================================================= -ynh_script_progression --message="Removing dependencies..." --time --weight=1 - -# Remove metapackage and its dependencies -ynh_remove_app_dependencies - #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_script_progression --message="Removing app main directory..." --time --weight=1 +ynh_script_progression --message="Removing MinChat main directory..." --weight=2 # Remove the app directory securely ynh_secure_remove --file="$final_path" @@ -51,17 +43,17 @@ ynh_secure_remove --file="$final_path" #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Removing NGINX web server configuration..." --time --weight=1 +ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1 -# Remove the dedicated nginx config +# Remove the dedicated NGINX config ynh_remove_nginx_config #================================================= # REMOVE PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Removing PHP-fpm configuration..." --time --weight=1 +ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=1 -# Remove the dedicated php-fpm config +# Remove the dedicated PHP-FPM config ynh_remove_fpm_config #================================================= @@ -69,7 +61,7 @@ ynh_remove_fpm_config #================================================= # REMOVE DEDICATED USER #================================================= -ynh_script_progression --message="Removing the dedicated system user..." --time --weight=1 +ynh_script_progression --message="Removing the dedicated system user..." --weight=1 # Delete a system user ynh_system_user_delete --username=$app @@ -78,4 +70,4 @@ ynh_system_user_delete --username=$app # END OF SCRIPT #================================================= -ynh_script_progression --message="Removal of $app completed" --time --last +ynh_script_progression --message="Removal of MinChat completed" --last diff --git a/scripts/restore b/scripts/restore index 0d57f5b..cf819f6 100644 --- a/scripts/restore +++ b/scripts/restore @@ -49,7 +49,7 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # RESTORE THE APP MAIN DIR #================================================= -ynh_script_progression --message="Restoring the app main directory..." --weight=2 +ynh_script_progression --message="Restoring MinChat main directory..." --weight=2 ynh_restore_file --origin_path="$final_path" @@ -79,7 +79,7 @@ ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" #================================================= # RELOAD NGINX AND PHP-FPM #================================================= -ynh_script_progression --message="Reloading nginx web server and php-fpm..." --weight=1 +ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1 ynh_systemd_action --service_name=php$phpversion-fpm --action=reload ynh_systemd_action --service_name=nginx --action=reload @@ -88,4 +88,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Restoration completed for $app" --last +ynh_script_progression --message="Restoration completed for MinChat" --last diff --git a/scripts/upgrade b/scripts/upgrade index 7a844d4..700a7e3 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -50,7 +50,7 @@ fi #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=5 +ynh_script_progression --message="Backing up the app before upgrading..." --weight=5 # Backup the current version of the app ynh_backup_before_upgrade @@ -101,7 +101,7 @@ chown -R $app: $final_path #================================================= ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=1 -# Create a dedicated PHPFPM config +# Create a dedicated PHP-FPM config ynh_add_fpm_config #================================================= @@ -114,4 +114,4 @@ ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Upgrade of $app completed" --last +ynh_script_progression --message="Upgrade of MinChat completed" --last From 1ab69fbaad48458223c6edc04b9eaaf4d6324e53 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Fri, 25 Sep 2020 16:31:19 +0200 Subject: [PATCH 16/19] fix --- check_process | 6 +-- conf/nginx.conf | 1 - scripts/_common.sh | 3 -- scripts/change_url | 109 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 112 insertions(+), 7 deletions(-) create mode 100644 scripts/change_url diff --git a/check_process b/check_process index f74fa5d..ca2b60a 100644 --- a/check_process +++ b/check_process @@ -2,8 +2,8 @@ auto_remove=1 ; Manifest domain="domain.tld" (DOMAIN) - path="/path" (PATH) - is_public=1 (PUBLIC|public=1|private=0) + path="/path" (PATH) + is_public=1 (PUBLIC|public=1|private=0) ; Checks pkg_linter=1 setup_sub_dir=1 @@ -13,7 +13,7 @@ setup_public=1 upgrade=1 backup_restore=1 - multi_instance=0 + multi_instance=1 incorrect_path=1 port_already_use=0 ;;; Levels diff --git a/conf/nginx.conf b/conf/nginx.conf index 7aad06c..a76a980 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -25,4 +25,3 @@ location __PATH__/ { } } - diff --git a/scripts/_common.sh b/scripts/_common.sh index 224cc38..d7614e9 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,9 +4,6 @@ # COMMON VARIABLES #================================================= -# dependencies used by the app -#pkg_dependencies="" - YNH_PHP_VERSION="7.3" #================================================= diff --git a/scripts/change_url b/scripts/change_url new file mode 100644 index 0000000..1f77e21 --- /dev/null +++ b/scripts/change_url @@ -0,0 +1,109 @@ +#!/bin/bash + +#================================================= +# GENERIC STARTING +#================================================= +# IMPORT GENERIC HELPERS +#================================================= + +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 + +app=$YNH_APP_INSTANCE_NAME + +#================================================= +# LOAD SETTINGS +#================================================= +ynh_script_progression --message="Loading installation settings..." --time --weight=1 + +# Needed for helper "ynh_add_nginx_config" +final_path=$(ynh_app_setting_get --app=$app --key=final_path) + +#================================================= +# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +#================================================= +ynh_script_progression --message="Backing up the app before changing its url (may take a while)..." --time --weight=1 + +# 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 + +#================================================= +# 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 +#================================================= +# MODIFY URL IN NGINX CONF +#================================================= +ynh_script_progression --message="Updating NGINX web server configuration..." --weight=3 + +nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf + +# 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..." --time --weight=1 + +ynh_systemd_action --service_name=nginx --action=reload + +#================================================= +# END OF SCRIPT +#================================================= + +ynh_script_progression --message="Change of URL completed for $app" --last From 4a0a6bb83e2b96fcd61c7c173053986ef46d7625 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Fri, 25 Sep 2020 16:37:17 +0200 Subject: [PATCH 17/19] Update remove --- scripts/remove | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/scripts/remove b/scripts/remove index 8d192ea..55e67a7 100644 --- a/scripts/remove +++ b/scripts/remove @@ -19,19 +19,6 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) final_path=$(ynh_app_setting_get --app=$app --key=final_path) -#================================================= -# STANDARD REMOVE -#================================================= -# REMOVE SERVICE INTEGRATION IN YUNOHOST -#================================================= - -# Remove the service from the list of services known by Yunohost (added from `yunohost service add`) -if ynh_exec_warn_less yunohost service status $app >/dev/null -then - ynh_script_progression --message="Removing MinChat service..." --weight=2 - yunohost service remove $app -fi - #================================================= # REMOVE APP MAIN DIR #================================================= From e307c8bbc77b0e9970a3b8cee32dc2f75d38b7f7 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Fri, 25 Sep 2020 17:19:02 +0200 Subject: [PATCH 18/19] Small fixes --- README.md | 44 +++++++++++++++----------------------------- scripts/backup | 2 +- scripts/change_url | 8 ++++---- scripts/install | 2 +- scripts/remove | 2 +- scripts/restore | 4 ++-- scripts/upgrade | 4 ++-- 7 files changed, 26 insertions(+), 40 deletions(-) diff --git a/README.md b/README.md index 834d38a..5e67d5a 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,16 @@ # Minchat for YunoHost [![Integration level](https://dash.yunohost.org/integration/minchat.svg)](https://dash.yunohost.org/appci/app/minchat) ![](https://ci-apps.yunohost.org/ci/badges/minchat.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/minchat.maintain.svg) -[![Install REPLACEBYYOURAPP with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=REPLACEBYYOURAPP) +[![Install Minchat with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=minchat) *[Lire ce readme en français.](./README_fr.md)* -> *This package allows you to install REPLACEBYYOURAPP quickly and simply on a YunoHost server. +> *This package allows you to install Minchat quickly and simply on a YunoHost server. If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.* ## Overview -minchat_ynh is a free minimalist chat application packaged for [Yunohost](https://yunohost.org). -It is based on [wojtek77/chat](https://github.com/wojtek77/chat), itself based on [Gabriel Nava's tutorial](http://code.tutsplus.com/tutorials/how-to-create-a-simple-web-based-chat-application--net-5931). +Minchat is a free minimalist chat application. It is based on [wojtek77/chat](https://github.com/wojtek77/chat), itself based on [Gabriel Nava's tutorial](http://code.tutsplus.com/tutorials/how-to-create-a-simple-web-based-chat-application--net-5931). **Shipped version:** 1.0 @@ -20,23 +19,15 @@ It is based on [wojtek77/chat](https://github.com/wojtek77/chat), itself based o ## Features -- Simple web chat: only requires a browser ; no XMPP application +- Simple web chat: only requires a browser ; no XMPP application. - No need for users to register. Just need the web address. But optional authorisation control. - On connection, the page is fed with the messages of the day - Args are in the URL as *get* arguments, so that you can share the URL or make it a favorite to avoid filling a form. Example : `https://yourdomain.org/minchat/?room=Living&name=John` - Optionaly multi room -## Installation -#### On Yunohost -Via the admin web console, type in: -Or on ssh : `sudo yunohost app install https://github.com/chtixof/minchat_ynh` - -Upgrade: `sudo yunohost app upgrade minchat -u https://github.com/chtixof/minchat_ynh` - -#### Otherwise -Download, unzip and just copy the content of the `sources` folder to any folder of your web site. ## Setup + The setup is optional. If you leave it as is, there is a single unnamed room, opened to all users. If you want to customize the access control, edit the file `conf/setup.ini` (if missing, copy it from `conf/sample/setup.ini`). The interesting parameter is `auth` that indicates which user is authorized to which room. In this example `auth = John:Game,John:Family,Mary:Game,Tim:Family,admin:*,*:Public,*:`, @@ -49,7 +40,7 @@ In this example `auth = John:Game,John:Family,Mary:Game,Tim:Family,admin:*,*:Pub ## Hints for users - The URLs you send are linked or transformed to images when preceeded by a ! -- If multiple rooms are allowed by the administrator in the setup.ini, you can have several tabs opened to different rooms in the same browser +- If multiple rooms are allowed by the administrator in the `setup.ini`, you can have several tabs opened to different rooms in the same browser. ## Documentation @@ -60,13 +51,13 @@ In this example `auth = John:Game,John:Family,Mary:Game,Tim:Family,admin:*,*:Pub #### Multi-user support -Are LDAP and HTTP auth supported? -Can the app be used by multiple users? + * Are LDAP and HTTP auth supported? **No** + * Can the app be used by multiple users? **Yes** #### Supported architectures -* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/REPLACEBYYOURAPP%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/REPLACEBYYOURAPP/) -* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/REPLACEBYYOURAPP%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/REPLACEBYYOURAPP/) +* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/minchat%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/minchat/) +* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/minchat%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/minchat/) ## Limitations @@ -76,26 +67,21 @@ Can the app be used by multiple users? * Other info you would like to add about this app. -**More info on the documentation page:** -https://yunohost.org/packaging_apps - ## Links - * Report a bug: https://github.com/YunoHost-Apps/REPLACEBYYOURAPP_ynh/issues - * App website: Link to the official website of this app. - * Upstream app repository: Link to the official repository of the upstream app. + * Report a bug: https://github.com/YunoHost-Apps/minchat_ynh/issues + * Upstream app repository: https://github.com/wojtek77/chat * YunoHost website: https://yunohost.org/ --- ## Developer info -Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/REPLACEBYYOURAPP_ynh/tree/testing). +Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/minchat_ynh/tree/testing). To try the testing branch, please proceed like that. ``` -sudo yunohost app install https://github.com/YunoHost-Apps/REPLACEBYYOURAPP_ynh/tree/testing --debug +sudo yunohost app install https://github.com/YunoHost-Apps/minchat_ynh/tree/testing --debug or -sudo yunohost app upgrade REPLACEBYYOURAPP -u https://github.com/YunoHost-Apps/REPLACEBYYOURAPP_ynh/tree/testing --debug +sudo yunohost app upgrade minchat -u https://github.com/YunoHost-Apps/minchat_ynh/tree/testing --debug ``` - diff --git a/scripts/backup b/scripts/backup index 642ffb2..4defc16 100644 --- a/scripts/backup +++ b/scripts/backup @@ -55,4 +55,4 @@ ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" # END OF SCRIPT #================================================= -ynh_print_info --message="Backup script completed for MinChat. (YunoHost will then actually copy those files to the archive)." +ynh_print_info --message="Backup script completed for Minchat. (YunoHost will then actually copy those files to the archive)." diff --git a/scripts/change_url b/scripts/change_url index 1f77e21..41896f4 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -24,7 +24,7 @@ app=$YNH_APP_INSTANCE_NAME #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --time --weight=1 +ynh_script_progression --message="Loading installation settings..." --weight=1 # Needed for helper "ynh_add_nginx_config" final_path=$(ynh_app_setting_get --app=$app --key=final_path) @@ -32,7 +32,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up the app before changing its url (may take a while)..." --time --weight=1 +ynh_script_progression --message="Backing up Minchat before changing its URL..." --weight=1 # Backup the current version of the app ynh_backup_before_upgrade @@ -98,7 +98,7 @@ fi #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." --time --weight=1 +ynh_script_progression --message="Reloading NGINX web server..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload @@ -106,4 +106,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Change of URL completed for $app" --last +ynh_script_progression --message="Change of URL completed for Minchat" --last diff --git a/scripts/install b/scripts/install index 935fc46..4bc5e8b 100644 --- a/scripts/install +++ b/scripts/install @@ -113,4 +113,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Installation of MinChat completed" --last +ynh_script_progression --message="Installation of Minchat completed" --last diff --git a/scripts/remove b/scripts/remove index 55e67a7..da254ff 100644 --- a/scripts/remove +++ b/scripts/remove @@ -57,4 +57,4 @@ ynh_system_user_delete --username=$app # END OF SCRIPT #================================================= -ynh_script_progression --message="Removal of MinChat completed" --last +ynh_script_progression --message="Removal of Minchat completed" --last diff --git a/scripts/restore b/scripts/restore index cf819f6..fd0c9ab 100644 --- a/scripts/restore +++ b/scripts/restore @@ -49,7 +49,7 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # RESTORE THE APP MAIN DIR #================================================= -ynh_script_progression --message="Restoring MinChat main directory..." --weight=2 +ynh_script_progression --message="Restoring Minchat main directory..." --weight=2 ynh_restore_file --origin_path="$final_path" @@ -88,4 +88,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Restoration completed for MinChat" --last +ynh_script_progression --message="Restoration completed for Minchat" --last diff --git a/scripts/upgrade b/scripts/upgrade index 700a7e3..9ccd45b 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -50,7 +50,7 @@ fi #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up the app before upgrading..." --weight=5 +ynh_script_progression --message="Backing up Minchat before upgrading..." --weight=5 # Backup the current version of the app ynh_backup_before_upgrade @@ -114,4 +114,4 @@ ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Upgrade of MinChat completed" --last +ynh_script_progression --message="Upgrade of Minchat completed" --last From c953eab9c21fd6aaae4f2c64aae34d08389bf0e0 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 29 Sep 2020 09:18:38 +0200 Subject: [PATCH 19/19] small typos --- README.md | 2 +- scripts/remove | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5e67d5a..9b7769e 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ In this example `auth = John:Game,John:Family,Mary:Game,Tim:Family,admin:*,*:Pub - `*:` = everybody can access the unnamed room ## Hints for users -- The URLs you send are linked or transformed to images when preceeded by a ! +- The URLs you send are linked or transformed to images when preceeded by a `!` - If multiple rooms are allowed by the administrator in the `setup.ini`, you can have several tabs opened to different rooms in the same browser. ## Documentation diff --git a/scripts/remove b/scripts/remove index da254ff..abec0af 100644 --- a/scripts/remove +++ b/scripts/remove @@ -22,7 +22,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_script_progression --message="Removing MinChat main directory..." --weight=2 +ynh_script_progression --message="Removing Minchat main directory..." --weight=2 # Remove the app directory securely ynh_secure_remove --file="$final_path"