Browse Source

add notify_push option

add-notify_push-option
Kay0u 5 years ago
parent
commit
1341345908
No known key found for this signature in database GPG Key ID: AAFEEB16CFA2AE2D
  1. 9
      conf/nginx.conf
  2. 12
      conf/systemd.service
  3. 4
      doc/DISCLAIMER.md
  4. 4
      doc/DISCLAIMER_fr.md
  5. 9
      manifest.json
  6. 11
      scripts/change_url
  7. 25
      scripts/install
  8. 8
      scripts/remove
  9. 14
      scripts/restore
  10. 36
      scripts/upgrade

9
conf/nginx.conf

@ -134,6 +134,15 @@ location ^~ __PATH__/ {
try_files $uri / __PATH__/index.php$request_uri; try_files $uri / __PATH__/index.php$request_uri;
} }
__STRING_USE_NOTIFY_PUSH__location ^~ __PATH__/push/ {
__STRING_USE_NOTIFY_PUSH__ proxy_pass http://unix:/var/run/__APP__/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 # show YunoHost panel access
include conf.d/yunohost_panel.conf.inc; include conf.d/yunohost_panel.conf.inc;
} }

12
conf/systemd.service

@ -0,0 +1,12 @@
[Unit]
Description = Push daemon for Nextcloud clients
[Service]
Environment=SOCKET_PATH=/var/run/__APP__/notify-push.sock
Environment=NEXTCLOUD_URL=https://__DOMAIN____PATH__
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...)* *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 ## YunoHost specific features
In addition to Nextcloud core features, the following are made available with 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...)* *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 ## Caractéristiques spécifiques YunoHost
En plus des fonctionnalités principales de Nextcloud, les fonctionnalités suivantes sont incluses dans ce package : 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 ?" "fr": "Accéder au dossier personnel des utilisateurs depuis Nextcloud ?"
}, },
"default": false "default": false
},
{
"name": "use_notify_push",
"type": "boolean",
"ask": {
"en": "Configure the High Performance Backend?",
"fr": "Configurer le Backend Hautes Performances ?"
},
"default": false
} }
] ]
} }

11
scripts/change_url

@ -127,6 +127,17 @@ then
fi fi
fi fi
#=================================================
# CONFIGURE NOTIFY_PUSH APP
#=================================================
if [ $use_notify_push -eq 1 ]
then
ynh_add_systemd_config --service="${app}-notify-push"
ynh_systemd_action --service_name="${app}-notify-push" --action=restart
fi
#================================================= #=================================================
# GENERIC FINALISATION # GENERIC FINALISATION
#================================================= #=================================================

25
scripts/install

@ -24,6 +24,7 @@ domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH path_url=$YNH_APP_ARG_PATH
admin=$YNH_APP_ARG_ADMIN admin=$YNH_APP_ARG_ADMIN
user_home=$YNH_APP_ARG_USER_HOME user_home=$YNH_APP_ARG_USER_HOME
use_notify_push=$YNH_APP_ARG_USE_NOTIFY_PUSH
app=$YNH_APP_INSTANCE_NAME 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=path --value=$path_url
ynh_app_setting_set --app=$app --key=admin --value=$admin 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=user_home --value=$user_home
ynh_app_setting_set --app=$app --key=use_notify_push --value=$use_notify_push
#================================================= #=================================================
# STANDARD MODIFICATIONS # STANDARD MODIFICATIONS
@ -121,6 +123,13 @@ then
sed --in-place --regexp-extended '/location = \/\.well\-known\/(caldav|carddav)/d' "../conf/nginx.conf" sed --in-place --regexp-extended '/location = \/\.well\-known\/(caldav|carddav)/d' "../conf/nginx.conf"
fi fi
if [ $use_notify_push -eq 1 ]
then
string_use_notify_push=""
else
string_use_notify_push="#"
fi
# Create a dedicated NGINX config # Create a dedicated NGINX config
ynh_add_nginx_config ynh_add_nginx_config
@ -297,6 +306,22 @@ create_external_storage "/home/yunohost.multimedia/share" "Shared multimedia"
# Allow nextcloud to write into these directories # Allow nextcloud to write into these directories
ynh_multimedia_addaccess $app ynh_multimedia_addaccess $app
#=================================================
# CONFIGURE NOTIFY_PUSH APP
#=================================================
if [ $use_notify_push -eq 1 ]
then
exec_occ app:install notify_push
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 # GENERIC FINALIZATION
#================================================= #=================================================

8
scripts/remove

@ -19,6 +19,7 @@ app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_name=$(ynh_app_setting_get --app=$app --key=db_name)
final_path=$(ynh_app_setting_get --app=$app --key=final_path) 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 # STANDARD REMOVE
@ -78,6 +79,13 @@ ynh_script_progression --message="Removing Fail2Ban configuration..." --weight=8
# Remove the dedicated Fail2Ban config # Remove the dedicated Fail2Ban config
ynh_remove_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"
#================================================= #=================================================
# SPECIFIC REMOVE # SPECIFIC REMOVE
#================================================= #=================================================

14
scripts/restore

@ -128,6 +128,20 @@ ynh_restore_file --origin_path="$datadir" --not_mandatory
mkdir -p "$datadir" mkdir -p "$datadir"
#=================================================
# CONFIGURE NOTIFY_PUSH APP
#=================================================
if [ $use_notify_push -eq 1 ]
then
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
#================================================= #=================================================
# RESTORE USER RIGHTS # RESTORE USER RIGHTS
#================================================= #=================================================

36
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) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_name=$(ynh_app_setting_get --app=$app --key=db_name)
user_home=$(ynh_app_setting_get --app=$app --key=user_home) 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) phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint) fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint)
@ -70,6 +71,12 @@ if [ -z "$phpversion" ]; then
phpversion="$YNH_PHP_VERSION" phpversion="$YNH_PHP_VERSION"
fi 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 # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#================================================= #=================================================
@ -174,6 +181,13 @@ then
sed --in-place --regexp-extended '/location = \/\.well\-known\/(caldav|carddav)/d' "../conf/nginx.conf" sed --in-place --regexp-extended '/location = \/\.well\-known\/(caldav|carddav)/d' "../conf/nginx.conf"
fi fi
if [ $use_notify_push -eq 1 ]
then
string_use_notify_push=""
else
string_use_notify_push="#"
fi
# Create a dedicated NGINX config # Create a dedicated NGINX config
ynh_add_nginx_config ynh_add_nginx_config
@ -410,6 +424,28 @@ chmod 644 "$cron_path"
exec_occ background:cron 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 # GENERIC FINALIZATION
#================================================= #=================================================

Loading…
Cancel
Save