1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/z-push_ynh.git synced 2024-09-03 18:05:58 +02:00
This commit is contained in:
YunoHost Bot 2024-08-31 13:33:23 +02:00 committed by GitHub
commit ea55e67587
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 93 additions and 146 deletions

View file

@ -1,12 +1,9 @@
; Additional php.ini defines, specific to this pool of workers.
; Common values to change to increase file upload limit
php_admin_value[upload_max_filesize] = 50M
php_admin_value[post_max_size] = 50M
php_admin_flag[mail.add_x_header] = Off
; Other common parameters
php_admin_value[max_execution_time] = 600
php_admin_value[max_input_time] = 300
php_admin_value[memory_limit] = 256M
php_admin_flag[short_open_tag] = On

View file

@ -14,7 +14,7 @@ location /Microsoft-Server-ActiveSync/ {
rewrite ^(.*)$ /Microsoft-Server-ActiveSync/index.php last;
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__PHP_VERSION__-fpm-__APP__.sock;
fastcgi_index index.php;
include fastcgi_params;
@ -29,7 +29,7 @@ location /Microsoft-Server-ActiveSync/ {
location /AutoDiscover/AutoDiscover.xml {
alias __INSTALL_DIR__/autodiscover/autodiscover.php;
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
fastcgi_pass unix:/var/run/php/php__PHP_VERSION__-fpm-__APP__.sock;
include fastcgi_params;
fastcgi_param HTTPS on;
fastcgi_param SCRIPT_FILENAME $request_filename;
@ -37,7 +37,7 @@ location /AutoDiscover/AutoDiscover.xml {
location /Autodiscover/Autodiscover.xml {
alias __INSTALL_DIR__/autodiscover/autodiscover.php;
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
fastcgi_pass unix:/var/run/php/php__PHP_VERSION__-fpm-__APP__.sock;
include fastcgi_params;
fastcgi_param HTTPS on;
fastcgi_param SCRIPT_FILENAME $request_filename;
@ -45,7 +45,7 @@ location /Autodiscover/Autodiscover.xml {
location /autodiscover/autodiscover.xml {
alias __INSTALL_DIR__/autodiscover/autodiscover.php;
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
fastcgi_pass unix:/var/run/php/php__PHP_VERSION__-fpm-__APP__.sock;
include fastcgi_params;
fastcgi_param HTTPS on;
fastcgi_param SCRIPT_FILENAME $request_filename;

View file

@ -16,7 +16,8 @@ admindoc = "https://wiki.z-hub.io/display/ZP/Documentation"
code = "https://github.com/Z-Hub/Z-Push"
[integration]
yunohost = ">= 11.2.20"
yunohost = ">= 11.2.18"
helpers_version = "2.1"
architectures = "all"
multi_instance = true
@ -42,6 +43,7 @@ ram.runtime = "50M"
[resources.system_user]
[resources.install_dir]
group = "www-data:r-x"
[resources.data_dir]

View file

@ -1,17 +1,5 @@
#!/bin/bash
#=================================================
# COMMON VARIABLES
#=================================================
#=================================================
# PERSONAL HELPERS
#=================================================
#=================================================
# EXPERIMENTAL HELPERS
#=================================================
#=================================================
# FUTURE OFFICIAL HELPERS
# COMMON VARIABLES AND CUSTOM HELPERS
#=================================================

View file

@ -1,44 +1,35 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
ynh_print_info --message="Declaring files to be backed up..."
ynh_print_info "Declaring files to be backed up..."
#=================================================
# BACKUP THE APP MAIN DIR
#=================================================
ynh_backup --src_path="$install_dir"
ynh_backup "$install_dir"
#=================================================
# BACKUP THE DATA DIR
#=================================================
ynh_backup --src_path="$data_dir" --is_big
ynh_backup "$data_dir"
#=================================================
# SYSTEM CONFIGURATION
#=================================================
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
ynh_backup "/etc/php/$php_version/fpm/pool.d/$app.conf"
ynh_backup --src_path="/etc/logrotate.d/$app"
ynh_backup "/etc/logrotate.d/$app"
#=================================================
# 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 "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."

View file

@ -1,14 +1,10 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
ynh_app_setting_set --key=php_memory_limit --value=256M
#=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
@ -19,39 +15,38 @@ timezone="$(cat /etc/timezone)"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..."
ynh_script_progression "Setting up source files..."
# Download, check integrity, uncompress and patch the source from app.src
mkdir -p "$install_dir/tmp"
ynh_setup_source --dest_dir="$install_dir/tmp"
cp -af "$install_dir/tmp/src/." "$install_dir/."
ynh_secure_remove "$install_dir/tmp"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
ynh_safe_rm "$install_dir/tmp"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir"
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Installing system configurations..."
ynh_script_progression "Installing system configurations..."
# Create a dedicated PHP-FPM config
ynh_add_fpm_config
ynh_config_add_phpfpm
# Create a dedicated NGINX config
ynh_add_nginx_config
ynh_config_add_nginx
mkdir -p "/var/log/$app/"
chmod 750 "/var/log/$app/"
chmod -R o-rwx "/var/log/$app/"
chown -R $app:www-data "/var/log/$app/"
#REMOVEME? Assuming ynh_config_add_logrotate is called, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 750 "/var/log/$app/"
#REMOVEME? Assuming ynh_config_add_logrotate is called, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "/var/log/$app/"
#REMOVEME? Assuming ynh_config_add_logrotate is called, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "/var/log/$app/"
ynh_use_logrotate
ynh_config_add_logrotate
#=================================================
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Adding a configuration file..."
ynh_script_progression "Adding $app's configuration..."
# Enable caldav carddav support
if yunohost app list | grep -q 'id: baikal' ; then
@ -73,10 +68,10 @@ if yunohost app list | grep -q 'id: baikal' ; then
imap_server="$domain"
imap_meeting_use_caldav="true"
ynh_add_config --template="backend/config-caldav.php" --destination="$install_dir/backend/caldav/config.php"
ynh_add_config --template="backend/config-carddav.php" --destination="$install_dir/backend/carddav/config.php"
ynh_add_config --template="backend/config-imap.php" --destination="$install_dir/backend/imap/config.php"
ynh_add_config --template="backend/config-combined.php" --destination="$install_dir/backend/combined/config.php"
ynh_config_add --template="backend/config-caldav.php" --destination="$install_dir/backend/caldav/config.php"
ynh_config_add --template="backend/config-carddav.php" --destination="$install_dir/backend/carddav/config.php"
ynh_config_add --template="backend/config-imap.php" --destination="$install_dir/backend/imap/config.php"
ynh_config_add --template="backend/config-combined.php" --destination="$install_dir/backend/combined/config.php"
elif yunohost app list | grep -q 'id: nextcloud' ; then
echo "Detected NextCloud"
@ -97,23 +92,23 @@ elif yunohost app list | grep -q 'id: nextcloud' ; then
imap_server="$domain"
imap_meeting_use_caldav="true"
ynh_add_config --template="backend/config-caldav.php" --destination="$install_dir/backend/caldav/config.php"
ynh_add_config --template="backend/config-carddav.php" --destination="$install_dir/backend/carddav/config.php"
ynh_add_config --template="backend/config-imap.php" --destination="$install_dir/backend/imap/config.php"
ynh_add_config --template="backend/config-combined.php" --destination="$install_dir/backend/combined/config.php"
ynh_config_add --template="backend/config-caldav.php" --destination="$install_dir/backend/caldav/config.php"
ynh_config_add --template="backend/config-carddav.php" --destination="$install_dir/backend/carddav/config.php"
ynh_config_add --template="backend/config-imap.php" --destination="$install_dir/backend/imap/config.php"
ynh_config_add --template="backend/config-combined.php" --destination="$install_dir/backend/combined/config.php"
else
backend="BackendIMAP"
imap_server="$domain"
imap_meeting_use_caldav="false"
ynh_add_config --template="backend/config-imap.php" --destination="$install_dir/backend/imap/config.php"
ynh_config_add --template="backend/config-imap.php" --destination="$install_dir/backend/imap/config.php"
fi
# Copy config
ynh_add_config --template="config.php" --destination="$install_dir/config.php"
ynh_add_config --template="backend/config-autodiscover.php" --destination="$install_dir/autodiscover/config.php"
ynh_add_config --template="backend/config-searchldap.php" --destination="$install_dir/backend/searchldap/config.php"
ynh_config_add --template="config.php" --destination="$install_dir/config.php"
ynh_config_add --template="backend/config-autodiscover.php" --destination="$install_dir/autodiscover/config.php"
ynh_config_add --template="backend/config-searchldap.php" --destination="$install_dir/backend/searchldap/config.php"
#Copy XMLElement.php
ln -s /usr/share/awl/inc/XML* /var/www/$app/include/
@ -122,4 +117,4 @@ ln -s /usr/share/awl/inc/XML* /var/www/$app/include/
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of $app completed" --last
ynh_script_progression "Installation of $app completed"

View file

@ -1,11 +1,5 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
@ -14,19 +8,19 @@ source /usr/share/yunohost/helpers
#=================================================
# REMOVE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Removing logrotate configuration..." --weight=1
ynh_script_progression "Removing logrotate configuration..."
# Remove the app-specific logrotate config
ynh_remove_logrotate
ynh_config_remove_logrotate
# Remove the dedicated NGINX config
ynh_remove_nginx_config
ynh_config_remove_nginx
# Remove the dedicated PHP-FPM config
ynh_remove_fpm_config
ynh_config_remove_phpfpm
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Removal of $app completed" --last
ynh_script_progression "Removal of $app completed"

View file

@ -1,11 +1,5 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
@ -13,50 +7,47 @@ source /usr/share/yunohost/helpers
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring the app main directory..." --weight=1
ynh_script_progression "Restoring the app main directory..."
ynh_restore_file --origin_path="$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
ynh_restore "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir"
#=================================================
# RESTORE THE DATA DIRECTORY
#=================================================
ynh_script_progression --message="Restoring the data directory..." --weight=1
ynh_script_progression "Restoring the data directory..."
ynh_restore_file --origin_path="$data_dir" --not_mandatory
ynh_restore "$data_dir"
chown -R $app:www-data "$data_dir"
#=================================================
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the PHP-FPM configuration..." --weight=1
ynh_script_progression "Restoring the PHP-FPM configuration..."
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
ynh_restore "/etc/php/$php_version/fpm/pool.d/$app.conf"
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
ynh_restore "/etc/logrotate.d/$app"
mkdir -p "/var/log/$app/"
chmod 750 "/var/log/$app/"
chmod -R o-rwx "/var/log/$app/"
chown -R $app:www-data "/var/log/$app/"
#REMOVEME? Assuming ynh_config_add_logrotate is called, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 750 "/var/log/$app/"
#REMOVEME? Assuming ynh_config_add_logrotate is called, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "/var/log/$app/"
#REMOVEME? Assuming ynh_config_add_logrotate is called, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "/var/log/$app/"
#=================================================
# GENERIC FINALIZATION
#=================================================
# RELOAD NGINX AND PHP-FPM
#=================================================
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1
ynh_script_progression "Reloading NGINX web server and PHP-FPM..."
ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
ynh_systemd_action --service_name=nginx --action=reload
ynh_systemctl --service=php$php_version-fpm --action=reload
ynh_systemctl --service=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Restoration completed for $app" --last
ynh_script_progression "Restoration completed for $app"

View file

@ -1,24 +1,16 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# CHECK VERSION
#=================================================
ynh_app_setting_set_default --key=php_memory_limit --value=256M
timezone="$(cat /etc/timezone)"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Upgrading source files..."
ynh_script_progression "Upgrading source files..."
mkdir "$install_dir/bkp"
conf_files_to_keep="config.php backend/caldav/config.php backend/carddav/config.php backend/imap/config.php backend/combined/config.php autodiscover/config.php backend/searchldap/config.php"
@ -35,7 +27,7 @@ timezone="$(cat /etc/timezone)"
mkdir "$install_dir/tmp"
ynh_setup_source --dest_dir="$install_dir/tmp"
cp -af "$install_dir/tmp/src/." "$install_dir/."
ynh_secure_remove --file="$install_dir/tmp"
ynh_safe_rm "$install_dir/tmp"
for file in $conf_files_to_keep
do
@ -44,35 +36,32 @@ timezone="$(cat /etc/timezone)"
cp $install_dir/bkp/$file $install_dir/$file
fi
done
ynh_secure_remove --file="$install_dir/bkp"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
ynh_safe_rm "$install_dir/bkp"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir"
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Installing system configurations..."
ynh_script_progression "Installing system configurations..."
# Create a dedicated PHP-FPM config
ynh_add_fpm_config
ynh_config_add_phpfpm
# Create a dedicated NGINX config
ynh_add_nginx_config
ynh_config_add_nginx
mkdir -p "/var/log/$app/"
chmod 750 "/var/log/$app/"
chmod -R o-rwx "/var/log/$app/"
chown -R $app:www-data "/var/log/$app/"
#REMOVEME? Assuming ynh_config_add_logrotate is called, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 750 "/var/log/$app/"
#REMOVEME? Assuming ynh_config_add_logrotate is called, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "/var/log/$app/"
#REMOVEME? Assuming ynh_config_add_logrotate is called, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "/var/log/$app/"
ynh_use_logrotate --non-append
ynh_config_add_logrotate
#=================================================
# SPECIFIC UPGRADE
#=================================================
# UPDATE A CONFIG FILE
#=================================================
ynh_script_progression --message="Updating a config file..."
ynh_script_progression "Updating a config file..."
# Enable caldav carddav support
if yunohost app list | grep -q 'id: baikal' ; then
@ -94,10 +83,10 @@ if yunohost app list | grep -q 'id: baikal' ; then
imap_server="$domain"
imap_meeting_use_caldav="true"
ynh_add_config --template="backend/config-caldav.php" --destination="$install_dir/backend/caldav/config.php"
ynh_add_config --template="backend/config-carddav.php" --destination="$install_dir/backend/carddav/config.php"
ynh_add_config --template="backend/config-imap.php" --destination="$install_dir/backend/imap/config.php"
ynh_add_config --template="backend/config-combined.php" --destination="$install_dir/backend/combined/config.php"
ynh_config_add --template="backend/config-caldav.php" --destination="$install_dir/backend/caldav/config.php"
ynh_config_add --template="backend/config-carddav.php" --destination="$install_dir/backend/carddav/config.php"
ynh_config_add --template="backend/config-imap.php" --destination="$install_dir/backend/imap/config.php"
ynh_config_add --template="backend/config-combined.php" --destination="$install_dir/backend/combined/config.php"
elif yunohost app list | grep -q 'id: nextcloud' ; then
echo "Detected NextCloud"
@ -118,29 +107,29 @@ elif yunohost app list | grep -q 'id: nextcloud' ; then
imap_server="$domain"
imap_meeting_use_caldav="true"
ynh_add_config --template="backend/config-caldav.php" --destination="$install_dir/backend/caldav/config.php"
ynh_add_config --template="backend/config-carddav.php" --destination="$install_dir/backend/carddav/config.php"
ynh_add_config --template="backend/config-imap.php" --destination="$install_dir/backend/imap/config.php"
ynh_add_config --template="backend/config-combined.php" --destination="$install_dir/backend/combined/config.php"
ynh_config_add --template="backend/config-caldav.php" --destination="$install_dir/backend/caldav/config.php"
ynh_config_add --template="backend/config-carddav.php" --destination="$install_dir/backend/carddav/config.php"
ynh_config_add --template="backend/config-imap.php" --destination="$install_dir/backend/imap/config.php"
ynh_config_add --template="backend/config-combined.php" --destination="$install_dir/backend/combined/config.php"
else
backend="BackendIMAP"
imap_server="$domain"
imap_meeting_use_caldav="false"
ynh_add_config --template="backend/config-imap.php" --destination="$install_dir/backend/imap/config.php"
ynh_config_add --template="backend/config-imap.php" --destination="$install_dir/backend/imap/config.php"
fi
# Copy config
ynh_add_config --template="config.php" --destination="$install_dir/config.php"
ynh_add_config --template="backend/config-autodiscover.php" --destination="$install_dir/autodiscover/config.php"
ynh_add_config --template="backend/config-searchldap.php" --destination="$install_dir/backend/searchldap/config.php"
ynh_config_add --template="config.php" --destination="$install_dir/config.php"
ynh_config_add --template="backend/config-autodiscover.php" --destination="$install_dir/autodiscover/config.php"
ynh_config_add --template="backend/config-searchldap.php" --destination="$install_dir/backend/searchldap/config.php"
# Fixstates to avoid full resync of devices after version upgrades
"php$phpversion" "$install_dir/z-push-admin.php" -a fixstates
"php$php_version" "$install_dir/z-push-admin.php" -a fixstates
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Upgrade of $app completed" --last
ynh_script_progression "Upgrade of $app completed"