Compare commits
4 commits
master
...
helpers-2.
Author | SHA1 | Date | |
---|---|---|---|
|
bbfd053a93 | ||
|
052a5cf96c | ||
|
2128b4bc23 | ||
|
0f3fc48543 |
14 changed files with 211 additions and 248 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,2 +1,4 @@
|
|||
*~
|
||||
*.sw[po]
|
||||
*.sw[op]
|
||||
.DS_Store
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# All available README files by language
|
||||
|
||||
- [Read the README in English](README.md)
|
||||
- [Lea el README en español](README_es.md)
|
||||
- [Irakurri README euskaraz](README_eu.md)
|
||||
- [Lire le README en français](README_fr.md)
|
||||
- [Le o README en galego](README_gl.md)
|
||||
|
|
48
README_es.md
Normal file
48
README_es.md
Normal file
|
@ -0,0 +1,48 @@
|
|||
<!--
|
||||
Este archivo README esta generado automaticamente<https://github.com/YunoHost/apps/tree/master/tools/readme_generator>
|
||||
No se debe editar a mano.
|
||||
-->
|
||||
|
||||
# My Webapp para Yunohost
|
||||
|
||||
[](https://dash.yunohost.org/appci/app/my_webapp)  
|
||||
|
||||
[](https://install-app.yunohost.org/?app=my_webapp)
|
||||
|
||||
*[Leer este README en otros idiomas.](./ALL_README.md)*
|
||||
|
||||
> *Este paquete le permite instalarMy Webapp rapidamente y simplement en un servidor YunoHost.*
|
||||
> *Si no tiene YunoHost, visita [the guide](https://yunohost.org/install) para aprender como instalarla.*
|
||||
|
||||
## Descripción general
|
||||
|
||||
This application allows you to easily install a custom Web application, providing files access with [SFTP](https://yunohost.org/en/filezilla).
|
||||
|
||||
It can also create a MySQL or PostgreSQL database - which will be backed up and restored with your application. The connection details will be stored in the file `db_access.txt` located in the root directory.
|
||||
|
||||
PHP-FPM version can also be selected among `none`, `7.4`, `8.0`, `8.1` and `8.2`.
|
||||
|
||||
**Once installed, go to the chosen URL to know the user, domain and port you will have to use for the SFTP access.** The password is one you chosen during the installation. Under the Web directory, you will see a `www` folder which contains the public files served by this app. You can put all the files of your custom Web application inside.
|
||||
|
||||
You can also customize 404 errors - if you enable the option in the config panel. Simply create an`error` folder in the `www` root directory, containing your custom `html` files.
|
||||
|
||||
**Versión actual:** 1.0~ynh17
|
||||
## Documentaciones y recursos
|
||||
|
||||
- Repositorio del código fuente oficial de la aplicación : <https://github.com/YunoHost-Apps/my_webapp_ynh>
|
||||
- Catálogo YunoHost: <https://apps.yunohost.org/app/my_webapp>
|
||||
- Reportar un error: <https://github.com/YunoHost-Apps/my_webapp_ynh/issues>
|
||||
|
||||
## Información para desarrolladores
|
||||
|
||||
Por favor enviar sus correcciones a la [`branch testing`](https://github.com/YunoHost-Apps/my_webapp_ynh/tree/testing
|
||||
|
||||
Para probar la rama `testing`, sigue asÍ:
|
||||
|
||||
```bash
|
||||
sudo yunohost app install https://github.com/YunoHost-Apps/my_webapp_ynh/tree/testing --debug
|
||||
o
|
||||
sudo yunohost app upgrade my_webapp -u https://github.com/YunoHost-Apps/my_webapp_ynh/tree/testing --debug
|
||||
```
|
||||
|
||||
**Mas informaciones sobre el empaquetado de aplicaciones:** <https://yunohost.org/packaging_apps>
|
|
@ -1,6 +1,4 @@
|
|||
; Additional php.ini defines, specific to this pool of workers.
|
||||
|
||||
php_value[upload_max_filesize] = 500M
|
||||
php_value[post_max_size] = 500M
|
||||
php_value[default_charset] = UTF-8
|
||||
php_value[always_populate_raw_post_data] = -1
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Execute and serve PHP files
|
||||
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;
|
||||
fastcgi_param REMOTE_USER $remote_user;
|
||||
|
|
|
@ -14,7 +14,8 @@ license = "GPL-3.0-only"
|
|||
code = "https://github.com/YunoHost-Apps/my_webapp_ynh"
|
||||
|
||||
[integration]
|
||||
yunohost = ">= 11.2.4"
|
||||
yunohost = ">= 11.2.16"
|
||||
helpers_version = "2.1"
|
||||
architectures = "all"
|
||||
multi_instance = true
|
||||
ldap = "not_relevant"
|
||||
|
|
|
@ -1,11 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# COMMON VARIABLES
|
||||
#=================================================
|
||||
|
||||
#=================================================
|
||||
# EXPERIMENTAL HELPERS
|
||||
# COMMON VARIABLES AND CUSTOM HELPERS
|
||||
#=================================================
|
||||
|
||||
ynh_maintenance_mode_ON () {
|
||||
|
@ -87,7 +83,6 @@ ynh_maintenance_mode_OFF () {
|
|||
systemctl reload nginx
|
||||
}
|
||||
|
||||
|
||||
ynh_system_user_add_group() {
|
||||
# Declare an array to define the options of this helper.
|
||||
local legacy_args=uhs
|
||||
|
@ -105,7 +100,6 @@ ynh_system_user_add_group() {
|
|||
done
|
||||
}
|
||||
|
||||
|
||||
ynh_system_user_del_group() {
|
||||
# Declare an array to define the options of this helper.
|
||||
local legacy_args=uhs
|
||||
|
|
|
@ -1,39 +1,30 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
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 NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.d"
|
||||
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.d"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
if [ $phpversion != "none" ]
|
||||
if [ $php_version != "none" ]
|
||||
then
|
||||
ynh_backup --src_path="/etc/php/${phpversion}/fpm/pool.d/$app.conf"
|
||||
ynh_backup "/etc/php/${php_version}/fpm/pool.d/$app.conf"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
@ -42,12 +33,12 @@ fi
|
|||
|
||||
if [ $database != "none" ]
|
||||
then
|
||||
ynh_print_info --message="Backing up the database..."
|
||||
ynh_print_info "Backing up the database..."
|
||||
|
||||
if [ $database == "mysql" ]; then
|
||||
ynh_mysql_dump_db --database="$db_name" > db.sql*
|
||||
ynh_mysql_dump_db > db.sql*
|
||||
elif [ $database == "postgresql" ]; then
|
||||
ynh_psql_dump_db --database="$db_name" > db.sql
|
||||
ynh_psql_dump_db > db.sql
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -55,4 +46,4 @@ fi
|
|||
# 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)."
|
||||
|
|
|
@ -1,27 +1,21 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC STARTING
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=5
|
||||
ynh_script_progression "Backing up the app before changing its URL (may take a while)..."
|
||||
|
||||
# Backup the current version of the app
|
||||
ynh_clean_setup () {
|
||||
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
|
||||
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.d"
|
||||
ynh_safe_rm "/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||
ynh_safe_rm "/etc/nginx/conf.d/$new_domain.d/$app.d"
|
||||
|
||||
# restore it if the upgrade fails
|
||||
ynh_restore_upgradebackup
|
||||
#REMOVEME? ynh_restore_upgradebackup
|
||||
}
|
||||
|
||||
#=================================================
|
||||
|
@ -32,22 +26,20 @@ path_url=$old_path
|
|||
domain=$old_domain
|
||||
ynh_maintenance_mode_ON
|
||||
|
||||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
#=================================================
|
||||
# MODIFY URL IN NGINX CONF
|
||||
#=================================================
|
||||
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=2
|
||||
ynh_script_progression "Updating NGINX web server configuration..."
|
||||
|
||||
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
||||
nginx_extra_conf_dir=/etc/nginx/conf.d/$old_domain.d/$app.d
|
||||
|
||||
# Change the path in the NGINX config file
|
||||
if [ $change_path -eq 1 ]
|
||||
ynh_print_info --message="Change the path in the Nginx config file"
|
||||
ynh_print_info "Change the path in the Nginx config file"
|
||||
then
|
||||
# Make a backup of the original NGINX config file if modified
|
||||
ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
|
||||
ynh_backup_if_checksum_is_different "$nginx_conf_path"
|
||||
|
||||
# Set global variables for NGINX helper
|
||||
domain="$old_domain"
|
||||
|
@ -56,33 +48,33 @@ then
|
|||
# Update custom error file path if needed
|
||||
if [ $custom_error_file -eq 1 ]
|
||||
then
|
||||
ynh_add_config --template="nginx-code-error.conf" --destination="$nginx_extra_conf_dir/error-code.conf"
|
||||
ynh_config_add --template="nginx-code-error.conf" --destination="$nginx_extra_conf_dir/error-code.conf"
|
||||
fi
|
||||
|
||||
# Create a dedicated NGINX configssh
|
||||
ynh_add_nginx_config
|
||||
ynh_config_add_nginx
|
||||
fi
|
||||
|
||||
# Change the domain for NGINX
|
||||
if [ $change_domain -eq 1 ]
|
||||
then
|
||||
# Delete file checksum for the old conf file location
|
||||
ynh_delete_file_checksum --file="$nginx_conf_path"
|
||||
ynh_delete_file_checksum --file="$nginx_extra_conf_dir/php.conf"
|
||||
#ynh_delete_file_checksum --file="$nginx_extra_conf_dir/nginx-code-error.conf"
|
||||
ynh_delete_file_checksum "$nginx_conf_path"
|
||||
ynh_delete_file_checksum "$nginx_extra_conf_dir/php.conf"
|
||||
#ynh_delete_file_checksum "$nginx_extra_conf_dir/nginx-code-error.conf"
|
||||
|
||||
path_url="$new_path"
|
||||
domain="$old_domain"
|
||||
ynh_remove_nginx_config
|
||||
ynh_config_remove_nginx
|
||||
|
||||
domain="$new_domain"
|
||||
ynh_add_nginx_config
|
||||
ynh_config_add_nginx
|
||||
|
||||
mv $nginx_extra_conf_dir /etc/nginx/conf.d/$new_domain.d/$app.d
|
||||
|
||||
# Store file checksum for the new config file location
|
||||
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.d/php.conf"
|
||||
#ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.d/nginx-code-error.conf"
|
||||
ynh_store_file_checksum "/etc/nginx/conf.d/$new_domain.d/$app.d/php.conf"
|
||||
#ynh_store_file_checksum "/etc/nginx/conf.d/$new_domain.d/$app.d/nginx-code-error.conf"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
@ -97,4 +89,4 @@ ynh_maintenance_mode_OFF
|
|||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Change of URL completed for $app" --last
|
||||
ynh_script_progression "Change of URL completed for $app"
|
||||
|
|
|
@ -1,11 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC STARTING
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
|
@ -15,13 +9,13 @@ ynh_abort_if_errors
|
|||
# RETRIEVE ARGUMENTS
|
||||
#=================================================
|
||||
|
||||
install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
path=$(ynh_app_setting_get --app=$app --key=path)
|
||||
install_dir=$(ynh_app_setting_get --key=install_dir)
|
||||
domain=$(ynh_app_setting_get --key=domain)
|
||||
path=$(ynh_app_setting_get --key=path)
|
||||
|
||||
current_fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint)
|
||||
fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint)
|
||||
fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage)
|
||||
current_fpm_footprint=$(ynh_app_setting_get --key=fpm_footprint)
|
||||
# REMOVEME ? Everything about fpm_footprint is removed in helpers2.1... | fpm_footprint=$(ynh_app_setting_get --key=fpm_footprint)
|
||||
# REMOVEME ? Everything about fpm_usage is removed in helpers2.1... | fpm_usage=$(ynh_app_setting_get --key=fpm_usage)
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC GETTERS FOR TOML SHORT KEY
|
||||
|
@ -61,26 +55,24 @@ get__free_footprint() {
|
|||
set__password() {
|
||||
if [ "$password" == "" ]
|
||||
then
|
||||
ynh_app_setting_set --app=$app --key=password --value="$password"
|
||||
ynh_app_setting_set --key=password --value="$password"
|
||||
fi
|
||||
}
|
||||
|
||||
set__fpm_footprint() {
|
||||
if [ "$fpm_footprint" != "specific" ]
|
||||
# REMOVEME ? Everything about fpm_footprint is removed in helpers2.1... | set__fpm_footprint() {
|
||||
# REMOVEME ? Everything about fpm_footprint is removed in helpers2.1... | if [ "$fpm_footprint" != "specific" ]
|
||||
then
|
||||
ynh_app_setting_set --app=$app --key=fpm_footprint --value="$fpm_footprint"
|
||||
# REMOVEME ? Everything about fpm_footprint is removed in helpers2.1... | ynh_app_setting_set --key=fpm_footprint --value="$fpm_footprint"
|
||||
fi
|
||||
}
|
||||
|
||||
set__fpm_free_footprint() {
|
||||
if [ "$fpm_footprint" = "specific" ]
|
||||
# REMOVEME ? Everything about fpm_free_footprint is removed in helpers2.1... | set__fpm_free_footprint() {
|
||||
# REMOVEME ? Everything about fpm_footprint is removed in helpers2.1... | if [ "$fpm_footprint" = "specific" ]
|
||||
then
|
||||
ynh_app_setting_set --app=$app --key=fpm_footprint --value="$fpm_free_footprint"
|
||||
# REMOVEME ? Everything about fpm_free_footprint is removed in helpers2.1... | ynh_app_setting_set --key=fpm_footprint --value="$fpm_free_footprint"
|
||||
fi
|
||||
}
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
|
||||
ynh_app_config_validate() {
|
||||
|
@ -88,19 +80,19 @@ ynh_app_config_validate() {
|
|||
|
||||
if [ "${changed[with_sftp]}" == "true" ] && [ $with_sftp -eq 1 ] && [ "$password" == "" ]
|
||||
then
|
||||
ynh_die --message="You need to set a password to enable SFTP"
|
||||
ynh_die "You need to set a password to enable SFTP"
|
||||
fi
|
||||
|
||||
if [ "${changed[fpm_usage]}" == "true" ] || [ "${changed[fpm_footprint]}" == "true" ] || [ "${changed[fpm_free_footprint]}" == "true" ]; then
|
||||
# If fpm_footprint is set to 'specific', use $fpm_free_footprint value.
|
||||
if [ "$fpm_footprint" = "specific" ]
|
||||
# REMOVEME ? Everything about fpm_free_footprint is removed in helpers2.1... | # If fpm_footprint is set to 'specific', use $fpm_free_footprint value.
|
||||
# REMOVEME ? Everything about fpm_footprint is removed in helpers2.1... | if [ "$fpm_footprint" = "specific" ]
|
||||
then
|
||||
fpm_footprint=$fpm_free_footprint
|
||||
# REMOVEME ? Everything about fpm_free_footprint is removed in helpers2.1... | fpm_footprint=$fpm_free_footprint
|
||||
fi
|
||||
|
||||
if [ "$fpm_footprint" == "0" ]
|
||||
# REMOVEME ? Everything about fpm_footprint is removed in helpers2.1... | if [ "$fpm_footprint" == "0" ]
|
||||
then
|
||||
ynh_print_err --message="When selecting 'specific', you have to set a footprint value into the field below."
|
||||
ynh_print_warn "When selecting 'specific', you have to set a footprint value into the field below."
|
||||
|
||||
exit 0
|
||||
fi
|
||||
|
@ -110,32 +102,32 @@ ynh_app_config_validate() {
|
|||
ynh_app_config_apply() {
|
||||
_ynh_app_config_apply
|
||||
|
||||
if [ "${changed[phpversion]}" == "true" ]
|
||||
if [ "${changed[php_version]}" == "true" ]
|
||||
then
|
||||
ynh_app_setting_set --app=$app --key=phpversion --value="${old[phpversion]}"
|
||||
ynh_remove_fpm_config
|
||||
ynh_remove_app_dependencies
|
||||
YNH_PHP_VERSION=$phpversion
|
||||
# ^ ynh_add_config replaces __PHPVERSION__ by __PHP_YNH_VERSION__...
|
||||
ynh_app_setting_set --app=$app --key=phpversion --value="$phpversion"
|
||||
ynh_app_setting_set --key=php_version --value="${old[php_version]}"
|
||||
ynh_config_remove_phpfpm
|
||||
ynh_apt_remove_dependencies
|
||||
YNH_PHP_VERSION=$php_version
|
||||
# ^ ynh_config_add replaces __PHP_VERSION__ by __PHP_YNH_VERSION__...
|
||||
ynh_app_setting_set --key=php_version --value="$php_version"
|
||||
|
||||
nginx_extra_conf_dir="/etc/nginx/conf.d/$domain.d/$app.d"
|
||||
mkdir -p "$nginx_extra_conf_dir"
|
||||
if [ "$phpversion" == "none" ]
|
||||
if [ "$php_version" == "none" ]
|
||||
then
|
||||
ynh_delete_file_checksum --file="$nginx_extra_conf_dir/php.conf"
|
||||
ynh_secure_remove --file="$nginx_extra_conf_dir/php.conf"
|
||||
ynh_delete_file_checksum "$nginx_extra_conf_dir/php.conf"
|
||||
ynh_safe_rm "$nginx_extra_conf_dir/php.conf"
|
||||
else
|
||||
ynh_add_config --template="nginx-php.conf" --destination="$nginx_extra_conf_dir/php.conf"
|
||||
database=$(ynh_app_setting_get --app=$app --key=database)
|
||||
ynh_config_add --template="nginx-php.conf" --destination="$nginx_extra_conf_dir/php.conf"
|
||||
database=$(ynh_app_setting_get --key=database)
|
||||
dependencies="$(ynh_read_manifest -k "resources.apt.packages")"
|
||||
dependencies_from_raw_bash=$(eval "$(ynh_read_manifest -k "resources.apt.packages_from_raw_bash")" | tr "\n" " ")
|
||||
ynh_install_app_dependencies "$dependencies $dependencies_from_raw_bash"
|
||||
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --phpversion=$phpversion
|
||||
# ^ the helper takes care of ynh_app_setting_set the phpversion
|
||||
ynh_apt_install_dependencies "$dependencies $dependencies_from_raw_bash"
|
||||
ynh_config_add_phpfpm
|
||||
# ^ the helper takes care of ynh_app_setting_set the php_version
|
||||
fi
|
||||
|
||||
ynh_add_nginx_config
|
||||
ynh_config_add_nginx
|
||||
fi
|
||||
|
||||
if [ "${changed[with_sftp]}" == "true" ] && [ $with_sftp -eq 1 ]
|
||||
|
@ -158,17 +150,17 @@ ynh_app_config_apply() {
|
|||
|
||||
if [ $custom_error_file -eq 1 ]
|
||||
then
|
||||
ynh_add_config --template="nginx-code-error.conf" --destination="$nginx_extra_conf_dir/error-code.conf"
|
||||
ynh_config_add --template="nginx-code-error.conf" --destination="$nginx_extra_conf_dir/error-code.conf"
|
||||
elif [ $custom_error_file -eq 0 ]
|
||||
then
|
||||
ynh_secure_remove --file="$nginx_extra_conf_dir/error-code.conf"
|
||||
ynh_safe_rm "$nginx_extra_conf_dir/error-code.conf"
|
||||
fi
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
ynh_systemctl --service=nginx --action=reload
|
||||
fi
|
||||
|
||||
if [ "$phpversion" != "none" ]
|
||||
if [ "$php_version" != "none" ]
|
||||
then
|
||||
ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_footprint
|
||||
ynh_config_add_phpfpm
|
||||
fi
|
||||
|
||||
}
|
||||
|
|
|
@ -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_upload_max_filesize --value=500M
|
||||
|
||||
#=================================================
|
||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||
#=================================================
|
||||
|
@ -20,66 +16,65 @@ ssh_port=$(grep "^Port" /etc/ssh/sshd_config | awk '{print $2}')
|
|||
#=================================================
|
||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Validating installation parameters..." --weight=2
|
||||
ynh_script_progression "Validating installation parameters..."
|
||||
|
||||
[ $with_sftp -eq 0 ] || [ "$password" != "" ] || ynh_die --message="You need to set a password to enable SFTP"
|
||||
[ $with_sftp -eq 0 ] || [ "$password" != "" ] || ynh_die "You need to set a password to enable SFTP"
|
||||
|
||||
#=================================================
|
||||
# STORE SETTINGS FROM MANIFEST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Storing installation settings..." --weight=1
|
||||
ynh_script_progression "Storing installation settings..."
|
||||
|
||||
ynh_app_setting_set --app=$app --key=password --value=$password
|
||||
ynh_app_setting_set --key=password --value=$password
|
||||
|
||||
#=================================================
|
||||
# CREATE A MYSQL DATABASE
|
||||
#=================================================
|
||||
|
||||
if [ $database != "none" ]; then
|
||||
ynh_script_progression --message="Creating a database..." --weight=2
|
||||
ynh_script_progression "Creating a database..."
|
||||
|
||||
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
||||
db_user=$db_name
|
||||
db_pwd=$(ynh_string_random --length=30)
|
||||
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||
ynh_app_setting_set --app=$app --key=db_user --value=$db_user
|
||||
ynh_app_setting_set --app=$app --key=db_pwd --value=$db_pwd
|
||||
ynh_app_setting_set --key=db_name --value=$db_name
|
||||
ynh_app_setting_set --key=db_user --value=$db_user
|
||||
ynh_app_setting_set --key=db_pwd --value=$db_pwd
|
||||
|
||||
if [ $database == "mysql" ]; then
|
||||
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
||||
# FIXME ynh_mysql_create_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
||||
elif [ $database == "postgresql" ]; then
|
||||
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
||||
# FIXME ynh_psql_create_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
||||
fi
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring NGINX web server..." --weight=2
|
||||
ynh_script_progression "Configuring NGINX web server..."
|
||||
|
||||
nginx_extra_conf_dir="/etc/nginx/conf.d/$domain.d/$app.d"
|
||||
mkdir -p "$nginx_extra_conf_dir"
|
||||
|
||||
# Prepare nginx extra conf
|
||||
if [ $phpversion != "none" ]
|
||||
if [ $php_version != "none" ]
|
||||
then
|
||||
ynh_add_config --template="nginx-php.conf" --destination="$nginx_extra_conf_dir/php.conf"
|
||||
YNH_PHP_VERSION="$phpversion"
|
||||
ynh_config_add --template="nginx-php.conf" --destination="$nginx_extra_conf_dir/php.conf"
|
||||
YNH_PHP_VERSION="$php_version"
|
||||
fi
|
||||
|
||||
# Add the custom error build with the application
|
||||
ynh_add_config --template="nginx-code-error.conf" --destination="$nginx_extra_conf_dir/error-code.conf"
|
||||
ynh_app_setting_set --app=$app --key=custom_error_file --value="true"
|
||||
|
||||
ynh_config_add --template="nginx-code-error.conf" --destination="$nginx_extra_conf_dir/error-code.conf"
|
||||
ynh_app_setting_set --key=custom_error_file --value="true"
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
ynh_add_config --template="example-custom-nginx-config.conf" --destination="$nginx_extra_conf_dir/sample.conf"
|
||||
ynh_config_add_nginx
|
||||
ynh_config_add --template="example-custom-nginx-config.conf" --destination="$nginx_extra_conf_dir/sample.conf"
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring system user..."
|
||||
ynh_script_progression "Configuring system user..."
|
||||
|
||||
if [ $with_sftp -eq 1 ]
|
||||
then
|
||||
|
@ -106,9 +101,9 @@ mkdir -p "$install_dir/www"
|
|||
|
||||
if [ $with_sftp -eq 1 ]
|
||||
then
|
||||
ynh_add_config --template="../sources/www/index.html" --destination="$install_dir/www/index.html"
|
||||
ynh_config_add --template="../sources/www/index.html" --destination="$install_dir/www/index.html"
|
||||
else
|
||||
ynh_add_config --template="../sources/www/index_no_sftp.html" --destination="$install_dir/www/index.html"
|
||||
ynh_config_add --template="../sources/www/index_no_sftp.html" --destination="$install_dir/www/index.html"
|
||||
fi
|
||||
|
||||
chown -R $app:www-data "$install_dir"
|
||||
|
@ -123,24 +118,15 @@ chmod 750 "$install_dir"
|
|||
# PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
fpm_footprint="low"
|
||||
fpm_free_footprint=0
|
||||
fpm_usage="low"
|
||||
|
||||
ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint
|
||||
ynh_app_setting_set --app=$app --key=fpm_free_footprint --value=$fpm_free_footprint
|
||||
ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage
|
||||
|
||||
if [ $phpversion != "none" ]
|
||||
if [ $php_version != "none" ]
|
||||
then
|
||||
ynh_script_progression --message="Configuring PHP-FPM..." --weight=2
|
||||
ynh_script_progression "Configuring PHP-FPM..."
|
||||
|
||||
# Create a dedicatedPHP-FPM config
|
||||
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --phpversion=$phpversion
|
||||
ynh_config_add_phpfpm
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Installation of $app completed" --last
|
||||
ynh_script_progression "Installation of $app completed"
|
||||
|
|
|
@ -1,11 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
|
@ -16,38 +10,38 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
|
||||
if [ $database != "none" ]; then
|
||||
ynh_script_progression --message="Removing the database..." --weight=2
|
||||
ynh_script_progression "Removing the database..."
|
||||
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_name=$(ynh_app_setting_get --key=db_name)
|
||||
db_user=$db_name
|
||||
|
||||
# Remove a database if it exists, along with the associated user
|
||||
if [ $database == "mysql" ]; then
|
||||
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
|
||||
# FIXME ynh_mysql_drop_db && ynh_mysql_drop_user --db_user=$db_user --db_name=$db_name
|
||||
elif [ $database == "postgresql" ]; then
|
||||
ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
|
||||
# FIXME ynh_psql_drop_db && ynh_psql_drop_user --db_user=$db_user --db_name=$db_name
|
||||
fi
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# REMOVE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=2
|
||||
ynh_script_progression "Removing NGINX web server configuration..."
|
||||
|
||||
# Remove the dedicated NGINX config
|
||||
ynh_remove_nginx_config
|
||||
ynh_secure_remove --file="/etc/nginx/conf.d/$domain.d/$app.d"
|
||||
ynh_config_remove_nginx
|
||||
ynh_safe_rm "/etc/nginx/conf.d/$domain.d/$app.d"
|
||||
|
||||
#=================================================
|
||||
# REMOVE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing PHP-FPM configuration..."
|
||||
ynh_script_progression "Removing PHP-FPM configuration..."
|
||||
|
||||
# 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"
|
||||
|
|
|
@ -1,11 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
|
@ -13,33 +7,33 @@ source /usr/share/yunohost/helpers
|
|||
# RESTORE THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.d/"
|
||||
ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
ynh_restore "/etc/nginx/conf.d/$domain.d/$app.d/"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE MYSQL DATABASE
|
||||
#=================================================
|
||||
|
||||
if [ $database != "none" ]; then
|
||||
ynh_script_progression --message="Restoring the database..."
|
||||
ynh_script_progression "Restoring the database..."
|
||||
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_name=$(ynh_app_setting_get --key=db_name)
|
||||
db_user=$db_name
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
|
||||
db_pwd=$(ynh_app_setting_get --key=db_pwd)
|
||||
|
||||
if [ $database == "mysql" ]; then
|
||||
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
||||
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
|
||||
# FIXME ynh_mysql_create_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
||||
ynh_mysql_db_shell < ./db.sql
|
||||
elif [ $database == "postgresql" ]; then
|
||||
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
||||
ynh_psql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
|
||||
# FIXME ynh_psql_create_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
||||
ynh_psql_db_shell < ./db.sql
|
||||
fi
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# RECREATE THE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Recreating the dedicated system user..." --weight=2
|
||||
ynh_script_progression "Recreating the dedicated system user..."
|
||||
|
||||
if [ $with_sftp -eq 1 ]
|
||||
then
|
||||
|
@ -59,9 +53,9 @@ fi
|
|||
#=================================================
|
||||
# RESTORE THE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the app main directory..."
|
||||
ynh_script_progression "Restoring the app main directory..."
|
||||
|
||||
ynh_restore_file --origin_path="$install_dir"
|
||||
ynh_restore "$install_dir"
|
||||
|
||||
# Restore permissions on app files
|
||||
chown -R $app:www-data "$install_dir"
|
||||
|
@ -76,27 +70,25 @@ chmod 750 "$install_dir"
|
|||
# RESTORE THE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
if [ $phpversion != "none" ]
|
||||
if [ $php_version != "none" ]
|
||||
then
|
||||
ynh_restore_file --origin_path="/etc/php/${phpversion}/fpm/pool.d/$app.conf"
|
||||
ynh_restore "/etc/php/${php_version}/fpm/pool.d/$app.conf"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# RELOAD NGINX AND PHP-FPM
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..."
|
||||
ynh_script_progression "Reloading NGINX web server and PHP-FPM..."
|
||||
|
||||
if [ $phpversion != "none" ]
|
||||
if [ $php_version != "none" ]
|
||||
then
|
||||
ynh_systemd_action --service_name=php${phpversion}-fpm --action=reload
|
||||
ynh_systemctl --service=php${php_version}-fpm --action=reload
|
||||
fi
|
||||
|
||||
ynh_systemd_action --service_name=nginx --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"
|
||||
|
|
|
@ -1,24 +1,14 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# CHECK VERSION
|
||||
#=================================================
|
||||
|
||||
upgrade_type=$(ynh_check_app_version_changed)
|
||||
ynh_app_setting_set_default --key=php_upload_max_filesize --value=500M
|
||||
|
||||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Ensuring downward compatibility..."
|
||||
ynh_script_progression "Ensuring downward compatibility..."
|
||||
|
||||
# If database doesn't exist, create it and remove with_mysql setting
|
||||
if [ -z "${database:-}" ]; then
|
||||
|
@ -28,62 +18,47 @@ if [ -z "${database:-}" ]; then
|
|||
database="none"
|
||||
fi
|
||||
|
||||
ynh_app_setting_set --app=$app --key=database --value=$database
|
||||
ynh_app_setting_delete --app=$app --key=with_mysql
|
||||
ynh_app_setting_set --key=database --value=$database
|
||||
ynh_app_setting_delete --key=with_mysql
|
||||
fi
|
||||
|
||||
# If admin_mail_html doesn't exist, create it
|
||||
# FIXME: maybe replace with: ynh_app_setting_set_default --key=admin_mail_html --value=1
|
||||
if [ -z "${admin_mail_html:-}" ]; then
|
||||
admin_mail_html=1
|
||||
ynh_app_setting_set --app=$app --key=admin_mail_html --value=$admin_mail_html
|
||||
fi
|
||||
|
||||
# If fpm_footprint doesn't exist, create it
|
||||
if [ -z "${fpm_footprint:-}" ]; then
|
||||
fpm_footprint=low
|
||||
ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint
|
||||
fi
|
||||
|
||||
# If fpm_free_footprint doesn't exist, create it
|
||||
if [ -z "${fpm_free_footprint:-}" ]; then
|
||||
fpm_free_footprint=0
|
||||
ynh_app_setting_set --app=$app --key=fpm_free_footprint --value=$fpm_free_footprint
|
||||
fi
|
||||
|
||||
# If fpm_usage doesn't exist, create it
|
||||
if [ -z "${fpm_usage:-}" ]; then
|
||||
fpm_usage=low
|
||||
ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage
|
||||
ynh_app_setting_set --key=admin_mail_html --value=$admin_mail_html
|
||||
fi
|
||||
|
||||
# If with_sftp doesn't exist, create it
|
||||
# FIXME: maybe replace with: ynh_app_setting_set_default --key=with_sftp --value=1
|
||||
if [ -z "${with_sftp:-}" ]; then
|
||||
with_sftp=1
|
||||
ynh_app_setting_set --app=$app --key=with_sftp --value=$with_sftp
|
||||
ynh_app_setting_set --key=with_sftp --value=$with_sftp
|
||||
fi
|
||||
|
||||
# If phpversion doesn't exist, create it. We assume it is the default system one.
|
||||
if [ -z "$phpversion" ]; then
|
||||
phpversion=$YNH_DEFAULT_PHP_VERSION
|
||||
ynh_app_setting_set --app=$app --key=phpversion --value=$phpversion
|
||||
# If php_version doesn't exist, create it. We assume it is the default system one.
|
||||
if [ -z "$php_version" ]; then
|
||||
php_version=$YNH_DEFAULT_PHP_VERSION
|
||||
ynh_app_setting_set --key=php_version --value=$php_version
|
||||
fi
|
||||
|
||||
# If custom_error_file doesn't exist, create it.
|
||||
# FIXME: maybe replace with: ynh_app_setting_set_default --key=custom_error_file --value=1
|
||||
if [ -z "${custom_error_file:-}" ]; then
|
||||
custom_error_file=1
|
||||
ynh_app_setting_set --app=$app --key=custom_error_file --value=$custom_error_file
|
||||
ynh_app_setting_set --key=custom_error_file --value=$custom_error_file
|
||||
fi
|
||||
|
||||
# Delete old user
|
||||
if [ -n "$(ynh_app_setting_get --app=$app --key=user)" ]
|
||||
if [ -n "$(ynh_app_setting_get --key=user)" ]
|
||||
then
|
||||
ynh_systemd_action --service_name=php${phpversion}-fpm --action=stop
|
||||
ynh_system_user_delete --username="$(ynh_app_setting_get --app=$app --key=user)"
|
||||
ynh_app_setting_delete --app=$app --key=user
|
||||
ynh_systemctl --service=php${php_version}-fpm --action=stop
|
||||
ynh_system_user_delete --username="$(ynh_app_setting_get --key=user)"
|
||||
ynh_app_setting_delete --key=user
|
||||
fi
|
||||
|
||||
# Ensure password is a setting even if empty, for the config panel
|
||||
ynh_app_setting_set --app=$app --key=password --value="$password"
|
||||
ynh_app_setting_set --key=password --value="$password"
|
||||
|
||||
#=================================================
|
||||
# ACTIVATE MAINTENANCE MODE
|
||||
|
@ -94,7 +69,7 @@ ynh_maintenance_mode_ON
|
|||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2
|
||||
ynh_script_progression "Upgrading NGINX web server configuration..."
|
||||
|
||||
# Prepare nginx.conf
|
||||
nginx_extra_conf_dir="/etc/nginx/conf.d/$domain.d/$app.d"
|
||||
|
@ -102,26 +77,26 @@ nginx_extra_conf_dir="/etc/nginx/conf.d/$domain.d/$app.d"
|
|||
mkdir -p "$nginx_extra_conf_dir"
|
||||
|
||||
# Prepare nginx extra conf
|
||||
if [ $phpversion != "none" ]
|
||||
if [ $php_version != "none" ]
|
||||
then
|
||||
ynh_add_config --template="nginx-php.conf" --destination="$nginx_extra_conf_dir/php.conf"
|
||||
YNH_PHP_VERSION="$phpversion"
|
||||
ynh_config_add --template="nginx-php.conf" --destination="$nginx_extra_conf_dir/php.conf"
|
||||
YNH_PHP_VERSION="$php_version"
|
||||
fi
|
||||
|
||||
# Add the config error code
|
||||
if [ $custom_error_file -eq 1 ]
|
||||
then
|
||||
ynh_add_config --template="nginx-code-error.conf" --destination="$nginx_extra_conf_dir/error-code.conf"
|
||||
ynh_config_add --template="nginx-code-error.conf" --destination="$nginx_extra_conf_dir/error-code.conf"
|
||||
fi
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
ynh_add_config --template="example-custom-nginx-config.conf" --destination="$nginx_extra_conf_dir/sample.conf"
|
||||
ynh_config_add_nginx
|
||||
ynh_config_add --template="example-custom-nginx-config.conf" --destination="$nginx_extra_conf_dir/sample.conf"
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=2
|
||||
ynh_script_progression "Making sure dedicated system user exists..."
|
||||
|
||||
if [ $with_sftp -eq 1 ]
|
||||
then
|
||||
|
@ -146,16 +121,13 @@ usermod -g "$app" "$app"
|
|||
# PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
if [ $phpversion != "none" ]
|
||||
if [ $php_version != "none" ]
|
||||
then
|
||||
ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2
|
||||
ynh_script_progression "Upgrading PHP-FPM configuration..."
|
||||
|
||||
# Create a dedicated PHP-FPM config
|
||||
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --phpversion=$phpversion
|
||||
ynh_config_add_phpfpm
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# SECURE FILES AND DIRECTORIES
|
||||
#=================================================
|
||||
|
@ -178,4 +150,4 @@ ynh_maintenance_mode_OFF
|
|||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Upgrade of $app completed" --last
|
||||
ynh_script_progression "Upgrade of $app completed"
|
||||
|
|
Loading…
Add table
Reference in a new issue