From ef0e066590c0af39583c94f5590a3edc14878cf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 7 Sep 2023 20:23:32 +0200 Subject: [PATCH] cleaning --- manifest.toml | 3 +-- scripts/install | 33 ++++++++------------------------- scripts/remove | 15 --------------- scripts/restore | 22 ---------------------- scripts/upgrade | 37 ++++++++++--------------------------- 5 files changed, 19 insertions(+), 91 deletions(-) diff --git a/manifest.toml b/manifest.toml index 102007e..ce8107c 100644 --- a/manifest.toml +++ b/manifest.toml @@ -15,7 +15,7 @@ demo = "https://dispatch.khlieng.com/" code = "https://github.com/khlieng/dispatch" [integration] -yunohost = ">= 11.1.16" +yunohost = ">= 11.2" architectures = "all" multi_instance = false ldap = false @@ -27,7 +27,6 @@ ram.runtime = "50M" [install] [install.domain] type = "domain" - full_domain = true [install.init_main_permission] help.en = "If enabled, Dispatch will be accessible by people who do not have an account. This can be changed later via the webadmin." diff --git a/scripts/install b/scripts/install index 96386f2..037cb83 100644 --- a/scripts/install +++ b/scripts/install @@ -29,6 +29,14 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=3 # Create a dedicated NGINX config ynh_add_nginx_config +# Create a dedicated systemd config +ynh_add_systemd_config + +# Use logrotate to manage application logfile(s) +ynh_use_logrotate + +yunohost service add $app --description="Web-based IRC client" --log="/var/log/$app/$app.log" + #================================================= # SPECIFIC SETUP #================================================= @@ -41,31 +49,6 @@ ynh_add_config --template="../conf/config.default.toml" --destination="$install_ chmod 400 "$install_dir/.dispatch/config.toml" chown $app:$app "$install_dir/.dispatch/config.toml" -#================================================= -# SETUP SYSTEMD -#================================================= -ynh_script_progression --message="Configuring a systemd service..." --weight=1 - -# Create a dedicated systemd config -ynh_add_systemd_config - -#================================================= -# GENERIC FINALIZATION -#================================================= -# SETUP LOGROTATE -#================================================= -ynh_script_progression --message="Configuring log rotation..." --weight=1 - -# Use logrotate to manage application logfile(s) -ynh_use_logrotate - -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 - -yunohost service add $app --description="Web-based IRC client" --log="/var/log/$app/$app.log" - #================================================= # START SYSTEMD SERVICE #================================================= diff --git a/scripts/remove b/scripts/remove index f5d8325..4f79c21 100644 --- a/scripts/remove +++ b/scripts/remove @@ -22,27 +22,12 @@ then yunohost service remove $app fi -#================================================= -# STOP AND REMOVE SERVICE -#================================================= -ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1 - # Remove the dedicated systemd config ynh_remove_systemd_config -#================================================= -# REMOVE LOGROTATE CONFIGURATION -#================================================= -ynh_script_progression --message="Removing logrotate configuration..." --weight=1 - # Remove the app-specific logrotate config ynh_remove_logrotate -#================================================= -# REMOVE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Removing NGINX web server configuration..." --weight=5 - # Remove the dedicated NGINX config ynh_remove_nginx_config diff --git a/scripts/restore b/scripts/restore index 849d652..2e42937 100644 --- a/scripts/restore +++ b/scripts/restore @@ -29,26 +29,11 @@ ynh_script_progression --message="Restoring the NGINX web server configuration.. ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# RESTORE SYSTEMD -#================================================= -ynh_script_progression --message="Restoring the systemd configuration..." --weight=5 - ynh_restore_file --origin_path="/etc/systemd/system/$app.service" systemctl enable $app.service --quiet -#================================================= -# RESTORE THE LOGROTATE CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1 - ynh_restore_file --origin_path="/etc/logrotate.d/$app" -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." - yunohost service add $app --description="Web-based IRC client" --log="/var/log/$app/$app.log" #================================================= @@ -58,13 +43,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Listening on port" -#================================================= -# GENERIC FINALIZATION -#================================================= -# RELOAD NGINX -#================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - ynh_systemd_action --service_name=nginx --action=reload #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index a7a8fb1..3f82acd 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -40,13 +40,21 @@ chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" #================================================= -# NGINX CONFIGURATION +# SETUP SYSTEMD #================================================= -ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2 +ynh_script_progression --message="Upgrading systemd configuration..." --weight=2 # Create a dedicated NGINX config ynh_add_nginx_config +# Create a dedicated systemd config +ynh_add_systemd_config + +# Use logrotate to manage app-specific logfile(s) +ynh_use_logrotate --non-append + +yunohost service add $app --description="Web-based IRC client" --log="/var/log/$app/$app.log" + #================================================= # SPECIFIC UPGRADE #================================================= @@ -59,31 +67,6 @@ ynh_add_config --template="../conf/config.default.toml" --destination="$install_ chmod 400 "$install_dir/.dispatch/config.toml" chown $app:$app "$install_dir/.dispatch/config.toml" -#================================================= -# SETUP SYSTEMD -#================================================= -ynh_script_progression --message="Upgrading systemd configuration..." --weight=2 - -# Create a dedicated systemd config -ynh_add_systemd_config - -#================================================= -# GENERIC FINALIZATION -#================================================= -# SETUP LOGROTATE -#================================================= -ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1 - -# Use logrotate to manage app-specific logfile(s) -ynh_use_logrotate --non-append - -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." - -yunohost service add $app --description="Web-based IRC client" --log="/var/log/$app/$app.log" - #================================================= # START SYSTEMD SERVICE #=================================================