mirror of
https://github.com/YunoHost-Apps/garradin_ynh.git
synced 2024-09-03 18:36:17 +02:00
try to debug
This commit is contained in:
parent
f54c767d2a
commit
ca21b98aa5
7 changed files with 90 additions and 163 deletions
|
@ -16,7 +16,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-fpm-__NAME__.sock;
|
fastcgi_pass unix:/var/run/php/php7.0-fpm-__NAME__.sock;
|
||||||
|
|
||||||
# If you don't use a dedicated fpm config for your app,
|
# If you don't use a dedicated fpm config for your app,
|
||||||
# use a general fpm pool.
|
# use a general fpm pool.
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
"multi_instance": true,
|
"multi_instance": true,
|
||||||
"services": [
|
"services": [
|
||||||
"nginx",
|
"nginx",
|
||||||
"php-fpm"
|
"php7.0-fpm"
|
||||||
],
|
],
|
||||||
"arguments": {
|
"arguments": {
|
||||||
"install" : [
|
"install" : [
|
||||||
|
|
|
@ -48,8 +48,8 @@ ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
# BACKUP THE PHP-FPM CONFIGURATION
|
# BACKUP THE PHP-FPM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup "/etc/php/fpm/pool.d/$app.conf"
|
ynh_backup "/etc/php/7.0/fpm/pool.d/$app.conf"
|
||||||
ynh_backup "/etc/php/fpm/conf.d/20-$app.ini"
|
ynh_backup "/etc/php/7.0/fpm/conf.d/20-$app.ini"
|
||||||
|
|
||||||
# Backup directory location for the app from where the script is executed and
|
# Backup directory location for the app from where the script is executed and
|
||||||
# which will be compressed afterward
|
# which will be compressed afterward
|
||||||
|
|
|
@ -55,7 +55,7 @@ ynh_app_setting_set $app is_public $is_public
|
||||||
|
|
||||||
if [ "$(lsb_release --codename --short)" != "jessie" ]
|
if [ "$(lsb_release --codename --short)" != "jessie" ]
|
||||||
then
|
then
|
||||||
ynh_install_app_dependencies php-sqlite3
|
ynh_install_app_dependencies php7.0-sqlite3
|
||||||
else
|
else
|
||||||
ynh_install_app_dependencies php5-sqlite
|
ynh_install_app_dependencies php5-sqlite
|
||||||
fi
|
fi
|
||||||
|
|
102
scripts/remove
102
scripts/remove
|
@ -10,109 +10,47 @@ source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MANAGE SCRIPT FAILURE
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Exit if an error occurs during the execution of the script
|
|
||||||
ynh_abort_if_errors
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# Retrieve arguments
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
domain=$YNH_APP_ARG_DOMAIN
|
|
||||||
path_url=$YNH_APP_ARG_PATH
|
|
||||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
#=================================================
|
domain=$(ynh_app_setting_get $app domain)
|
||||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
final_path=$(ynh_app_setting_get $app final_path)
|
||||||
#=================================================
|
|
||||||
|
|
||||||
final_path=/var/www/$app
|
|
||||||
test ! -e "$final_path" || ynh_die "This path already contains a folder"
|
|
||||||
|
|
||||||
# Normalize the url path syntax
|
|
||||||
path_url=$(ynh_normalize_url_path $path_url)
|
|
||||||
|
|
||||||
# Check web path availability
|
|
||||||
ynh_webpath_available $domain $path_url
|
|
||||||
# Register (book) web path
|
|
||||||
ynh_webpath_register $app $domain $path_url
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STORE SETTINGS FROM MANIFEST
|
# REMOVE DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_app_setting_set $app path_url $path_url
|
# Remove metapackage and its dependencies
|
||||||
ynh_app_setting_set $app domain $domain
|
ynh_remove_app_dependencies
|
||||||
ynh_app_setting_set $app is_public $is_public
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# Install dependency to convert tracks to a readable format for the browser
|
# REMOVE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
if [ "$(lsb_release --codename --short)" != "jessie" ]
|
# Remove the app directory securely
|
||||||
then
|
ynh_secure_remove "$final_path"
|
||||||
ynh_install_app_dependencies php-sqlite3
|
|
||||||
else
|
|
||||||
ynh_install_app_dependencies php5-sqlite
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# REMOVE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Create a system user
|
# Remove the dedicated nginx config
|
||||||
ynh_system_user_create $app
|
ynh_remove_nginx_config
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# REMOVE PHP-FPM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_app_setting_set $app final_path $final_path
|
# Remove the dedicated php-fpm config
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
ynh_remove_fpm_config
|
||||||
ynh_setup_source "$final_path"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# Files owned by user app
|
# GENERIC FINALIZATION
|
||||||
|
#=================================================
|
||||||
|
# REMOVE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
sudo chown $app:$app $final_path -R
|
# Delete a system user
|
||||||
sudo chmod 755 $final_path -R
|
ynh_system_user_delete $app
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# NGINX CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Create a dedicated nginx config
|
|
||||||
ynh_add_nginx_config
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# PHP-FPM CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Create a dedicated php-fpm config
|
|
||||||
ynh_add_fpm_config
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SETUP SSOWAT
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
if [ $is_public -eq 0 ]
|
|
||||||
then # Remove the public access
|
|
||||||
ynh_app_setting_delete $app skipped_uris
|
|
||||||
fi
|
|
||||||
# Make app public if necessary
|
|
||||||
if [ $is_public -eq 1 ]
|
|
||||||
then
|
|
||||||
# unprotected_uris allows SSO credentials to be passed anyway.
|
|
||||||
ynh_app_setting_set $app unprotected_uris "/"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RELOAD NGINX
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
systemctl reload nginx
|
|
139
scripts/restore
139
scripts/restore
|
@ -6,6 +6,11 @@
|
||||||
# IMPORT GENERIC HELPERS
|
# IMPORT GENERIC HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
if [ ! -e _common.sh ]; then
|
||||||
|
# Get the _common.sh file if it's not in the current directory
|
||||||
|
cp ../settings/scripts/_common.sh ./_common.sh
|
||||||
|
chmod a+rx _common.sh
|
||||||
|
fi
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
@ -17,102 +22,86 @@ source /usr/share/yunohost/helpers
|
||||||
ynh_abort_if_errors
|
ynh_abort_if_errors
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# Retrieve arguments
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
domain=$YNH_APP_ARG_DOMAIN
|
|
||||||
path_url=$YNH_APP_ARG_PATH
|
|
||||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
#=================================================
|
domain=$(ynh_app_setting_get $app domain)
|
||||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
path_url=$(ynh_app_setting_get $app path)
|
||||||
#=================================================
|
final_path=$(ynh_app_setting_get $app final_path)
|
||||||
|
|
||||||
final_path=/var/www/$app
|
|
||||||
test ! -e "$final_path" || ynh_die "This path already contains a folder"
|
|
||||||
|
|
||||||
# Normalize the url path syntax
|
|
||||||
path_url=$(ynh_normalize_url_path $path_url)
|
|
||||||
|
|
||||||
# Check web path availability
|
|
||||||
ynh_webpath_available $domain $path_url
|
|
||||||
# Register (book) web path
|
|
||||||
ynh_webpath_register $app $domain $path_url
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STORE SETTINGS FROM MANIFEST
|
# CHECK IF THE APP CAN BE RESTORED
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_app_setting_set $app path_url $path_url
|
ynh_webpath_available $domain $path_url \
|
||||||
ynh_app_setting_set $app domain $domain
|
|| ynh_die "Path not available: ${domain}${path_url}"
|
||||||
ynh_app_setting_set $app is_public $is_public
|
test ! -d $final_path \
|
||||||
|
|| ynh_die "There is already a directory: $final_path "
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# Install dependency to convert tracks to a readable format for the browser
|
# STANDARD RESTORATION STEPS
|
||||||
|
#=================================================
|
||||||
|
# RESTORE THE NGINX CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RESTORE THE APP MAIN DIR
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_restore_file "$final_path"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RECREATE THE DEDICATED USER
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Create the dedicated user (if not existing)
|
||||||
|
ynh_system_user_create $app
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RESTORE USER RIGHTS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Restore permissions on app files
|
||||||
|
chown -R $app:$app $final_path
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RESTORE THE PHP-FPM CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
if [ "$(lsb_release --codename --short)" != "jessie" ]
|
||||||
|
then
|
||||||
|
ynh_restore_file "/etc/php/7.0/fpm/pool.d/$app.conf"
|
||||||
|
ynh_restore_file "/etc/php/7.0/fpm/conf.d/20-$app.ini"
|
||||||
|
else
|
||||||
|
ynh_restore_file "/etc/php5/fpm/pool.d/$app.conf"
|
||||||
|
ynh_restore_file "/etc/php5/fpm/conf.d/20-$app.ini"
|
||||||
|
fi
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SPECIFIC RESTORATION
|
||||||
|
#=================================================
|
||||||
|
# REINSTALL DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
if [ "$(lsb_release --codename --short)" != "jessie" ]
|
if [ "$(lsb_release --codename --short)" != "jessie" ]
|
||||||
then
|
then
|
||||||
ynh_install_app_dependencies php-sqlite3
|
ynh_install_app_dependencies php7.0-sqlite3
|
||||||
else
|
else
|
||||||
ynh_install_app_dependencies php5-sqlite
|
ynh_install_app_dependencies php5-sqlite
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
# RELOAD NGINX AND PHP-FPM
|
||||||
# Create a system user
|
|
||||||
ynh_system_user_create $app
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
if [ "$(lsb_release --codename --short)" != "jessie" ]
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_app_setting_set $app final_path $final_path
|
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
|
||||||
ynh_setup_source "$final_path"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# Files owned by user app
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
sudo chown $app:$app $final_path -R
|
|
||||||
sudo chmod 755 $final_path -R
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# NGINX CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Create a dedicated nginx config
|
|
||||||
ynh_add_nginx_config
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# PHP-FPM CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Create a dedicated php-fpm config
|
|
||||||
ynh_add_fpm_config
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SETUP SSOWAT
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
if [ $is_public -eq 0 ]
|
|
||||||
then # Remove the public access
|
|
||||||
ynh_app_setting_delete $app skipped_uris
|
|
||||||
fi
|
|
||||||
# Make app public if necessary
|
|
||||||
if [ $is_public -eq 1 ]
|
|
||||||
then
|
then
|
||||||
# unprotected_uris allows SSO credentials to be passed anyway.
|
systemctl reload php7.0-fpm
|
||||||
ynh_app_setting_set $app unprotected_uris "/"
|
else
|
||||||
|
systemctl reload php5-fpm
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RELOAD NGINX
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
systemctl reload nginx
|
systemctl reload nginx
|
|
@ -55,7 +55,7 @@ ynh_app_setting_set $app is_public $is_public
|
||||||
|
|
||||||
if [ "$(lsb_release --codename --short)" != "jessie" ]
|
if [ "$(lsb_release --codename --short)" != "jessie" ]
|
||||||
then
|
then
|
||||||
ynh_install_app_dependencies php-sqlite3
|
ynh_install_app_dependencies php7.0-sqlite3
|
||||||
else
|
else
|
||||||
ynh_install_app_dependencies php5-sqlite
|
ynh_install_app_dependencies php5-sqlite
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Add table
Reference in a new issue