mirror of
https://github.com/YunoHost-Apps/scrutiny_ynh.git
synced 2024-09-03 20:16:24 +02:00
Fixing
This commit is contained in:
parent
f560272439
commit
b20aea1f97
6 changed files with 86 additions and 10 deletions
|
@ -52,8 +52,7 @@ ram.runtime = "50M"
|
|||
main.show_tile = true
|
||||
main.protected= true
|
||||
main.allowed = "admins"
|
||||
#api.url = "__DOMAIN____PATH__/api/" # __PATH__ in not handled by yunohost for the api in manifest.toml
|
||||
api.url = "re:__DOMAIN__/.*api/.*"
|
||||
api.url = "/api"
|
||||
api.auth_header = false
|
||||
api.show_tile = false
|
||||
api.protected= true
|
||||
|
|
81
scripts/change_url
Normal file
81
scripts/change_url
Normal file
|
@ -0,0 +1,81 @@
|
|||
#!/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="influxdb" --action="stop"
|
||||
ynh_systemd_action --service_name="scrutiny-web-server.service" --action="stop" --log_path="/var/log/$app/web-server.log"
|
||||
if [ $collector -eq 1 ]
|
||||
then
|
||||
ynh_systemd_action --service_name="scrutiny-collector.timer" --action="stop" --log_path="/var/log/$app/collector.log"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# MODIFY URL IN NGINX CONF
|
||||
#=================================================
|
||||
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
|
||||
|
||||
ynh_change_url_nginx_config
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC MODIFICATIONS
|
||||
#=================================================
|
||||
# in the change_url context, variables called new_domain, new_path, old_domain, old_path will be available, as well as change_domain and change_path equal to 0 (false) or 1 (true) depending if the domain / path changed
|
||||
#=================================================
|
||||
|
||||
if [ "$old_path" != "$new_path" ]
|
||||
then
|
||||
# Update scrutiny.yaml
|
||||
if [ "${new_path}" == "/" ]
|
||||
then
|
||||
new_base_path=""
|
||||
else
|
||||
new_base_path="\\${new_path}"
|
||||
fi
|
||||
key="basepath"
|
||||
new_value="'$new_base_path'"
|
||||
sed --regexp-extended "s/^(\s*${key}:\s*).*/\1${new_value}/" --in-place "$install_dir/config/scrutiny.yaml"
|
||||
ynh_store_file_checksum --file="$install_dir/config/scrutiny.yaml"
|
||||
|
||||
# Update collector.yaml
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
key="endpoint"
|
||||
new_value="'http:\/\/127.0.0.1:${port}${new_base_path}\/'"
|
||||
sed --regexp-extended "s/^(\s*${key}:\s*).*/\1${new_value}/" --in-place "$install_dir/config/collector.yaml"
|
||||
ynh_store_file_checksum --file="$install_dir/config/collector.yaml"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALISATION
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name="influxdb" --action="start"
|
||||
ynh_systemd_action --service_name="scrutiny-web-server.service" --action="start" --log_path="/var/log/$app/web-server.log"
|
||||
if [ $collector -eq 1 ]
|
||||
then
|
||||
systemctl daemon-reload
|
||||
ynh_systemd_action --service_name="scrutiny-collector.service" --action="start" --log_path="/var/log/$app/collector.log"
|
||||
ynh_systemd_action --service_name="scrutiny-collector.timer" --action="start" --log_path="/var/log/$app/collector.log"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Change of URL completed for $app" --last
|
|
@ -44,7 +44,7 @@ yunohost service add "scrutiny-web-server" --description="WebUI for smartd S.M.A
|
|||
ynh_add_config --template="systemd-scrutiny-collector.service" --destination="/etc/systemd/system/scrutiny-collector.service"
|
||||
if [ $collector -eq 1 ]
|
||||
then
|
||||
yunohost service add "scrutiny-collector" --description="Collector running on timer (daily) for smartd S.M.A.R.T monitoring" --log="/var/log/$app/collector.log"
|
||||
yunohost service add "scrutiny-collector" --description="Collector running on timer (daily) for smartd S.M.A.R.T monitoring" --log="/var/log/$app/collector.log" --test_status="systemctl show scrutiny-collector.service -p ActiveState --value | grep -v failed"
|
||||
fi
|
||||
|
||||
# Use logrotate to manage application logfile(s)
|
||||
|
|
|
@ -33,7 +33,7 @@ ynh_restore_file --origin_path="/etc/systemd/system/scrutiny-collector.timer"
|
|||
yunohost service add "scrutiny-web-server" --description="WebUI for smartd S.M.A.R.T monitoring" --log="/var/log/$app/web-server.log"
|
||||
if [ $collector -eq 1 ]
|
||||
then
|
||||
yunohost service add "scrutiny-collector" --description="Collector running on timer (daily) for smartd S.M.A.R.T monitoring" --log="/var/log/$app/collector.log"
|
||||
yunohost service add "scrutiny-collector" --description="Collector running on timer (daily) for smartd S.M.A.R.T monitoring" --log="/var/log/$app/collector.log" --test_status="systemctl show scrutiny-collector.service -p ActiveState --value | grep -v failed"
|
||||
fi
|
||||
|
||||
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
||||
|
|
|
@ -67,7 +67,7 @@ yunohost service add "scrutiny-web-server" --description="WebUI for smartd S.M.A
|
|||
ynh_add_config --template="systemd-scrutiny-collector.service" --destination="/etc/systemd/system/scrutiny-collector.service"
|
||||
if [ $collector -eq 1 ]
|
||||
then
|
||||
yunohost service add "scrutiny-collector" --description="Collector running on timer (daily) for smartd S.M.A.R.T monitoring" --log="/var/log/$app/collector.log"
|
||||
yunohost service add "scrutiny-collector" --description="Collector running on timer (daily) for smartd S.M.A.R.T monitoring" --log="/var/log/$app/collector.log" --test_status="systemctl show scrutiny-collector.service -p ActiveState --value | grep -v failed"
|
||||
fi
|
||||
|
||||
ynh_use_logrotate --specific_user="$app" --non-append
|
||||
|
|
|
@ -19,7 +19,3 @@ test_format = 1.0
|
|||
# -------------------------------
|
||||
|
||||
|
||||
|
||||
[some_additional_testsuite]
|
||||
|
||||
args.collector = false
|
||||
|
|
Loading…
Reference in a new issue