Compare commits

...

13 Commits

  1. 4
      README.md
  2. 4
      README_fr.md
  3. 1
      check_process
  4. 3
      conf/config.json
  5. 9
      conf/nginx.conf
  6. 13
      conf/systemd.service
  7. 4
      doc/DISCLAIMER.md
  8. 4
      doc/DISCLAIMER_fr.md
  9. 9
      manifest.json
  10. 10
      scripts/backup
  11. 24
      scripts/change_url
  12. 47
      scripts/install
  13. 9
      scripts/remove
  14. 35
      scripts/restore
  15. 62
      scripts/upgrade

4
README.md

@ -40,6 +40,10 @@ To install and configure it:
*NB: OnlyOffice is only available for x86 architecture - **ARM** architecture is **not** supported (Raspberry Pi, OLinuXino...)*
#### High Performance Backend
This is an application on Nextcloud that should speed up the instance, more information here: https://github.com/nextcloud/notify_push#about
## YunoHost specific features
In addition to Nextcloud core features, the following are made available with

4
README_fr.md

@ -36,6 +36,10 @@ Pour l'installer et la configurer :
*NB : OnlyOffice n'est disponible que sous architecture x86 - L'architecture **ARM** n'est **pas** supporté (Raspberry Pi, OLinuXino...)*
#### Backend Hautes Performances
Il s'agit d'une application sur nextcloud qui devrait accélérer l'instance, plus d'informations ici: https://github.com/nextcloud/notify_push#about
## Caractéristiques spécifiques YunoHost
En plus des fonctionnalités principales de Nextcloud, les fonctionnalités suivantes sont incluses dans ce package :

1
check_process

@ -4,6 +4,7 @@
path="/path"
admin="homer"
user_home="1"
use_notify_push="1"
; Checks
pkg_linter=1
setup_sub_dir=1

3
conf/config.json

@ -12,7 +12,8 @@
"password": ""
},
"hashing_default_password": true,
"localstorage.allowsymlinks": true
"localstorage.allowsymlinks": true,
"trusted_proxies": [ "127.0.0.1", "::1" ]
},
"apps": {
"user_ldap": {

9
conf/nginx.conf

@ -134,6 +134,15 @@ location ^~ __PATH__/ {
try_files $uri / __PATH__/index.php$request_uri;
}
__STRING_USE_NOTIFY_PUSH__location ^~ __PATH__/push/ {
__STRING_USE_NOTIFY_PUSH__ proxy_pass http://unix:__FINAL_PATH__/notify-push.sock:/;
__STRING_USE_NOTIFY_PUSH__ proxy_http_version 1.1;
__STRING_USE_NOTIFY_PUSH__ proxy_set_header Upgrade $http_upgrade;
__STRING_USE_NOTIFY_PUSH__ proxy_set_header Connection "Upgrade";
__STRING_USE_NOTIFY_PUSH__ proxy_set_header Host $host;
__STRING_USE_NOTIFY_PUSH__ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
__STRING_USE_NOTIFY_PUSH__}
# show YunoHost panel access
include conf.d/yunohost_panel.conf.inc;
}

13
conf/systemd.service

@ -0,0 +1,13 @@
[Unit]
Description = Push daemon for Nextcloud clients
[Service]
Environment=SOCKET_PATH=__FINAL_PATH__/notify-push.sock
Environment=NEXTCLOUD_URL=https://__DOMAIN____PATH__
Environment=ALLOW_SELF_SIGNED=true
ExecStart=__FINAL_PATH__/apps/notify_push/bin/x86_64/notify_push __FINAL_PATH__/config/config.php
User=__APP__
Group=__APP__
[Install]
WantedBy = multi-user.target

4
doc/DISCLAIMER.md

@ -11,6 +11,10 @@ To install and configure it:
*NB: OnlyOffice is only available for x86 architecture - **ARM** architecture is **not** supported (Raspberry Pi, OLinuXino...)*
#### High Performance Backend
This is an application on Nextcloud that should speed up the instance, more information here: https://github.com/nextcloud/notify_push#about
## YunoHost specific features
In addition to Nextcloud core features, the following are made available with

4
doc/DISCLAIMER_fr.md

@ -11,6 +11,10 @@ Pour l'installer et la configurer :
*NB : OnlyOffice n'est disponible que sous architecture x86 - L'architecture **ARM** n'est **pas** supporté (Raspberry Pi, OLinuXino...)*
#### Backend Hautes Performances
Il s'agit d'une application sur nextcloud qui devrait accélérer l'instance, plus d'informations ici: https://github.com/nextcloud/notify_push#about
## Caractéristiques spécifiques YunoHost
En plus des fonctionnalités principales de Nextcloud, les fonctionnalités suivantes sont incluses dans ce package :

9
manifest.json

@ -56,6 +56,15 @@
"fr": "Accéder au dossier personnel des utilisateurs depuis Nextcloud ?"
},
"default": false
},
{
"name": "use_notify_push",
"type": "boolean",
"ask": {
"en": "Configure the High Performance Backend?",
"fr": "Configurer le Backend Hautes Performances ?"
},
"default": false
}
]
}

10
scripts/backup

@ -26,6 +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)
use_notify_push=$(ynh_app_setting_get --app=$app --key=use_notify_push)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
@ -86,6 +87,15 @@ ynh_print_info --message="Backing up data directory..."
ynh_backup --src_path="/home/yunohost.app/${app}/data" --is_big
#=================================================
# BACKUP THE NOTIFY_PUSH APP
#=================================================
if [ $use_notify_push -eq 1 ]
then
ynh_backup --src_path="/etc/systemd/system/${app}-notify-push.service"
fi
#=================================================
# END OF SCRIPT
#=================================================

24
scripts/change_url

@ -28,6 +28,7 @@ ynh_script_progression --message="Loading installation settings..."
# Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
use_notify_push=$(ynh_app_setting_get --app=$app --key=use_notify_push)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
@ -80,6 +81,14 @@ then
# Set global variables for NGINX helper
domain="$old_domain"
path_url="$new_path"
if [ $use_notify_push -eq 1 ]
then
string_use_notify_push=""
else
string_use_notify_push="#"
fi
# Create a dedicated NGINX config
ynh_add_nginx_config
fi
@ -127,6 +136,21 @@ then
fi
fi
#=================================================
# CONFIGURE NOTIFY_PUSH APP
#=================================================
if [ $use_notify_push -eq 1 ]
then
domain="$new_domain"
path_url="$new_path"
exec_occ config:app:set notify_push base_endpoint --value https://$domain$path_url/push
ynh_add_systemd_config --service="${app}-notify-push"
ynh_systemd_action --service_name="${app}-notify-push" --action=restart
fi
#=================================================
# GENERIC FINALISATION
#=================================================

47
scripts/install

@ -24,6 +24,7 @@ domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH
admin=$YNH_APP_ARG_ADMIN
user_home=$YNH_APP_ARG_USER_HOME
use_notify_push=$YNH_APP_ARG_USE_NOTIFY_PUSH
app=$YNH_APP_INSTANCE_NAME
@ -47,6 +48,7 @@ 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=admin --value=$admin
ynh_app_setting_set --app=$app --key=user_home --value=$user_home
ynh_app_setting_set --app=$app --key=use_notify_push --value=$use_notify_push
#=================================================
# STANDARD MODIFICATIONS
@ -121,6 +123,13 @@ then
sed --in-place --regexp-extended '/location = \/\.well\-known\/(caldav|carddav)/d' "../conf/nginx.conf"
fi
if [ $use_notify_push -eq 1 ]
then
string_use_notify_push=""
else
string_use_notify_push="#"
fi
# Create a dedicated NGINX config
ynh_add_nginx_config
@ -297,6 +306,21 @@ create_external_storage "/home/yunohost.multimedia/share" "Shared multimedia"
# Allow nextcloud to write into these directories
ynh_multimedia_addaccess $app
#=================================================
# CONFIGURE NOTIFY_PUSH APP
#=================================================
if [ $use_notify_push -eq 1 ]
then
exec_occ app:install notify_push
exec_occ config:app:set notify_push base_endpoint --value https://$domain$path_url/push
mkdir -p /var/run/$app/
chown $app: /var/run/$app/
ynh_add_systemd_config --service="${app}-notify-push"
fi
#=================================================
# GENERIC FINALIZATION
#=================================================
@ -311,6 +335,10 @@ find $datadir/ -type f -print0 | xargs -0 chmod 0640
find $datadir/ -type d -print0 | xargs -0 chmod 0750
chmod 640 "$final_path/config/config.php"
chmod 755 /home/yunohost.app
if [ $use_notify_push -eq 1 ]
then
chmod 740 $final_path/apps/notify_push/bin/x86_64/notify_push
fi
#=================================================
# SETUP LOGROTATE
@ -333,7 +361,11 @@ ynh_add_fail2ban_config --logpath="/home/yunohost.app/$app/data/nextcloud.log" -
#=================================================
ynh_script_progression --message="Configuring SSOwat..."
ynh_permission_create --permission="api" --label="api" --url="re:$(sed 's/[\.\-]/\%&/g' <<< $domain)/%.well%-known/.*" --allowed="visitors" "all_users" --auth_header="false" --show_tile="false" --protected="true"
if [ $use_notify_push -eq 1 ]
then
ynh_permission_create --permission="hpb" --label="High Performance Backend" --url="/push" --additional_urls="/index.php/apps/notify_push/" --allowed="visitors" --auth_header="false" --show_tile="false" --protected="true"
fi
#=================================================
# RELOAD NGINX
@ -342,6 +374,19 @@ ynh_script_progression --message="Reloading NGINX web server..."
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# CHECK IF NOTIFY_PUSH WORKS
#=================================================
if [ $use_notify_push -eq 1 ]
then
ynh_systemd_action --service_name="${app}-notify-push" --action=restart
if ! exec_occ notify_push:self-test; then
ynh_print_warn --message="The High Performance Backend service is still not working properly. Please log in with a user to your NextCloud instance, restart the High Performance Backend service with \"systemctl restart $app-notify-push.service\", and run \"sudo -u $app php${phpversion} $final_path/occ notify_push:self-test\" to verify that everything is green."
fi
fi
#=================================================
# END OF SCRIPT
#=================================================

9
scripts/remove

@ -19,6 +19,7 @@ app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
use_notify_push=$(ynh_app_setting_get --app=$app --key=use_notify_push)
#=================================================
# STANDARD REMOVE
@ -78,6 +79,14 @@ ynh_script_progression --message="Removing Fail2Ban configuration..." --weight=8
# Remove the dedicated Fail2Ban config
ynh_remove_fail2ban_config
#=================================================
# STOP AND REMOVE SERVICE
#=================================================
ynh_script_progression --message="Stopping and removing the systemd service..."
ynh_remove_systemd_config --service="${app}-notify-push"
ynh_secure_remove --file="/var/run/$app"
#=================================================
# SPECIFIC REMOVE
#=================================================

35
scripts/restore

@ -27,6 +27,7 @@ domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
use_notify_push=$(ynh_app_setting_get --app=$app --key=use_notify_push)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint)
@ -128,6 +129,21 @@ ynh_restore_file --origin_path="$datadir" --not_mandatory
mkdir -p "$datadir"
#=================================================
# RESTORE THE NOTIFY_PUSH APP
#=================================================
if [ $use_notify_push -eq 1 ]
then
mkdir -p /var/run/$app/
chown $app: /var/run/$app/
ynh_restore_file --origin_path="/etc/systemd/system/${app}-notify-push.service"
systemctl enable "${app}-notify-push".service --quiet
ynh_systemd_action --service_name="${app}-notify-push" --action=restart
fi
#=================================================
# RESTORE USER RIGHTS
#=================================================
@ -180,6 +196,25 @@ ynh_script_progression --message="Reloading NGINX web server..."
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# CHECK IF NOTIFY_PUSH WORKS
#=================================================
# Define a function to execute commands with `occ`
exec_occ() {
(cd "$final_path" && ynh_exec_as "$app" \
php${phpversion} occ --no-interaction --no-ansi "$@")
}
if [ $use_notify_push -eq 1 ]
then
ynh_systemd_action --service_name="${app}-notify-push" --action=restart
if ! exec_occ notify_push:self-test; then
ynh_print_warn --message="The High Performance Backend service is still not working properly. Please log in with a user to your NextCloud instance, restart the High Performance Backend service with \"systemctl restart $app-notify-push.service\", and run \"sudo -u $app php${phpversion} $final_path/occ notify_push:self-test\" to verify that everything is green."
fi
fi
#=================================================
# END OF SCRIPT
#=================================================

62
scripts/upgrade

@ -22,6 +22,7 @@ admin=$(ynh_app_setting_get --app=$app --key=admin)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
user_home=$(ynh_app_setting_get --app=$app --key=user_home)
use_notify_push=$(ynh_app_setting_get --app=$app --key=use_notify_push)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint)
@ -70,6 +71,12 @@ if [ -z "$phpversion" ]; then
phpversion="$YNH_PHP_VERSION"
fi
# If final_path doesn't exist, create it
if [ -z "$use_notify_push" ]; then
use_notify_push=0
ynh_app_setting_set --app=$app --key=use_notify_push --value=$use_notify_push
fi
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
@ -108,6 +115,15 @@ if ynh_legacy_permissions_exists; then
ynh_permission_create --permission="api" --label="api" --url="re:$(sed 's/[\.\-]/\%&/g' <<< $domain)/%.well%-known/.*" --allowed="visitors" "all_users" --auth_header="false" --show_tile="false" --protected="true"
fi
if [ $use_notify_push -eq 1 ] && ! ynh_permission_exists --permission="hpb"
then
ynh_permission_create --permission="hpb" --label="High Performance Backend" --url="/push" --additional_urls="/index.php/apps/notify_push/" --allowed="visitors" --auth_header="false" --show_tile="false" --protected="true"
elif [ $use_notify_push -eq 0 ] && ynh_permission_exists --permission="hpb"
then
ynh_permission_delete --permission="hpb"
fi
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
@ -174,6 +190,13 @@ then
sed --in-place --regexp-extended '/location = \/\.well\-known\/(caldav|carddav)/d' "../conf/nginx.conf"
fi
if [ $use_notify_push -eq 1 ]
then
string_use_notify_push=""
else
string_use_notify_push="#"
fi
# Create a dedicated NGINX config
ynh_add_nginx_config
@ -410,6 +433,28 @@ chmod 644 "$cron_path"
exec_occ background:cron
#=================================================
# CONFIGURE NOTIFY_PUSH APP
#=================================================
if [ $use_notify_push -eq 1 ]
then
# If notify_push is disabled, reenable it
if exec_occ app:list | awk '/Disabled/{f=1;next} f' | grep -q -w notify_push; then
exec_occ app:enable notify_push
# If notify_push is not installed, install it
elif ! exec_occ app:list | awk '/Enabled/{f=1;next} /Disabled/{f=0} f' | grep -q -w notify_push; then
exec_occ app:install notify_push
fi
mkdir -p /var/run/$app/
chown $app: /var/run/$app/
ynh_add_systemd_config --service="${app}-notify-push"
ynh_systemd_action --service_name="${app}-notify-push" --action=restart
fi
#=================================================
# GENERIC FINALIZATION
#=================================================
@ -424,6 +469,10 @@ find $datadir/ -type f -print0 | xargs -0 chmod 0640
find $datadir/ -type d -print0 | xargs -0 chmod 0750
chmod 640 "$final_path/config/config.php"
chmod 755 /home/yunohost.app
if [ $use_notify_push -eq 1 ]
then
chmod 740 $final_path/apps/notify_push/bin/x86_64/notify_push
fi
#=================================================
# WARNING ABOUT THIRD-PARTY APPS
@ -462,6 +511,19 @@ ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..."
ynh_systemd_action --service_name=nginx --action=reload
ynh_systemd_action --service_name="php${phpversion}-fpm" --action=reload
#=================================================
# CHECK IF NOTIFY_PUSH WORKS
#=================================================
if [ $use_notify_push -eq 1 ]
then
ynh_systemd_action --service_name="${app}-notify-push" --action=restart
if ! exec_occ notify_push:self-test; then
ynh_print_warn --message="The High Performance Backend service is still not working properly. Please log in with a user to your NextCloud instance, restart the High Performance Backend service with \"systemctl restart $app-notify-push.service\", and run \"sudo -u $app php${phpversion} $final_path/occ notify_push:self-test\" to verify that everything is green."
fi
fi
#=================================================
# END OF SCRIPT
#=================================================

Loading…
Cancel
Save