From cc67ea25624b26c76abf7c19718c5b79ca976d5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 10 Jan 2024 21:31:08 +0100 Subject: [PATCH] add change url --- scripts/change_url | 58 ++++++++++++++++++++++++++++++++++++++++++++++ tests.toml | 2 -- 2 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 scripts/change_url diff --git a/scripts/change_url b/scripts/change_url new file mode 100644 index 0000000..5530b03 --- /dev/null +++ b/scripts/change_url @@ -0,0 +1,58 @@ +#!/bin/bash + +#================================================= +# GENERIC STARTING +#================================================= +# IMPORT GENERIC HELPERS +#================================================= + +source _common.sh +source /usr/share/yunohost/helpers + +#================================================= +# STANDARD MODIFICATIONS +#================================================= +# STOP SYSTEMD SERVICE +#================================================= +ynh_script_progression --message="Stopping a systemd service..." --weight=1 + +ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" + +#================================================= +# MODIFY URL IN NGINX CONF +#================================================= +ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1 + +ynh_change_url_nginx_config + +#================================================= +# ADD A CONFIGURATION +#================================================= +ynh_script_progression --message="Adding peertube configuration file..." + +ynh_replace_string --match_string="hostname: '$old_domain'" --replace_string="hostname: '$new_domain'" --target_file="$install_dir/config/production.yaml" + +#================================================= +# SPECIFIC MODIFICATIONS +#================================================= +ynh_script_progression --message="updating host..." + +pushd "$install_dir" + ynh_use_nodejs + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$install_dir/config" NODE_ENV=production $ynh_npm run update-host +popd + +#================================================= +# GENERIC FINALISATION +#================================================= +# START SYSTEMD SERVICE +#================================================= +ynh_script_progression --message="Starting a systemd service..." --weight=1 + +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="HTTP server listening on 127.0.0.1" + +#================================================= +# END OF SCRIPT +#================================================= + +ynh_script_progression --message="Change of URL completed for $app" --last diff --git a/tests.toml b/tests.toml index 4fbe1fb..16af213 100644 --- a/tests.toml +++ b/tests.toml @@ -5,8 +5,6 @@ test_format = 1.0 # ------------ # Tests to run # ------------ - - exclude = ["change_url"] # ------------------------------- # Commits to test upgrade from