1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/nextcloud_ynh.git synced 2024-09-03 19:55:57 +02:00

add notify_push option

This commit is contained in:
Kay0u 2021-06-08 20:12:22 +02:00
parent b96736ad64
commit 274ad45c54
No known key found for this signature in database
GPG key ID: AAFEEB16CFA2AE2D
10 changed files with 106 additions and 0 deletions

View file

@ -165,6 +165,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:/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
include conf.d/yunohost_panel.conf.inc;
}

12
conf/systemd.service Normal file
View file

@ -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

View file

@ -12,6 +12,10 @@ Alternatively, you may open a 'Nextcloud shell' with `sudo yunohost app shell __
ONLYOFFICE is an online rich text document editor which can be integrated in Nextcloud
#### 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
#### With YunoHost App (ARM64 support, better performance)
For better performance and ARM64 support (Raspberry Pi, OLinuXino...), install the [OnlyOffice YunoHost app](https://apps.yunohost.org/app/onlyoffice) and connect it to Nextcloud, see the tutorial in the [doc of onlyoffice_ynh package](https://github.com/YunoHost-Apps/onlyoffice_ynh/blob/master/README_fr.md#configuration-de-onlyoffice-server)

View file

@ -12,6 +12,10 @@ Ou bien, vous pouvez ouvrir un "shell Nextcloud" avec `sudo yunohost app shell _
ONLYOFFICE est un éditeur de texte enrichi en ligne qui peut s'intégrer dans Nextcloud
#### 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
#### Avec l'application YunoHost (support ARM64, meilleures performances)
Pour de meilleures performances et le support de ARM64 (Raspberry Pi, OLinuXino...), installez l'[app YunoHost OnlyOffice](https://apps.yunohost.org/app/onlyoffice), puis connectez-la à Nextcloud : voir le tutoriel dans la [doc du paquet onlyoffice_ynh](https://github.com/YunoHost-Apps/onlyoffice_ynh/blob/master/README_fr.md#configuration-de-onlyoffice-server)

View file

@ -61,6 +61,12 @@ ram.runtime = "512M"
choices = ["yes", "no"]
default = "yes"
[install.enable_notify_push]
ask.en = "Configure the High Performance Backend?",
ask.fr = "Configurer le Backend Hautes Performances ?"
type = "boolean"
default = false
[resources]
[resources.sources]

View file

@ -49,6 +49,17 @@ then
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
#=================================================
# SETUP SSOWAT
#=================================================

View file

@ -49,6 +49,11 @@ then
sed --in-place --regexp-extended '/location = \/\.well\-known\/(caldav|carddav)/d' "../conf/nginx.conf"
fi
if [ $enable_notify_push -eq 1 ]
then
ynh_add_nginx_config "${app}-notify-push"
fi
# Create a dedicated NGINX config
ynh_add_nginx_config
@ -227,6 +232,22 @@ 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 [ $enable_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
#=================================================

View file

@ -22,6 +22,9 @@ ynh_remove_logrotate
# Remove the dedicated Fail2Ban config
ynh_remove_fail2ban_config
# Remove notify push
ynh_remove_systemd_config --service="${app}-notify-push"
# Remove a cron file
# TODO: Ensure that cron job is not running (How !?)
ynh_secure_remove --file="/etc/cron.d/$app"

View file

@ -74,6 +74,20 @@ ynh_script_progression --message="Restoring data directory..." --weight=2
# Use --not_mandatory for the data directory, because if the backup has been made with BACKUP_CORE_ONLY, there's no data into the backup.
ynh_restore_file --origin_path="$data_dir" --not_mandatory
#=================================================
# 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
#=================================================

View file

@ -366,6 +366,28 @@ chmod 644 "$cron_path"
exec_occ background:cron
#=================================================
# CONFIGURE NOTIFY_PUSH APP
#=================================================
if [ $enable_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
#=================================================
# LOGROTATE
#=================================================