mirror of
https://github.com/YunoHost-Apps/my_webapp_ynh.git
synced 2024-09-03 19:46:26 +02:00
Add option to not install PHP
This commit is contained in:
parent
6c9c7d3a09
commit
51821b21e8
7 changed files with 98 additions and 11 deletions
|
@ -46,6 +46,19 @@
|
|||
setup_sub_dir=1
|
||||
upgrade=1
|
||||
backup_restore=1
|
||||
;; Test without PHP
|
||||
; Manifest
|
||||
domain="domain.tld"
|
||||
path="/path"
|
||||
with_sftp=0
|
||||
password="myreallystrengthpassword"
|
||||
is_public=1
|
||||
phpversion="none"
|
||||
with_mysql=0
|
||||
; Checks
|
||||
setup_sub_dir=1
|
||||
upgrade=1
|
||||
backup_restore=1
|
||||
;; Test with PHP7.4
|
||||
; Manifest
|
||||
domain="domain.tld"
|
||||
|
|
34
conf/nginx_no_php.conf
Normal file
34
conf/nginx_no_php.conf
Normal file
|
@ -0,0 +1,34 @@
|
|||
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
|
||||
location __PATH__/ {
|
||||
|
||||
# Path to source
|
||||
alias __FINALPATH__/www/;
|
||||
|
||||
# Force usage of https
|
||||
if ($scheme = http) {
|
||||
rewrite ^ https://$server_name$request_uri? permanent;
|
||||
}
|
||||
|
||||
# Default indexes and catch-all
|
||||
index index.html index.php;
|
||||
try_files $uri $uri/ __PATH__/index.php?$args;
|
||||
|
||||
# Prevent useless logs
|
||||
location = __PATH__/favicon.ico {
|
||||
log_not_found off;
|
||||
access_log off;
|
||||
}
|
||||
location = __PATH__/robots.txt {
|
||||
allow all;
|
||||
log_not_found off;
|
||||
access_log off;
|
||||
}
|
||||
|
||||
# Deny access to hidden files and directories
|
||||
location ~ ^__PATH__/(.+/|)\.(?!well-known\/) {
|
||||
deny all;
|
||||
}
|
||||
|
||||
# Include SSOWAT user panel.
|
||||
include conf.d/yunohost_panel.conf.inc;
|
||||
}
|
|
@ -64,7 +64,7 @@
|
|||
"en": "Choose a PHP version you want to use for your app",
|
||||
"fr": "Choisissez une version PHP que vous souhaitez utiliser pour votre application"
|
||||
},
|
||||
"choices" : ["7.3", "7.4", "8.0"],
|
||||
"choices" : ["none", "7.3", "7.4", "8.0"],
|
||||
"default" : "7.3"
|
||||
},
|
||||
{
|
||||
|
|
|
@ -28,6 +28,7 @@ ynh_script_progression --message="Loading installation settings..."
|
|||
|
||||
# Needed for helper "ynh_add_nginx_config"
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
|
@ -80,6 +81,14 @@ ynh_script_progression --message="Updating NGINX web server configuration..." --
|
|||
|
||||
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
||||
|
||||
# Prepare nginx.conf
|
||||
if [ $phpversion != "none" ]
|
||||
then
|
||||
cp ../conf/nginx{_with_php,}.conf
|
||||
else
|
||||
cp ../conf/nginx{_no_php,}.conf
|
||||
fi
|
||||
|
||||
# Change the path in the NGINX config file
|
||||
if [ $change_path -eq 1 ]
|
||||
then
|
||||
|
|
|
@ -62,9 +62,13 @@ ynh_app_setting_set --app=$app --key=admin_mail_html --value=1
|
|||
#=================================================
|
||||
# INSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing dependencies..." --weight=2
|
||||
|
||||
ynh_install_app_dependencies "php${phpversion}-fpm"
|
||||
if [ $phpversion != "none" ]
|
||||
then
|
||||
ynh_script_progression --message="Installing dependencies..." --weight=2
|
||||
|
||||
ynh_install_app_dependencies "php${phpversion}-fpm"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# CREATE A MYSQL DATABASE
|
||||
|
@ -84,6 +88,14 @@ fi
|
|||
#=================================================
|
||||
ynh_script_progression --message="Configuring NGINX web server..." --weight=2
|
||||
|
||||
# Prepare nginx.conf
|
||||
if [ $phpversion != "none" ]
|
||||
then
|
||||
cp ../conf/nginx{_with_php,}.conf
|
||||
else
|
||||
cp ../conf/nginx{_no_php,}.conf
|
||||
fi
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
|
||||
|
@ -146,10 +158,14 @@ chmod o-rwx "$final_path"
|
|||
#=================================================
|
||||
# PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring PHP-FPM..." --weight=2
|
||||
|
||||
# Create a dedicatedPHP-FPM config
|
||||
ynh_add_fpm_config --usage=low --footprint=low --phpversion=$phpversion
|
||||
if [ $phpversion != "none" ]
|
||||
then
|
||||
ynh_script_progression --message="Configuring PHP-FPM..." --weight=2
|
||||
|
||||
# Create a dedicatedPHP-FPM config
|
||||
ynh_add_fpm_config --usage=low --footprint=low --phpversion=$phpversion
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
|
|
|
@ -124,9 +124,13 @@ ynh_maintenance_mode_ON
|
|||
#=================================================
|
||||
# INSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing dependencies..." --weight=2
|
||||
|
||||
ynh_install_app_dependencies "php${phpversion}-fpm"
|
||||
if [ $phpversion != "none" ]
|
||||
then
|
||||
ynh_script_progression --message="Installing dependencies..." --weight=2
|
||||
|
||||
ynh_install_app_dependencies "php${phpversion}-fpm"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
|
@ -134,6 +138,14 @@ ynh_install_app_dependencies "php${phpversion}-fpm"
|
|||
|
||||
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2
|
||||
|
||||
# Prepare nginx.conf
|
||||
if [ $phpversion != "none" ]
|
||||
then
|
||||
cp ../conf/nginx{_with_php,}.conf
|
||||
else
|
||||
cp ../conf/nginx{_no_php,}.conf
|
||||
fi
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
|
||||
|
@ -165,10 +177,13 @@ usermod -g "$app" "$app"
|
|||
# PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2
|
||||
if [ $phpversion != "none" ]
|
||||
then
|
||||
ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2
|
||||
|
||||
# Create a dedicated PHP-FPM config
|
||||
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --phpversion=$phpversion
|
||||
# Create a dedicated PHP-FPM config
|
||||
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --phpversion=$phpversion
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC UPGRADE
|
||||
|
|
Loading…
Add table
Reference in a new issue