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
4e8f401e7e
commit
f560272439
14 changed files with 80 additions and 101 deletions
|
@ -23,7 +23,6 @@ version: 1
|
|||
host:
|
||||
id: "yunohost"
|
||||
|
||||
|
||||
# This block allows you to override/customize the settings for devices detected by
|
||||
# Scrutiny via `smartctl --scan`
|
||||
# See the "--device=TYPE" section of https://linux.die.net/man/8/smartctl
|
||||
|
@ -62,16 +61,13 @@ devices:
|
|||
# metrics_info_args: '--info --json -T permissive' # used to determine device unique ID & register device with Scrutiny
|
||||
# metrics_smart_args: '--xall --json -T permissive' # used to retrieve smart data for each device.
|
||||
|
||||
|
||||
log:
|
||||
file: /var/log/__APP__/__APP__-collector.log
|
||||
file: /var/log/__APP__/collector.log
|
||||
level: INFO
|
||||
#
|
||||
|
||||
api:
|
||||
# endpoint: 'https://__DOMAIN____PATH__/'
|
||||
endpoint: 'http://localhost:8080__PATH__/'
|
||||
# endpoint: 'http://localhost:8080'
|
||||
# endpoint: 'http://localhost:8080/custombasepath'
|
||||
endpoint: 'http://127.0.0.1:__PORT____PATH__/'
|
||||
# if you need to use a custom base path (for a reverse proxy), you can add a suffix to the endpoint.
|
||||
# See docs/TROUBLESHOOTING_REVERSE_PROXY.md for more info,
|
||||
|
||||
|
@ -97,4 +93,3 @@ api:
|
|||
# short:
|
||||
# enable: false
|
||||
# command: ''
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ web:
|
|||
# see docs/TROUBLESHOOTING_REVERSE_PROXY.md
|
||||
# basepath: `/scrutiny`
|
||||
# leave empty unless behind a path prefixed proxy
|
||||
basepath: '__PATH__'
|
||||
basepath: '__BASE_PATH__'
|
||||
database:
|
||||
# can also set absolute path here
|
||||
location: __INSTALL_DIR__/config/scrutiny.db
|
||||
|
@ -56,7 +56,7 @@ web:
|
|||
# insecure_skip_verify: false
|
||||
|
||||
log:
|
||||
file: /var/log/__APP__/__APP__-web-server.log
|
||||
file: /var/log/__APP__/web-server.log
|
||||
level: INFO
|
||||
|
||||
# Notification "urls" look like the following. For more information about service specific configuration see
|
||||
|
|
|
@ -4,6 +4,7 @@ After=network-online.target scrutiny-web-server.service
|
|||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
# Only root can fully execute smartcl features
|
||||
User=root
|
||||
Group=root
|
||||
WorkingDirectory=__INSTALL_DIR__
|
||||
|
@ -11,7 +12,7 @@ LogsDirectory=__APP__
|
|||
StateDirectory=__APP__
|
||||
ExecStart=__INSTALL_DIR__/bin/scrutiny-collector-metrics-linux-amd64 run --config __INSTALL_DIR__/config/collector.yaml
|
||||
Restart=no
|
||||
StandardOutput=append:/var/log/__APP__/__APP__-collector.log
|
||||
StandardOutput=append:/var/log/__APP__/collector.log
|
||||
StandardError=inherit
|
||||
|
||||
# Sandboxing options to harden security
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
[Unit]
|
||||
Description=Scrutiny Collector timer
|
||||
Description=Scrutiny Collector Timer
|
||||
|
||||
[Timer]
|
||||
OnCalendar=daily
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
[Unit]
|
||||
Description=Scrutiny web server
|
||||
Description=Scrutiny Web Server
|
||||
After=network-online.target
|
||||
|
||||
[Service]
|
||||
|
@ -12,7 +12,7 @@ StateDirectory=__APP__
|
|||
ExecStart=__INSTALL_DIR__/bin/scrutiny-web-linux-amd64 start --config __INSTALL_DIR__/config/scrutiny.yaml
|
||||
Restart=always
|
||||
RestartSec=10s
|
||||
StandardOutput=append:/var/log/__APP__/__APP__-web-server.log
|
||||
StandardOutput=append:/var/log/__APP__/web-server.log
|
||||
StandardError=inherit
|
||||
|
||||
# Sandboxing options to harden security
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
For any collector not on that host, you should change the `--api-endpoint`.
|
||||
For any collector not on that host...
|
||||
|
||||
...refer to the documentation at [https://github.com/AnalogJ/scrutiny/blob/master/docs/INSTALL_MANUAL.md#collector](https://github.com/AnalogJ/scrutiny/blob/master/docs/INSTALL_MANUAL.md#collector)
|
||||
|
||||
...change the `--api-endpoint`
|
||||
|
||||
For example :
|
||||
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
For any collector not on that host, you should change the `--api-endpoint`.
|
||||
For any collector not on that host...
|
||||
|
||||
...refer to the documentation at [https://github.com/AnalogJ/scrutiny/blob/master/docs/INSTALL_MANUAL.md#collector](https://github.com/AnalogJ/scrutiny/blob/master/docs/INSTALL_MANUAL.md#collector)
|
||||
|
||||
...change the `--api-endpoint`
|
||||
|
||||
For example :
|
||||
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
For any collector not on that host, you should change the `--api-endpoint`.
|
||||
For any collector not on that host...
|
||||
|
||||
...refer to the documentation at [https://github.com/AnalogJ/scrutiny/blob/master/docs/INSTALL_MANUAL.md#collector](https://github.com/AnalogJ/scrutiny/blob/master/docs/INSTALL_MANUAL.md#collector)
|
||||
|
||||
...change the `--api-endpoint`
|
||||
|
||||
For example :
|
||||
|
||||
> `/opt/scrutiny/bin/scrutiny-collector-metrics-linux-amd64 run --api-endpoint https://__DOMAIN____PATH__`
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ fund = "https://paypal.me/analogj/usd10"
|
|||
[integration]
|
||||
yunohost = ">= 11.1.6"
|
||||
architectures = ["amd64", "arm64"]
|
||||
multi_instance = true
|
||||
multi_instance = false
|
||||
ldap = "not_relevant"
|
||||
sso = "not_relevant"
|
||||
disk = "50M"
|
||||
|
@ -34,7 +34,7 @@ ram.runtime = "50M"
|
|||
|
||||
[install.collector]
|
||||
ask.en = "Should the collector be activated on this host?"
|
||||
ask.fr = "Le collector doit-il est activé sur cet host ?"
|
||||
help.en = "Let it to true if yunohost is running on bare metal (i.e. not in a VM or in a LXC)"
|
||||
type = "boolean"
|
||||
default = true
|
||||
|
||||
|
|
|
@ -1,47 +0,0 @@
|
|||
#!/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="/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# MODIFY URL IN NGINX CONF
|
||||
#=================================================
|
||||
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
|
||||
|
||||
ynh_change_url_nginx_config
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC MODIFICATIONS
|
||||
#=================================================
|
||||
# ...
|
||||
#=================================================
|
||||
|
||||
#=================================================
|
||||
# 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="/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Change of URL completed for $app" --last
|
|
@ -17,10 +17,12 @@ source /usr/share/yunohost/helpers
|
|||
ynh_script_progression --message="Setting up source files..." --weight=1
|
||||
|
||||
mkdir -p "$install_dir/bin"
|
||||
if [ $YNH_ARCH == "amd64" ]; then
|
||||
if [ $YNH_ARCH == "amd64" ]
|
||||
then
|
||||
ynh_setup_source --source_id="src/scrutiny-web-linux-amd64" --dest_dir="$install_dir/bin"
|
||||
ynh_setup_source --source_id="src/scrutiny-collector-metrics-linux-amd64" --dest_dir="$install_dir/bin"
|
||||
elif [ $YNH_ARCH == "arm64" ]; then
|
||||
elif [ $YNH_ARCH == "arm64" ]
|
||||
then
|
||||
ynh_setup_source --source_id="src/scrutiny-web-linux-arm64" --dest_dir="$install_dir/bin"
|
||||
ynh_setup_source --source_id="src/scrutiny-collector-metrics-linux-arm64" --dest_dir="$install_dir/bin"
|
||||
fi
|
||||
|
@ -37,11 +39,12 @@ ynh_add_nginx_config
|
|||
|
||||
# Create a dedicated systemd config
|
||||
ynh_add_systemd_config --service="scrutiny-web-server" --template="systemd-scrutiny-web-server.service"
|
||||
yunohost service add "scrutiny-web-server" --description="WebUI for smartd S.M.A.R.T monitoring" --log="/var/log/$app/$app-web-server.log"
|
||||
yunohost service add "scrutiny-web-server" --description="WebUI for smartd S.M.A.R.T monitoring" --log="/var/log/$app/web-server.log"
|
||||
|
||||
ynh_add_config --template="systemd-scrutiny-collector.service" --destination="/etc/systemd/system/scrutiny-collector.service"
|
||||
if [ $collector ]; then
|
||||
yunohost service add "scrutiny-collector.timer" --description="Collector timer for smartd S.M.A.R.T monitoring" --log="/var/log/$app/$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"
|
||||
fi
|
||||
|
||||
# Use logrotate to manage application logfile(s)
|
||||
|
@ -55,6 +58,12 @@ ynh_use_logrotate --specific_user="$app"
|
|||
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
||||
|
||||
mkdir -p "$install_dir/config"
|
||||
if [ "${path}" == "/" ]
|
||||
then
|
||||
base_path=""
|
||||
else
|
||||
base_path="${path}"
|
||||
fi
|
||||
ynh_add_config --template="config/scrutiny.yaml" --destination="$install_dir/config/scrutiny.yaml"
|
||||
|
||||
ynh_add_config --template="systemd-scrutiny-collector.timer" --destination="/etc/systemd/system/scrutiny-collector.timer"
|
||||
|
@ -74,13 +83,14 @@ myynh_set_permissions
|
|||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||
ynh_systemd_action --service_name="influxdb" --action="enable"
|
||||
ynh_systemd_action --service_name="influxdb" --action="start"
|
||||
ynh_systemd_action --service_name="scrutiny-web-server.service" --action="start" --log_path="/var/log/$app/scrutiny-web-server.log"
|
||||
if [ $collector ]; then
|
||||
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="enable"
|
||||
ynh_systemd_action --service_name="scrutiny-collector.service" --action="start" --log_path="/var/log/$app/scrutiny-collector.log"
|
||||
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="enable"
|
||||
ynh_systemd_action --service_name="scrutiny-collector.timer" --action="start"
|
||||
ynh_systemd_action --service_name="scrutiny-collector.timer" --action="start" --log_path="/var/log/$app/collector.log"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -25,21 +25,18 @@ fi
|
|||
|
||||
if ynh_exec_warn_less yunohost service status "scrutiny-collector" >/dev/null
|
||||
then
|
||||
ynh_script_progression --message="Removing scrutiny-collector timer integration..." --weight=1
|
||||
ynh_script_progression --message="Removing scrutiny-collector service integration..." --weight=1
|
||||
yunohost service remove "scrutiny-collector"
|
||||
fi
|
||||
|
||||
ynh_remove_systemd_config --service="scrutiny-web-server"
|
||||
ynh_remove_systemd_config --service="scrutiny-collector"
|
||||
ynh_secure_remove --file="/etc/systemd/system/scrutiny-collector.timer"
|
||||
|
||||
ynh_remove_nginx_config
|
||||
|
||||
ynh_remove_logrotate
|
||||
|
||||
if [ $collector ]; then
|
||||
ynh_secure_remove --file="/etc/systemd/system/scrutiny-collector.timer"
|
||||
fi
|
||||
|
||||
ynh_secure_remove --file="/var/log/$app"
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -30,9 +30,10 @@ systemctl enable "/etc/systemd/system/scrutiny-web-server.service" --quiet
|
|||
ynh_restore_file --origin_path="/etc/systemd/system/scrutiny-collector.service"
|
||||
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/$app-web-server.log"
|
||||
if [ $collector ]; then
|
||||
yunohost service add "scrutiny-collector.timer" --description="Collector timer for smartd S.M.A.R.T monitoring" --log="/var/log/$app/$app-web-server.log"
|
||||
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"
|
||||
fi
|
||||
|
||||
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
||||
|
@ -47,13 +48,14 @@ ynh_script_progression --message="Reloading NGINX web server and $app's service.
|
|||
|
||||
# Typically you only have either $app or php-fpm but not both at the same time...
|
||||
ynh_systemd_action --service_name="influxdb" --action="start"
|
||||
ynh_systemd_action --service_name="scrutiny-web-server.service" --action="start" --log_path="/var/log/$app/scrutiny-web-server.log"
|
||||
if [ $collector ]; then
|
||||
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="enable"
|
||||
ynh_systemd_action --service_name="scrutiny-collector.service" --action="start" --log_path="/var/log/$app/scrutiny-collector.log"
|
||||
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="enable"
|
||||
ynh_systemd_action --service_name="scrutiny-collector.timer" --action="start"
|
||||
ynh_systemd_action --service_name="scrutiny-collector.timer" --action="start" --log_path="/var/log/$app/collector.log"
|
||||
fi
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
|
|
@ -24,11 +24,11 @@ upgrade_type=$(ynh_check_app_version_changed)
|
|||
#=================================================
|
||||
ynh_script_progression --message="Stopping a systemd service..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
|
||||
ynh_systemd_action --service_name="influxdb" --action="stop"
|
||||
ynh_systemd_action --service_name="scrutiny-web-server.service" --action="stop" --log_path="/var/log/$app/scrutiny-web-server.log"
|
||||
if [ $collector ]; then
|
||||
ynh_systemd_action --service_name="scrutiny-collector.timer" --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
|
||||
|
||||
#=================================================
|
||||
|
@ -42,10 +42,12 @@ then
|
|||
ynh_script_progression --message="Upgrading source files..." --weight=1
|
||||
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
if [ $YNH_ARCH == "amd64" ]; then
|
||||
if [ $YNH_ARCH == "amd64" ]
|
||||
then
|
||||
ynh_setup_source --source_id="src/scrutiny-web-linux-amd64" --dest_dir="$install_dir/bin"
|
||||
ynh_setup_source --source_id="src/scrutiny-collector-metrics-linux-amd64" --dest_dir="$install_dir/bin"
|
||||
elif [ $YNH_ARCH == "arm64" ]; then
|
||||
elif [ $YNH_ARCH == "arm64" ]
|
||||
then
|
||||
ynh_setup_source --source_id="src/scrutiny-web-linux-arm64" --dest_dir="$install_dir/bin"
|
||||
ynh_setup_source --source_id="src/scrutiny-collector-metrics-linux-arm64" --dest_dir="$install_dir/bin"
|
||||
fi
|
||||
|
@ -60,11 +62,12 @@ ynh_script_progression --message="Upgrading system configurations related to $ap
|
|||
ynh_add_nginx_config
|
||||
|
||||
ynh_add_systemd_config --service="scrutiny-web-server" --template="systemd-scrutiny-web-server.service"
|
||||
yunohost service add "scrutiny-web-server" --description="WebUI for smartd S.M.A.R.T monitoring" --log="/var/log/$app/$app-web-server.log"
|
||||
yunohost service add "scrutiny-web-server" --description="WebUI for smartd S.M.A.R.T monitoring" --log="/var/log/$app/web-server.log"
|
||||
|
||||
ynh_add_config --template="systemd-scrutiny-collector.service" --destination="/etc/systemd/system/scrutiny-collector.service"
|
||||
if [ $collector ]; then
|
||||
yunohost service add "scrutiny-collector.timer" --description="Collector timer for smartd S.M.A.R.T monitoring" --log="/var/log/$app/$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"
|
||||
fi
|
||||
|
||||
ynh_use_logrotate --specific_user="$app" --non-append
|
||||
|
@ -76,6 +79,12 @@ ynh_use_logrotate --specific_user="$app" --non-append
|
|||
#=================================================
|
||||
ynh_script_progression --message="Updating a configuration file..." --weight=1
|
||||
|
||||
if [ "${path}" == "/" ]
|
||||
then
|
||||
base_path=""
|
||||
else
|
||||
base_path="${path}"
|
||||
fi
|
||||
ynh_add_config --template="config/scrutiny.yaml" --destination="$install_dir/config/scrutiny.yaml"
|
||||
|
||||
ynh_add_config --template="systemd-scrutiny-collector.timer" --destination="/etc/systemd/system/scrutiny-collector.timer"
|
||||
|
@ -93,13 +102,14 @@ myynh_set_permissions
|
|||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||
ynh_systemd_action --service_name="influxdb" --action="enable"
|
||||
ynh_systemd_action --service_name="influxdb" --action="start"
|
||||
ynh_systemd_action --service_name="scrutiny-web-server.service" --action="start" --log_path="/var/log/$app/scrutiny-web-server.log"
|
||||
if [ $collector ]; then
|
||||
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="enable"
|
||||
ynh_systemd_action --service_name="scrutiny-collector.service" --action="start" --log_path="/var/log/$app/scrutiny-collector.log"
|
||||
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="enable"
|
||||
ynh_systemd_action --service_name="scrutiny-collector.timer" --action="start"
|
||||
ynh_systemd_action --service_name="scrutiny-collector.timer" --action="start" --log_path="/var/log/$app/collector.log"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
|
Loading…
Reference in a new issue