1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/linkstack_ynh.git synced 2024-09-03 19:36:14 +02:00

[autopatch] Automatic patch attempt for helpers 2.1

This commit is contained in:
Yunohost-Bot 2024-08-31 01:02:04 +02:00 committed by Alexandre Aubin
parent 7395c88938
commit 3be3ad438d
13 changed files with 54 additions and 113 deletions

1
.gitignore vendored
View file

@ -1,2 +1,3 @@
*~ *~
*.sw[op] *.sw[op]
.DS_Store

View file

@ -1,4 +0,0 @@
; Additional php.ini defines, specific to this pool of workers.
php_admin_value[upload_max_filesize] = 10M
php_admin_value[post_max_size] = 10M

View file

@ -13,7 +13,7 @@ location __PATH__/ {
try_files $uri $uri/ /index.php?$query_string; try_files $uri $uri/ /index.php?$query_string;
location ~ [^/]\.php(/|$) { location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.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; fastcgi_index index.php;
include fastcgi_params; include fastcgi_params;

View file

@ -19,7 +19,8 @@ code = "https://github.com/LinkStackOrg/LinkStack"
fund = "https://liberapay.com/LinkStack" fund = "https://liberapay.com/LinkStack"
[integration] [integration]
yunohost = ">= 11.2" yunohost = ">= 11.2.18"
helpers_version = "2.1"
architectures = "all" architectures = "all"
multi_instance = true multi_instance = true
ldap = false ldap = false
@ -77,6 +78,7 @@ ram.runtime = "50M"
# This will provision/deprovision a unix system user # This will provision/deprovision a unix system user
[resources.install_dir] [resources.install_dir]
group = "www-data:r-x"
# This will create/remove the install dir as /var/www/$app # This will create/remove the install dir as /var/www/$app
# and store the corresponding setting $install_dir # and store the corresponding setting $install_dir

View file

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

View file

@ -1,19 +1,10 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts # Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= ynh_print_info "Declaring files to be backed up..."
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
ynh_print_info --message="Declaring files to be backed up..."
### N.B. : the following 'ynh_backup' calls are only a *declaration* of what needs ### N.B. : the following 'ynh_backup' calls are only a *declaration* of what needs
### to be backuped and not an actual copy of any file. The actual backup that ### to be backuped and not an actual copy of any file. The actual backup that
@ -24,22 +15,22 @@ ynh_print_info --message="Declaring files to be backed up..."
# BACKUP THE APP MAIN DIR # BACKUP THE APP MAIN DIR
#================================================= #=================================================
ynh_backup --src_path="$install_dir" ynh_backup "$install_dir"
#================================================= #=================================================
# BACKUP THE NGINX CONFIGURATION # BACKUP THE NGINX CONFIGURATION
#================================================= #=================================================
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# BACKUP THE PHP-FPM CONFIGURATION # BACKUP THE PHP-FPM CONFIGURATION
#================================================= #=================================================
ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" ynh_backup "/etc/php/$php_version/fpm/pool.d/$app.conf"
#================================================= #=================================================
# END OF SCRIPT # 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,22 +1,14 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# STANDARD MODIFICATIONS
#================================================= #=================================================
# MODIFY URL IN NGINX CONF # MODIFY URL IN NGINX CONF
#================================================= #=================================================
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1 ynh_script_progression "Updating NGINX web server configuration..."
ynh_change_url_nginx_config ynh_config_change_url_nginx
#================================================= #=================================================
# SPECIFIC MODIFICATIONS # SPECIFIC MODIFICATIONS
@ -24,8 +16,6 @@ ynh_change_url_nginx_config
# Nothing to do yet... # Nothing to do yet...
#=================================================
# GENERIC FINALISATION
#================================================= #=================================================
# Nothing to do yet... # Nothing to do yet...
@ -34,4 +24,4 @@ ynh_change_url_nginx_config
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Change of URL completed for $app" --last ynh_script_progression "Change of URL completed for $app"

View file

@ -1,14 +1,10 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
ynh_app_setting_set --key=php_upload_max_filesize --value=10M
admin_mail=$(ynh_user_get_info --username="$admin" --key=mail) admin_mail=$(ynh_user_get_info --username="$admin" --key=mail)
admin_fullname=$(ynh_user_get_info --username="$admin" --key=fullname) admin_fullname=$(ynh_user_get_info --username="$admin" --key=fullname)
@ -17,7 +13,7 @@ admin_fullname=$(ynh_user_get_info --username="$admin" --key=fullname)
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
ynh_script_progression --message="Setting up source files..." --weight=1 ynh_script_progression "Setting up source files..."
### `ynh_setup_source` is used to install an app from a zip or tar.gz file, ### `ynh_setup_source` is used to install an app from a zip or tar.gz file,
### downloaded from an upstream source, like a git repository. ### downloaded from an upstream source, like a git repository.
@ -26,22 +22,23 @@ ynh_script_progression --message="Setting up source files..." --weight=1
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir" ynh_setup_source --dest_dir="$install_dir"
# $install_dir will automatically be initialized with some decent # $install_dir will automatically be initialized with some decent
# permission by default ... however, you may need to recursively reapply # permission by default ... however, you may need to recursively reapply
# ownership to all files such as after the ynh_setup_source step # ownership to all files such as after the ynh_setup_source step
chown -R $app:www-data "$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"
chmod o-rwx "$install_dir" -R chmod o-rwx "$install_dir" -R
#================================================= #=================================================
# SYSTEM CONFIGURATION # SYSTEM CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1 ynh_script_progression "Adding system configurations related to $app..."
# Create a dedicated PHP-FPM config using the conf/php-fpm.conf or conf/extra_php-fpm.conf # Create a dedicated PHP-FPM config using the conf/php-fpm.conf or conf/extra_php-fpm.conf
ynh_add_fpm_config --usage=medium --footprint=low ynh_config_add_phpfpm
# Create a dedicated NGINX config using the conf/nginx.conf template # Create a dedicated NGINX config using the conf/nginx.conf template
ynh_add_nginx_config ynh_config_add_nginx
#================================================= #=================================================
# Automated installation process # Automated installation process
@ -70,7 +67,7 @@ User::where('id', '1')->update(['role' => 'admin']);
popd popd
# End of installation # End of installation
ynh_secure_remove $install_dir/INSTALLING ynh_safe_rm $install_dir/INSTALLING
ynh_write_var_in_file --file="$install_dir/.env" --key="APP_DEBUG" --value="false" ynh_write_var_in_file --file="$install_dir/.env" --key="APP_DEBUG" --value="false"
ynh_write_var_in_file --file="$install_dir/.env" --key="APP_ENV" --value="production" ynh_write_var_in_file --file="$install_dir/.env" --key="APP_ENV" --value="production"
ynh_write_var_in_file --file="$install_dir/.env" --key="NOTIFY_UPDATES" --value="false" ynh_write_var_in_file --file="$install_dir/.env" --key="NOTIFY_UPDATES" --value="false"
@ -79,4 +76,4 @@ ynh_write_var_in_file --file="$install_dir/.env" --key="NOTIFY_EVENTS" --value="
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Installation of $app completed" --last ynh_script_progression "Installation of $app completed"

View file

@ -1,27 +1,21 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= #=================================================
# REMOVE SYSTEM CONFIGURATIONS # REMOVE SYSTEM CONFIGURATIONS
#================================================= #=================================================
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1 ynh_script_progression "Removing system configurations related to $app..."
# This should be a symetric version of what happens in the install script # This should be a symetric version of what happens in the install script
ynh_remove_nginx_config ynh_config_remove_nginx
ynh_remove_fpm_config ynh_config_remove_phpfpm
#================================================= #=================================================
# END OF SCRIPT # 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 #!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts # Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
@ -13,40 +7,38 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# RESTORE THE APP MAIN DIR # 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" ynh_restore "$install_dir"
# $install_dir will automatically be initialized with some decent
# $install_dir will automatically be initialized with some decent
# permission by default ... however, you may need to recursively reapply # permission by default ... however, you may need to recursively reapply
# ownership to all files such as after the ynh_setup_source step # ownership to all files such as after the ynh_setup_source step
chown -R $app:www-data "$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 SYSTEM CONFIGURATIONS # RESTORE SYSTEM CONFIGURATIONS
#================================================= #=================================================
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1 ynh_script_progression "Restoring system configurations related to $app..."
# This should be a symetric version of what happens in the install script # This should be a symetric version of what happens in the install script
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"
#=================================================
# GENERIC FINALIZATION
#================================================= #=================================================
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE # RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
#================================================= #=================================================
ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1 ynh_script_progression "Reloading NGINX web server and $app's service..."
# Typically you only have either $app or php-fpm but not both at the same time... # Typically you only have either $app or php-fpm but not both at the same time...
ynh_systemd_action --service_name=php$phpversion-fpm --action=reload ynh_systemctl --service=php$php_version-fpm --action=reload
ynh_systemd_action --service_name=nginx --action=reload ynh_systemctl --service=nginx --action=reload
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Restoration completed for $app" --last ynh_script_progression "Restoration completed for $app"

View file

@ -1,22 +1,14 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
upgrade_type=$(ynh_check_app_version_changed) ynh_app_setting_set_default --key=php_upload_max_filesize --value=10M
#=================================================
# STANDARD UPGRADE STEPS
#================================================= #=================================================
# ENSURE DOWNWARD COMPATIBILITY # ENSURE DOWNWARD COMPATIBILITY
#================================================= #=================================================
#ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 #ynh_script_progression "Ensuring downward compatibility..."
# Nothing to do yet... # Nothing to do yet...
@ -26,25 +18,27 @@ upgrade_type=$(ynh_check_app_version_changed)
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ] # FIXME: this is still supported but the recommendation is now to *always* re-setup the app sources wether or not the upstream sources changed
if ynh_app_upstream_version_changed
then then
# Enable maintenance mode while upgrading # Enable maintenance mode while upgrading
ynh_write_var_in_file --file="$install_dir/.env" --key="MAINTENANCE_MODE" --value="true" ynh_write_var_in_file --file="$install_dir/.env" --key="MAINTENANCE_MODE" --value="true"
ynh_script_progression --message="Upgrading source files..." --weight=1 ynh_script_progression "Upgrading source files..."
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
# Keep .env and database.sqlite ! # Keep .env and database.sqlite !
ynh_setup_source --dest_dir="$install_dir" --keep=".env database/database.sqlite" ynh_setup_source --dest_dir="$install_dir" --keep=".env database/database.sqlite"
# Remove this file as the app is already installed # Remove this file as the app is already installed
ynh_secure_remove $install_dir/INSTALLING ynh_safe_rm $install_dir/INSTALLING
fi fi
# $install_dir will automatically be initialized with some decent # $install_dir will automatically be initialized with some decent
# permission by default ... however, you may need to recursively reapply # permission by default ... however, you may need to recursively reapply
# ownership to all files such as after the ynh_setup_source step # ownership to all files such as after the ynh_setup_source step
chown -R $app:www-data "$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"
chmod o-rwx "$install_dir" -R chmod o-rwx "$install_dir" -R
# Disable maintenance mode # Disable maintenance mode
@ -53,13 +47,13 @@ ynh_write_var_in_file --file="$install_dir/.env" --key="MAINTENANCE_MODE" --valu
#================================================= #=================================================
# REAPPLY SYSTEM CONFIGURATIONS # REAPPLY SYSTEM CONFIGURATIONS
#================================================= #=================================================
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1 ynh_script_progression "Upgrading system configurations related to $app..."
# This should be a literal copypasta of what happened in the install's "System configuration" section # This should be a literal copypasta of what happened in the install's "System configuration" section
ynh_add_fpm_config --usage=medium --footprint=low ynh_config_add_phpfpm
ynh_add_nginx_config ynh_config_add_nginx
#================================================= #=================================================
# RECONFIGURE THE APP (UPDATE CONF, APPLY MIGRATIONS...) # RECONFIGURE THE APP (UPDATE CONF, APPLY MIGRATIONS...)
@ -71,4 +65,4 @@ ynh_add_nginx_config
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Upgrade of $app completed" --last ynh_script_progression "Upgrade of $app completed"

View file

@ -1,2 +0,0 @@
*~
*.sw[op]

View file

@ -1,2 +0,0 @@
*~
*.sw[op]