From 5e28adf63df85b938f17dff7617decc0a2657edf Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Fri, 18 Dec 2020 14:09:23 +0100 Subject: [PATCH] Small fixes --- conf/systemd.service | 2 +- manifest.json | 2 +- scripts/install | 12 +++++++----- scripts/restore | 5 +++-- scripts/upgrade | 17 ++++++++--------- 5 files changed, 20 insertions(+), 18 deletions(-) diff --git a/conf/systemd.service b/conf/systemd.service index 24c5f4e..85b6e6c 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -6,7 +6,7 @@ After=nginx.service network.target local-fs.target postgresql.service Type=simple User=__APP__ WorkingDirectory=__FINALPATH__ -ExecStart=/usr/bin/php7.3 daemon.php start --interface=127.0.0.1 --url=https://__DOMAIN____PATH__/ --port=__PORT__ +ExecStart=/usr/bin/php__PHP_VERSION__ daemon.php start --interface=127.0.0.1 --url=https://__DOMAIN____PATH__/ --port=__PORT__ StandardOutput=syslog SyslogIdentifier=__APP__ PIDFile=/run/movim.pid diff --git a/manifest.json b/manifest.json index cec3fb8..4fd4083 100644 --- a/manifest.json +++ b/manifest.json @@ -19,7 +19,7 @@ "multi_instance": false, "services": [ "nginx", - "php7.0-fpm", + "php7.3-fpm", "postgresql", "metronome" ], diff --git a/scripts/install b/scripts/install index 99ecf5c..9bd1779 100644 --- a/scripts/install +++ b/scripts/install @@ -153,7 +153,8 @@ ynh_script_progression --message="Configuring a systemd service..." --weight=1 ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file=../conf/systemd.service ynh_replace_string --match_string="__PATH__" --replace_string="$path_url" --target_file=../conf/systemd.service -ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file=../conf/systemd.service +ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file=../conf/systemd.service +ynh_replace_string --match_string="__PHP_VERSION__" --replace_string="$phpversion" --target_file=../conf/systemd.service ynh_add_systemd_config @@ -168,9 +169,10 @@ cache_dir="/home/$app" mkdir -p $cache_dir chown -R $app $cache_dir -cd "$final_path" -ynh_exec_as $app php$phpversion composer.phar $app:migrate -ynh_exec_as $app php$phpversion daemon.php config --username=$admin --password=$password +pushd "$final_path" + ynh_exec_as $app php$phpversion composer.phar $app:migrate + ynh_exec_as $app php$phpversion daemon.php config --username=$admin --password=$password +popd #================================================= # GENERIC FINALIZATION @@ -186,7 +188,7 @@ chown -R $app $final_path/src/Movim/ #================================================= ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 -yunohost service add $app --description "Responsive web-based XMPP client" --log="/var/log/$app/$app.log" +yunohost service add $app --description="Responsive web-based XMPP client" --log="/var/log/$app/$app.log" #================================================= # START SYSTEMD SERVICE diff --git a/scripts/restore b/scripts/restore index 70bfeb3..0a45e83 100644 --- a/scripts/restore +++ b/scripts/restore @@ -80,7 +80,7 @@ chown -R $app $final_path/src/Movim/ # RESTORE THE PHP-FPM CONFIGURATION #================================================= -ynh_restore_file --origin_path="/etc/php/${phpversion}/fpm/pool.d/$app.conf" +ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" #================================================= # SPECIFIC RESTORATION @@ -112,6 +112,7 @@ systemctl enable $app.service --quiet #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= +ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 yunohost service add $app --description="Responsive web-based XMPP client" --log="/var/log/$app/$app.log" @@ -129,7 +130,7 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$ap #================================================= ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1 -ynh_systemd_action --service_name=php${phpversion}-fpm --action=reload +ynh_systemd_action --service_name=php$phpversion-fpm --action=reload ynh_systemd_action --service_name=nginx --action=reload #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 55b5cf4..bbb30fa 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -126,7 +126,6 @@ ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=1 ynh_replace_string --match_string="__TIMEZONE__" --replace_string="$timezone" --target_file=../conf/php-fpm.conf ynh_add_fpm_config --package="$extra_php_dependencies" -phpversion=$(ynh_app_setting_get --app="$app" --key=phpversion) #================================================= # SET PERMISSIONS @@ -143,24 +142,23 @@ ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 yunohost service add $app --description="Responsive web-based XMPP client" --log="/var/log/$app/$app.log" #================================================= -# Install PHP dependencies using composer +# INSTALL PHP DEPENDENCIES USING COMPOSER #================================================= -( - cd "$final_path" +pushd "$final_path" curl -sS https://getcomposer.org/installer | php$phpversion -- --version="1.10.16" --install-dir="$final_path" \ && php$phpversion composer.phar config --global discard-changes true --quiet \ && php$phpversion composer.phar install --no-interaction --quiet -) +popd #================================================= # Set-up database #================================================= ynh_script_progression --message="Configuring database.." --weight=1 -( - cd "$final_path" + +pushd "$final_path" ynh_exec_as $app php$phpversion composer.phar movim:migrate -) +popd #================================================= # SETUP SYSTEMD @@ -169,7 +167,8 @@ ynh_script_progression --message="Configuring database.." --weight=1 # Create a dedicated systemd config ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file=../conf/systemd.service ynh_replace_string --match_string="__PATH__" --replace_string="$path_url" --target_file=../conf/systemd.service -ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file=../conf/systemd.service +ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file=../conf/systemd.service +ynh_replace_string --match_string="__PHP_VERSION__" --replace_string="$phpversion" --target_file=../conf/systemd.service ynh_add_systemd_config