1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/elabftw_ynh.git synced 2024-09-03 18:26:23 +02:00

[autopatch] Automatic patch attempt for helpers 2.1

This commit is contained in:
Yunohost-Bot 2024-08-30 22:51:04 +02:00 committed by Alexandre Aubin
parent 0597387f27
commit f1bd85f600
10 changed files with 85 additions and 119 deletions

View file

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

View file

@ -11,7 +11,7 @@ location / {
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;

View file

@ -21,7 +21,8 @@ cpe = "cpe:2.3:a:elabftw:elabftw"
fund = "https://github.com/sponsors/NicolasCARPi"
[integration]
yunohost = ">= 11.2"
yunohost = ">= 11.2.18"
helpers_version = "2.1"
architectures = "all"
multi_instance = true
ldap = true
@ -50,6 +51,7 @@ ram.runtime = "200M"
[resources.system_user]
[resources.install_dir]
group = "www-data:r-x"
[resources.permissions]
main.url = "/"

View file

@ -2,20 +2,8 @@
#!/bin/bash
#=================================================
# COMMON VARIABLES
# COMMON VARIABLES AND CUSTOM HELPERS
#=================================================
nodejs_version=16
YNH_COMPOSER_VERSION="2.2.7"
#=================================================
# PERSONAL HELPERS
#=================================================
#=================================================
# EXPERIMENTAL HELPERS
#=================================================
#=================================================
# FUTURE OFFICIAL HELPERS
#=================================================
composer_version="2.2.7"

View file

@ -7,34 +7,31 @@
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"
#=================================================
# 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"
#=================================================
# BACKUP THE MYSQL DATABASE
#=================================================
ynh_print_info --message="Backing up the MySQL database..."
ynh_print_info "Backing up the MySQL database..."
ynh_mysql_dump_db --database="$db_name" > db.sql
ynh_mysql_dump_db > db.sql
#=================================================
# 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,24 +1,18 @@
#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
ynh_script_progression "Updating NGINX web server configuration..."
# this will most likely adjust NGINX config correctly
ynh_change_url_nginx_config
ynh_config_change_url_nginx
#=================================================
# 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

@ -12,68 +12,67 @@ source /usr/share/yunohost/helpers
#=================================================
secret_key=$(ynh_string_random --length=137)
ynh_app_setting_set --app=$app --key="secret_key" --value="$secret_key"
ynh_app_setting_set --key="secret_key" --value="$secret_key"
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing NodeJS..." --weight=1
ynh_script_progression "Installing NodeJS..."
ynh_install_nodejs --nodejs_version=$nodejs_version
ynh_nodejs_install
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..." --weight=7
ynh_script_progression "Setting up source files..."
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir/sources"
mkdir -p "$install_dir/sources/"{cache,uploads}
chmod -R o-rwx "$install_dir"
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 | 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"
#=================================================
# INSTALL AND INITIALIZE COMPOSER
#=================================================
ynh_script_progression --message="Installing $app with Composer..." --weight=30
ynh_script_progression "Installing $app with Composer..."
pushd "$install_dir/sources"
ynh_install_composer --workdir="$install_dir/sources" --install_args="--no-dev"
ynh_composer_install
ynh_composer_exec install --no-dev # FIXMEhelpers2.1 (replace with composer_workdir=... prior to calling this helper, default is $intall_dir) --workdir="$install_dir/sources" --no-dev
ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" yarn install --pure-lockfile --prod
ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" yarn run buildall
ynh_hide_warnings ynh_exec_as_app node_load_PATH" yarn install --pure-lockfile --prod
ynh_hide_warnings ynh_exec_as_app node_load_PATH" yarn run buildall
ynh_composer_exec --workdir="$install_dir/sources" --commands="install --prefer-dist --no-cache --no-progress --no-dev -a"
ynh_composer_exec # FIXMEhelpers2.1 (replace with composer_workdir=... prior to calling this helper, default is $intall_dir) --workdir="$install_dir/sources" install --prefer-dist --no-cache --no-progress --no-dev -a
ynh_secure_remove node_modules
ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" yarn cache clean
ynh_safe_rm node_modules
ynh_hide_warnings ynh_exec_as_app node_load_PATH" yarn cache clean
ynh_add_config --template="config.php" --destination="$install_dir/sources/config.php"
ynh_exec_as "$app" "php$phpversion" "bin/install" start -q
ynh_config_add --template="config.php" --destination="$install_dir/sources/config.php"
ynh_exec_as_app "php$php_version" "bin/install" start -q
popd
# ynh_script_progression --message="Configuring LDAP and emails..." --weight=2
# ynh_add_config --template="sql.template" --destination="$install_dir/ldap_sql"
# ynh_mysql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" < "$install_dir/ldap_sql"
# ynh_secure_remove --file="$install_dir/ldap_sql"
chmod -R o-rwx "$install_dir"
chown -R "$app:www-data" "$install_dir"
# ynh_script_progression "Configuring LDAP and emails..."
# ynh_config_add --template="sql.template" --destination="$install_dir/ldap_sql"
# ynh_mysql_db_shell < "$install_dir/ldap_sql"
# ynh_safe_rm "$install_dir/ldap_sql"
#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"
#=================================================
# 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 NGINX config
ynh_add_nginx_config
ynh_config_add_nginx
# Create a dedicated PHP-FPM config
ynh_add_fpm_config
ynh_config_add_phpfpm
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of $app completed" --last
ynh_script_progression "Installation of $app completed"

View file

@ -10,24 +10,24 @@ source /usr/share/yunohost/helpers
#=================================================
# REMOVE SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
ynh_script_progression "Removing system configurations related to $app..."
# 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
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing NodeJS..." --weight=1
ynh_script_progression "Removing NodeJS..."
# Remove NodeJS
ynh_remove_nodejs
ynh_nodejs_remove
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Removal of $app completed" --last
ynh_script_progression "Removal of $app completed"

View file

@ -10,51 +10,48 @@ source /usr/share/yunohost/helpers
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Reinstalling NodeJS..." --weight=1
ynh_script_progression "Reinstalling NodeJS..."
ynh_install_nodejs --nodejs_version="$nodejs_version"
ynh_nodejs_install
#=================================================
# 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"
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 | chown -R "$app:www-data" "$install_dir"
#=================================================
# RESTORE THE MYSQL DATABASE
#=================================================
ynh_script_progression --message="Restoring the MySQL database..." --weight=1
ynh_script_progression "Restoring the MySQL database..."
ynh_mysql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" < ./db.sql
ynh_mysql_db_shell < ./db.sql
#=================================================
# RESTORE SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
ynh_script_progression "Restoring system configurations related to $app..."
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf"
# Restore the file first, so it can have a backup if different
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
ynh_restore "/etc/php/$php_version/fpm/pool.d/$app.conf"
# Recreate a dedicated PHP-FPM config
# ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --phpversion=$phpversion
# ynh_config_add_phpfpm
#=================================================
# GENERIC FINALIZATION
#=================================================
# RELOAD NGINX AND PHP-FPM
#=================================================
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..."
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,18 +1,12 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=2
ynh_script_progression "Ensuring downward compatibility..."
# Move sources to subdir
if [ ! -d "$install_dir/sources" ]; then
@ -23,58 +17,57 @@ fi
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Upgrading NodeJS..." --weight=1
ynh_script_progression "Upgrading NodeJS..."
ynh_install_nodejs --nodejs_version=$nodejs_version
ynh_nodejs_install
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Upgrading source files..." --weight=7
ynh_script_progression "Upgrading source files..."
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir/sources" --full_replace=1 --keep="config.php"
ynh_setup_source --dest_dir="$install_dir/sources" --full_replace --keep="config.php"
mkdir -p "$install_dir/sources/"{cache,uploads}
chmod -R o-rwx "$install_dir"
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 | 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"
#=================================================
# INSTALL AND INITIALIZE COMPOSER
#=================================================
ynh_script_progression --message="Building $app with Composer..." --weight=30
ynh_script_progression "Building $app with Composer..."
pushd "$install_dir/sources"
ynh_install_composer --workdir="$install_dir/sources" --install_args="--no-dev"
ynh_composer_install
ynh_composer_exec install --no-dev # FIXMEhelpers2.1 (replace with composer_workdir=... prior to calling this helper, default is $intall_dir) --workdir="$install_dir/sources" --no-dev
ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" yarn install --pure-lockfile --prod
ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" yarn run buildall
ynh_hide_warnings ynh_exec_as_app node_load_PATH" yarn install --pure-lockfile --prod
ynh_hide_warnings ynh_exec_as_app node_load_PATH" yarn run buildall
ynh_composer_exec --workdir="$install_dir/sources" --commands="install --prefer-dist --no-cache --no-progress --no-dev -a"
ynh_composer_exec # FIXMEhelpers2.1 (replace with composer_workdir=... prior to calling this helper, default is $intall_dir) --workdir="$install_dir/sources" install --prefer-dist --no-cache --no-progress --no-dev -a
ynh_secure_remove node_modules
ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" yarn cache clean
ynh_safe_rm node_modules
ynh_hide_warnings ynh_exec_as_app node_load_PATH" yarn cache clean
ynh_exec_as "$app" "php$phpversion" "bin/console" db:update
ynh_exec_as_app "php$php_version" "bin/console" db:update
popd
chmod -R o-rwx "$install_dir"
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 | 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"
#=================================================
# REAPPLY SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
ynh_script_progression "Upgrading system configurations related to $app..."
# Create a dedicated NGINX config
ynh_add_nginx_config
ynh_config_add_nginx
# Create a dedicated PHP-FPM config
ynh_add_fpm_config
ynh_config_add_phpfpm
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Upgrade of $app completed" --last
ynh_script_progression "Upgrade of $app completed"