mirror of
https://github.com/YunoHost-Apps/adminer_ynh.git
synced 2024-09-03 18:06:06 +02:00
helpers_2.1
This commit is contained in:
parent
9588b60dcd
commit
7211ee2349
14 changed files with 45 additions and 222 deletions
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
*~
|
||||||
|
*.sw[op]
|
||||||
|
.DS_Store
|
|
@ -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
|
|
|
@ -12,7 +12,7 @@ location __PATH__/ {
|
||||||
try_files $uri $uri/ index.php;
|
try_files $uri $uri/ index.php;
|
||||||
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;
|
||||||
fastcgi_param REMOTE_USER $remote_user;
|
fastcgi_param REMOTE_USER $remote_user;
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
version = "1.0"
|
|
||||||
|
|
||||||
[main]
|
|
||||||
name = "Adminer configuration"
|
|
||||||
|
|
||||||
[main.php_fpm_config]
|
|
||||||
name = "PHP-FPM configuration"
|
|
||||||
|
|
||||||
[main.php_fpm_config.fpm_footprint]
|
|
||||||
ask = "Memory footprint of the service?"
|
|
||||||
choices = ["low", "medium", "high", "specific"]
|
|
||||||
default = "low"
|
|
||||||
help = "low <= 20Mb per pool. medium between 20Mb and 40Mb per pool. high > 40Mb per pool.<br>Use specific to set a value with the following option."
|
|
||||||
|
|
||||||
[main.php_fpm_config.free_footprint]
|
|
||||||
ask = "Memory footprint of the service?"
|
|
||||||
type = "number"
|
|
||||||
default = "0"
|
|
||||||
help = "Free field to specify exactly the footprint in Mb if you don't want to use one of the three previous values."
|
|
||||||
|
|
||||||
[main.php_fpm_config.fpm_usage]
|
|
||||||
ask = "Expected usage of the service?"
|
|
||||||
choices = ["low", "medium", "high"]
|
|
||||||
default = "low"
|
|
||||||
help = "low: Personal usage, behind the SSO. No RAM footprint when not used, but the impact on the processor can be high if many users are using the service.<br>medium: Low usage, few people or/and publicly accessible. Low RAM footprint, medium processor footprint when used.<br>high: High usage, frequently visited website. High RAM footprint, but lower on processor usage and quickly responding."
|
|
BIN
doc/.DS_Store
vendored
BIN
doc/.DS_Store
vendored
Binary file not shown.
|
@ -16,7 +16,8 @@ demo = "https://demo.adminer.org/adminer.php?username="
|
||||||
code = "https://github.com/adminerevo/adminerevo"
|
code = "https://github.com/adminerevo/adminerevo"
|
||||||
|
|
||||||
[integration]
|
[integration]
|
||||||
yunohost = ">= 11.2.27"
|
yunohost = ">= 11.2.18"
|
||||||
|
helpers_version = "2.1"
|
||||||
architectures = "all"
|
architectures = "all"
|
||||||
multi_instance = true
|
multi_instance = true
|
||||||
|
|
||||||
|
@ -56,6 +57,7 @@ ram.runtime = "50M"
|
||||||
[resources.system_user]
|
[resources.system_user]
|
||||||
|
|
||||||
[resources.install_dir]
|
[resources.install_dir]
|
||||||
|
group = "www-data:r-x"
|
||||||
|
|
||||||
[resources.permissions]
|
[resources.permissions]
|
||||||
main.url = "/"
|
main.url = "/"
|
||||||
|
|
|
@ -1,17 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# COMMON VARIABLES
|
# COMMON VARIABLES AND CUSTOM HELPERS
|
||||||
#=================================================
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# PERSONAL HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# EXPERIMENTAL HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# FUTURE OFFICIAL HELPERS
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -1,18 +1,9 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC START
|
|
||||||
#=================================================
|
|
||||||
# IMPORT GENERIC HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
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..."
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD BACKUP STEPS
|
# STANDARD BACKUP STEPS
|
||||||
|
@ -20,18 +11,18 @@ 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"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SYSTEM CONFIGURATION
|
# 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"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_print_info --message="Backup script completed for Adminer. (YunoHost will then actually copy those files to the archive)."
|
ynh_print_info "Backup script completed for Adminer. (YunoHost will then actually copy those files to the archive)."
|
||||||
|
|
|
@ -1,25 +1,17 @@
|
||||||
#!/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=3
|
ynh_script_progression "Updating NGINX web server configuration..."
|
||||||
|
|
||||||
ynh_change_url_nginx_config
|
ynh_config_change_url_nginx
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# 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"
|
||||||
|
|
|
@ -1,95 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC STARTING
|
|
||||||
#=================================================
|
|
||||||
# IMPORT GENERIC HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
source _common.sh
|
|
||||||
source /usr/share/yunohost/helpers
|
|
||||||
|
|
||||||
ynh_abort_if_errors
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RETRIEVE ARGUMENTS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
|
||||||
current_fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint)
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SPECIFIC GETTERS FOR TOML SHORT KEY
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
get__fpm_footprint() {
|
|
||||||
# Free footprint value for php-fpm
|
|
||||||
# Check if current_fpm_footprint is an integer
|
|
||||||
if [ "$current_fpm_footprint" -eq "$current_fpm_footprint" ] 2> /dev/null
|
|
||||||
then
|
|
||||||
echo "specific"
|
|
||||||
else
|
|
||||||
echo "$current_fpm_footprint"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
get__free_footprint() {
|
|
||||||
# Free footprint value for php-fpm
|
|
||||||
# Check if current_fpm_footprint is an integer
|
|
||||||
if [ "$current_fpm_footprint" -eq "$current_fpm_footprint" ] 2> /dev/null
|
|
||||||
then
|
|
||||||
# If current_fpm_footprint is an integer, that's a numeric value for the footprint
|
|
||||||
echo "$current_fpm_footprint"
|
|
||||||
else
|
|
||||||
echo "0"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SPECIFIC SETTERS FOR TOML SHORT KEYS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
set__fpm_footprint() {
|
|
||||||
if [ "$fpm_footprint" != "specific" ]
|
|
||||||
then
|
|
||||||
ynh_app_setting_set --app=$app --key=fpm_footprint --value="$fpm_footprint"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
set__free_footprint() {
|
|
||||||
if [ "$fpm_footprint" = "specific" ]
|
|
||||||
then
|
|
||||||
ynh_app_setting_set --app=$app --key=fpm_footprint --value="$free_footprint"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC FINALIZATION
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_app_config_validate() {
|
|
||||||
_ynh_app_config_validate
|
|
||||||
|
|
||||||
if [ "${changed[fpm_usage]}" == "true" ] || [ "${changed[fpm_footprint]}" == "true" ] || [ "${changed[free_footprint]}" == "true" ]; then
|
|
||||||
# If fpm_footprint is set to 'specific', use $free_footprint value.
|
|
||||||
if [ "$fpm_footprint" = "specific" ]
|
|
||||||
then
|
|
||||||
fpm_footprint=$free_footprint
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$fpm_footprint" == "0" ]
|
|
||||||
then
|
|
||||||
ynh_print_err --message="When selecting 'specific', you have to set a footprint value into the field below."
|
|
||||||
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
ynh_app_config_apply() {
|
|
||||||
_ynh_app_config_apply
|
|
||||||
|
|
||||||
ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_footprint
|
|
||||||
}
|
|
||||||
|
|
||||||
ynh_app_config_run $1
|
|
|
@ -1,42 +1,35 @@
|
||||||
#!/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
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Setting up source files..." --weight=11
|
ynh_script_progression "Setting up source files..."
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# 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..."
|
||||||
|
|
||||||
# Download, check integrity, uncompress and patch the source from manifest.toml
|
# Download, check integrity, uncompress and patch the source from manifest.toml
|
||||||
ynh_setup_source --dest_dir="$install_dir"
|
ynh_setup_source --dest_dir="$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 | chown -R "$app:www-data" "$install_dir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# 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
|
# Create a dedicated php-fpm config
|
||||||
ynh_add_fpm_config
|
ynh_config_add_phpfpm
|
||||||
|
|
||||||
# Create a dedicated nginx config
|
# Create a dedicated nginx config
|
||||||
ynh_add_nginx_config
|
ynh_config_add_nginx
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Installation of $app completed" --last
|
ynh_script_progression "Installation of $app completed"
|
||||||
|
|
|
@ -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..."
|
||||||
|
|
||||||
# Remove the dedicated nginx config
|
# Remove the dedicated nginx config
|
||||||
ynh_remove_nginx_config
|
ynh_config_remove_nginx
|
||||||
|
|
||||||
# Remove the dedicated php-fpm config
|
# Remove the dedicated php-fpm config
|
||||||
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"
|
||||||
|
|
|
@ -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,34 +7,31 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE APP MAIN DIR
|
# RESTORE THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring $app main directory..." --weight=1
|
ynh_script_progression "Restoring $app main directory..."
|
||||||
|
|
||||||
ynh_restore_file --origin_path="$install_dir"
|
ynh_restore "$install_dir"
|
||||||
|
|
||||||
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"
|
||||||
#=================================================
|
#=================================================
|
||||||
# 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..."
|
||||||
|
|
||||||
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
|
# 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_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"
|
||||||
|
|
|
@ -1,37 +1,30 @@
|
||||||
#!/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
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrading source files..." --weight=1
|
ynh_script_progression "Upgrading source files..."
|
||||||
|
|
||||||
# Download, check integrity, uncompress and patch the source from manifest.toml
|
# Download, check integrity, uncompress and patch the source from manifest.toml
|
||||||
ynh_setup_source --dest_dir="$install_dir" --full_replace=1
|
ynh_setup_source --dest_dir="$install_dir" --full_replace
|
||||||
|
|
||||||
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"
|
||||||
#=================================================
|
#=================================================
|
||||||
# PHP-FPM CONFIGURATION
|
# PHP-FPM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=1
|
ynh_script_progression "Upgrading PHP-FPM configuration..."
|
||||||
|
|
||||||
# Create a dedicated PHP-FPM config
|
# Create a dedicated PHP-FPM config
|
||||||
ynh_add_fpm_config
|
ynh_config_add_phpfpm
|
||||||
|
|
||||||
# Create a dedicated NGINX config
|
# Create a dedicated NGINX config
|
||||||
ynh_add_nginx_config
|
ynh_config_add_nginx
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Upgrade of $app completed" --last
|
ynh_script_progression "Upgrade of $app completed"
|
||||||
|
|
Loading…
Reference in a new issue