Parcourir la source

Merge pull request #74 from ericgaspar/PHP7.3

Set PHP to 7.3
Alexandre Aubin il y a 4 ans
Parent
commit
f18a9291cc
11 fichiers modifiés avec 50 ajouts et 56 suppressions
  1. 3 1
      README.md
  2. 1 1
      conf/nginx.conf
  3. 1 1
      conf/php-fpm.conf
  4. 0 6
      conf/ynh-vpnclient
  5. 2 2
      manifest.json
  6. 8 3
      scripts/_common.sh
  7. 5 4
      scripts/backup
  8. 11 11
      scripts/install
  9. 7 7
      scripts/remove
  10. 8 7
      scripts/restore
  11. 4 13
      scripts/upgrade

+ 3 - 1
README.md

@@ -1,4 +1,6 @@
-# VPN Client [![Build Status](https://travis-ci.org/labriqueinternet/vpnclient_ynh.svg?branch=master)](https://travis-ci.org/labriqueinternet/vpnclient_ynh) [![Integration level](https://dash.yunohost.org/integration/vpnclient.svg)](https://dash.yunohost.org/appci/app/vpnclient)
+# VPN Client
+
+[![Build Status](https://travis-ci.org/labriqueinternet/vpnclient_ynh.svg?branch=master)](https://travis-ci.org/labriqueinternet/vpnclient_ynh) [![Integration level](https://dash.yunohost.org/integration/vpnclient.svg)](https://dash.yunohost.org/appci/app/vpnclient)  
 [![Install LaBriqueInterNet VPNclient with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=vpnclient)
 
 This YunoHost app is a part of the "[La Brique Internet](http://labriqueinter.net)" project but can be used independently.

+ 1 - 1
conf/nginx.conf

@@ -35,7 +35,7 @@ location __PATH__/ {
 
   location ~ [^/]\.php(/|$) {
     fastcgi_split_path_info ^(.+?\.php)(/.*)$;
-    fastcgi_pass unix:/var/run/php/php7.0-fpm-__NAME__.sock;
+    fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
     fastcgi_index index.php;
     include fastcgi_params;
     fastcgi_read_timeout 600;

+ 1 - 1
conf/php-fpm.conf

@@ -28,7 +28,7 @@
 ;                            specific port;
 ;   '/path/to/unix/socket' - to listen on a unix socket.
 ; Note: This value is mandatory.
-listen = /var/run/php/php7.0-fpm-__NAMETOCHANGE__.sock
+listen = /var/run/php/php__PHPVERSION__-fpm-__NAMETOCHANGE__.sock
 
 ; Set permissions for unix socket, if one is used. In Linux, read/write
 ; permissions must be set in order to allow connections from a web server. Many

+ 0 - 6
conf/ynh-vpnclient

@@ -362,12 +362,6 @@ is_running() {
 
 if [ "$1" != restart ]; then
 
-  # Restart php-fpm at the first start (it needs to be restarted after the slapd start)
-  if [ ! -e /tmp/.ynh-vpnclient-boot ]; then
-    touch /tmp/.ynh-vpnclient-boot
-    systemctl restart php7.0-fpm
-  fi
-
   # Check configuration consistency
 
   if [[ ! "${1}" =~ stop ]]; then

+ 2 - 2
manifest.json

@@ -2,11 +2,11 @@
   "name": "VPN Client",
   "id": "vpnclient",
   "packaging_format": 1,
-  "version": "1.4.1~ynh2",
   "description": {
     "en": "Tunnel the internet traffic through a VPN",
     "fr": "Fait passer le trafic internet à travers un VPN"
   },
+  "version": "1.4.1~ynh3",
   "url": "https://labriqueinter.net",
   "license": "AGPL-3.0",
   "maintainer": {
@@ -15,7 +15,7 @@
   },
   "multi_instance": false,
   "requirements": {
-    "yunohost": ">= 3.8.0"
+    "yunohost": ">= 4.0"
   },
   "services": [
     "nginx",

+ 8 - 3
scripts/_common.sh

@@ -3,11 +3,14 @@
 # Common variables and helpers
 #
 
-pkg_dependencies="php7.0-fpm sipcalc dnsutils openvpn curl fake-hwclock"
+YNH_PHP_VERSION="7.3"
+
+pkg_dependencies="sipcalc dnsutils openvpn curl fake-hwclock"
 
 service_name="ynh-vpnclient"
 service_checker_name=$service_name"-checker"
 
+
 # Operations needed by both 'install' and 'upgrade' scripts
 function vpnclient_deploy_files_and_services()
 {
@@ -61,9 +64,11 @@ function vpnclient_deploy_files_and_services()
   #=================================================
   # PHP-FPM CONFIGURATION
   #=================================================
-  ynh_print_info "Configuring php-fpm..."
+  ynh_print_info "Configuring PHP-FPM..."
 
-  ynh_add_fpm_config
+  # Create a dedicated PHP-FPM config
+  ynh_add_fpm_config --phpversion=$YNH_PHP_VERSION
+  phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
 
   #=================================================
 

+ 5 - 4
scripts/backup

@@ -25,6 +25,7 @@ app=$YNH_APP_INSTANCE_NAME
 
 final_path=$(ynh_app_setting_get $app final_path)
 domain=$(ynh_app_setting_get $app domain)
+phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
 
 #=================================================
 # STANDARD BACKUP STEPS
@@ -53,16 +54,16 @@ ynh_backup "/usr/local/bin/$service_checker_name.sh"
 #=================================================
 # BACKUP THE NGINX CONFIGURATION
 #=================================================
-ynh_print_info "Backing up nginx web server configuration..."
+ynh_print_info "Backing up NGINX web server configuration..."
 
 ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
 
 #=================================================
 # BACKUP THE PHP-FPM CONFIGURATION
 #=================================================
-ynh_print_info "Backing up php-fpm configuration..."
+ynh_print_info "Backing up PHP-FPM configuration..."
 
-ynh_backup "/etc/php/7.0/fpm/pool.d/$app.conf"
+ynh_backup "/etc/php/$phpversion/fpm/pool.d/$app.conf"
 
 #=================================================
 # SPECIFIC BACKUP
@@ -80,4 +81,4 @@ ynh_backup "/etc/systemd/system/openvpn@.service"
 # END OF SCRIPT
 #=================================================
 
-ynh_print_info "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)."

+ 11 - 11
scripts/install

@@ -39,14 +39,14 @@ ynh_abort_if_errors
 
 # Retrieve arguments
 domain=$YNH_APP_ARG_DOMAIN
-path_url=$(ynh_normalize_url_path "$YNH_APP_ARG_PATH")
+path_url=$YNH_APP_ARG_PATH
 app=$YNH_APP_INSTANCE_NAME
 final_path="/var/www/$app"
 
 #=================================================
 # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
 #=================================================
-ynh_print_info "Validating installation parameters..."
+ynh_script_progression "Validating installation parameters..."
 
 # Check destination directory
 test ! -e "$final_path" || ynh_die "Path is already in use: ${final_path}."
@@ -57,7 +57,7 @@ ynh_webpath_register "$app" "$domain" "$path_url"
 #=================================================
 # STORE SETTINGS FROM MANIFEST
 #=================================================
-ynh_print_info "Storing installation settings..."
+ynh_script_progression "Storing installation settings..."
 
 ynh_app_setting_set "$app" domain "$domain"
 ynh_app_setting_set "$app" final_path "$final_path"
@@ -67,42 +67,42 @@ ynh_app_setting_set "$app" final_path "$final_path"
 #=================================================
 # INSTALL DEPENDENCIES
 #=================================================
-ynh_print_info "Installing dependencies..."
+ynh_script_progression "Installing dependencies..."
 
 ynh_install_app_dependencies "$pkg_dependencies"
 
 #=================================================
 # DEPLOY FILES FROM PACKAGE
 #=================================================
-ynh_print_info "Deploy files from package..."
+ynh_script_progression "Deploy files from package..."
 
 vpnclient_deploy_files_and_services
 
 #=================================================
 # RELOAD SERVICES
 #=================================================
-ynh_print_info "Reloading services..."
+ynh_script_progression "Reloading services..."
 
 # Set default inits
 # The boot order of these services are important, so they are disabled by default
 # and the vpnclient service handles them.
-systemctl disable openvpn
+systemctl disable openvpn --quiet
 systemctl stop openvpn
 
 # main service
 
-yunohost service add $service_name --description "Tunnels the internet traffic through a VPN" --need_lock
+yunohost service add $service_name --description "Tunnels the internet traffic through a VPN" --need_lock --test_status="systemctl is-active openvpn@client.service" --log "/var/log/ynh-vpnclient.log"
 yunohost service enable $service_name
 
 # checker service
 
 systemctl start $service_checker_name
-systemctl enable $service_checker_name
+systemctl enable $service_checker_name --quiet
 systemctl start $service_checker_name.timer
-systemctl enable $service_checker_name.timer
+systemctl enable $service_checker_name.timer --quiet
 
 #=================================================
 # END OF SCRIPT
 #=================================================
 
-ynh_print_info "Installation of $app completed"
+ynh_script_progression "Installation of $app completed" --last

+ 7 - 7
scripts/remove

@@ -40,14 +40,14 @@ domain=$(ynh_app_setting_get $app domain)
 ynh_print_info "Stopping and removing services"
 
 systemctl stop $service_checker_name
-systemctl disable $service_checker_name
+systemctl disable $service_checker_name --quiet
 systemctl stop $service_checker_name.timer && sleep 1
-systemctl disable $service_checker_name.timer
+systemctl disable $service_checker_name.timer --quiet
 
 if ynh_exec_warn_less yunohost service status $service_name >/dev/null
 then
     yunohost service stop $service_name
-    yunohost service disable $service_name
+    yunohost service disable $service_name --quiet
     yunohost service remove $service_checker
 fi
 
@@ -59,17 +59,17 @@ done
 #=================================================
 # REMOVE NGINX CONFIGURATION
 #=================================================
-ynh_print_info "Removing nginx web server configuration"
+ynh_print_info "Removing NGINX web server configuration"
 
-# Remove the dedicated nginx config
+# Remove the dedicated NGINX config
 ynh_remove_nginx_config
 
 #=================================================
 # REMOVE PHP-FPM CONFIGURATION
 #=================================================
-ynh_print_info "Removing php-fpm configuration"
+ynh_print_info "Removing PHP-FPM configuration"
 
-# Remove the dedicated php-fpm config
+# Remove the dedicated PHP-FPM config
 ynh_remove_fpm_config
 
 #=================================================

+ 8 - 7
scripts/restore

@@ -26,6 +26,7 @@ app=$YNH_APP_INSTANCE_NAME
 domain=$(ynh_app_setting_get $app domain)
 path_url=$(ynh_app_setting_get $app path)
 final_path=$(ynh_app_setting_get $app final_path)
+phpversion=$(ynh_app_setting_get $app phpversion)
 
 #=================================================
 # CHECK IF THE APP CAN BE RESTORED
@@ -86,7 +87,7 @@ chown -R $app: $final_path
 # RESTORE THE PHP-FPM CONFIGURATION
 #=================================================
 
-ynh_restore_file "/etc/php/7.0/fpm/pool.d/$app.conf"
+ynh_restore_file "/etc/php/$phpversion/fpm/pool.d/$app.conf"
 
 #=================================================
 # SPECIFIC RESTORATION
@@ -108,24 +109,24 @@ ynh_restore_file "/etc/systemd/system/$service_checker_name.service"
 ynh_restore_file "/etc/systemd/system/$service_checker_name.timer"
 ynh_restore_file "/etc/systemd/system/openvpn@.service"
 systemctl daemon-reload
-systemctl enable "$service_name.service"
-systemctl enable "$service_checker_name.service"
-systemctl enable "openvpn@.service"
+systemctl enable "$service_name.service" --quiet
+systemctl enable "$service_checker_name.service" --quiet
+systemctl enable "openvpn@.service" --quiet
 
 #=================================================
 # ADVERTISE SERVICE IN ADMIN PANEL
 #=================================================
 
-yunohost service add $service_name --description "Tunnels the internet traffic through a VPN" --need_lock
+yunohost service add $service_name --description "Tunnels the internet traffic through a VPN" --need_lock --test_status="systemctl is-active openvpn@client.service" --log "/var/log/ynh-vpnclient.log"
 
 #=================================================
 # GENERIC FINALIZATION
 #=================================================
 # RELOAD NGINX AND PHP-FPM
 #=================================================
-ynh_print_info "Reloading nginx web server and php-fpm..."
+ynh_print_info "Reloading NGINX web server and PHP-FPM..."
 
-systemctl reload php7.0-fpm
+systemctl reload php$phpversion-fpm
 systemctl reload nginx
 
 #=================================================

+ 4 - 13
scripts/upgrade

@@ -25,18 +25,9 @@ final_path=$(ynh_app_setting_get $app final_path)
 # SPECIAL UPGRADE FOR VERSIONS < 1.2.0
 #=================================================
 
-# Apply renaming that occured in v1.2.0 ("vpnadmin" -> "${app}")
-if [ -f /etc/nginx/conf.d/${domain}.d/vpnadmin.conf ]; then
-  ynh_replace_string "/var/www/vpnadmin/" "/var/www/${app}/" "/etc/nginx/conf.d/${domain}.d/vpnadmin.conf"
-  ynh_replace_string "vpnadmin.sock" "${app}.sock" "/etc/nginx/conf.d/${domain}.d/vpnadmin.conf"
-  mv /etc/nginx/conf.d/${domain}.d/vpnadmin.conf /etc/nginx/conf.d/${domain}.d/${app}.conf
-fi
-
-if [ -f /etc/php/7.0/fpm/pool.d/vpnadmin.conf ]; then
-  ynh_replace_string "/var/www/vpnadmin/" "/var/www/${app}/" /etc/php/7.0/fpm/pool.d/vpnadmin.conf
-  ynh_replace_string "vpnadmin.sock" "${app}.sock"  /etc/php/7.0/fpm/pool.d/vpnadmin.conf
-  mv /etc/php/7.0/fpm/pool.d/vpnadmin.conf /etc/php/7.0/fpm/pool.d/${app}.conf
-fi
+# Removing configuration files with naming that occured in versions < 1.2.0 ("vpnadmin" instead off "$app")
+rm -f /etc/nginx/conf.d/${domain}.d/vpnadmin.conf 2>/dev/null 
+rm -f /etc/php/*/fpm/pool.d/vpnadmin.conf 2>/dev/null 
 
 if [ -d /var/www/vpnadmin ]; then
   mv /var/www/vpnadmin /var/www/${app}
@@ -91,7 +82,7 @@ ynh_secure_remove ${tmpdir}
 ### Make sure that the yunohost services have a description and need-lock enabled
 
 # main service
-yunohost service add $service_name --description "Tunnels the internet traffic through a VPN" --need_lock
+yunohost service add $service_name --description "Tunnels the internet traffic through a VPN" --need_lock --test_status="systemctl is-active openvpn@client.service" --log "/var/log/ynh-vpnclient.log"
 
 # checker service (this service was previously integrated in yunohost but we do not do this anymore)
 if ynh_exec_warn_less yunohost service status $service_checker_name >/dev/null