1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/scrutiny_ynh.git synced 2024-09-03 20:16:24 +02:00
This commit is contained in:
ewilly 2024-09-02 16:20:40 +00:00 committed by GitHub
commit 61cd94e777
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 241 additions and 178 deletions

1
.gitignore vendored
View file

@ -1,2 +1,3 @@
*~
*.sw[op]
.DS_Store

View file

@ -5,4 +5,6 @@
- [Irakurri README euskaraz](README_eu.md)
- [Lire le README en français](README_fr.md)
- [Le o README en galego](README_gl.md)
- [Baca README dalam bahasa bahasa Indonesia](README_id.md)
- [Прочитать README на русский](README_ru.md)
- [阅读中文(简体)的 README](README_zh_Hans.md)

View file

@ -5,7 +5,7 @@ It shall NOT be edited by hand.
# Scrutiny for YunoHost
[![Integration level](https://dash.yunohost.org/integration/scrutiny.svg)](https://dash.yunohost.org/appci/app/scrutiny) ![Working status](https://ci-apps.yunohost.org/ci/badges/scrutiny.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/scrutiny.maintain.svg)
[![Integration level](https://dash.yunohost.org/integration/scrutiny.svg)](https://ci-apps.yunohost.org/ci/apps/scrutiny/) ![Working status](https://ci-apps.yunohost.org/ci/badges/scrutiny.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/scrutiny.maintain.svg)
[![Install Scrutiny with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=scrutiny)

View file

@ -5,7 +5,7 @@ No se debe editar a mano.
# Scrutiny para Yunohost
[![Nivel de integración](https://dash.yunohost.org/integration/scrutiny.svg)](https://dash.yunohost.org/appci/app/scrutiny) ![Estado funcional](https://ci-apps.yunohost.org/ci/badges/scrutiny.status.svg) ![Estado En Mantención](https://ci-apps.yunohost.org/ci/badges/scrutiny.maintain.svg)
[![Nivel de integración](https://dash.yunohost.org/integration/scrutiny.svg)](https://ci-apps.yunohost.org/ci/apps/scrutiny/) ![Estado funcional](https://ci-apps.yunohost.org/ci/badges/scrutiny.status.svg) ![Estado En Mantención](https://ci-apps.yunohost.org/ci/badges/scrutiny.maintain.svg)
[![Instalar Scrutiny con Yunhost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=scrutiny)

View file

@ -5,7 +5,7 @@ EZ editatu eskuz.
# Scrutiny YunoHost-erako
[![Integrazio maila](https://dash.yunohost.org/integration/scrutiny.svg)](https://dash.yunohost.org/appci/app/scrutiny) ![Funtzionamendu egoera](https://ci-apps.yunohost.org/ci/badges/scrutiny.status.svg) ![Mantentze egoera](https://ci-apps.yunohost.org/ci/badges/scrutiny.maintain.svg)
[![Integrazio maila](https://dash.yunohost.org/integration/scrutiny.svg)](https://ci-apps.yunohost.org/ci/apps/scrutiny/) ![Funtzionamendu egoera](https://ci-apps.yunohost.org/ci/badges/scrutiny.status.svg) ![Mantentze egoera](https://ci-apps.yunohost.org/ci/badges/scrutiny.maintain.svg)
[![Instalatu Scrutiny YunoHost-ekin](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=scrutiny)

View file

@ -5,7 +5,7 @@ Il NE doit PAS être modifié à la main.
# Scrutiny pour YunoHost
[![Niveau dintégration](https://dash.yunohost.org/integration/scrutiny.svg)](https://dash.yunohost.org/appci/app/scrutiny) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/scrutiny.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/scrutiny.maintain.svg)
[![Niveau dintégration](https://dash.yunohost.org/integration/scrutiny.svg)](https://ci-apps.yunohost.org/ci/apps/scrutiny/) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/scrutiny.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/scrutiny.maintain.svg)
[![Installer Scrutiny avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=scrutiny)

View file

@ -5,7 +5,7 @@ NON debe editarse manualmente.
# Scrutiny para YunoHost
[![Nivel de integración](https://dash.yunohost.org/integration/scrutiny.svg)](https://dash.yunohost.org/appci/app/scrutiny) ![Estado de funcionamento](https://ci-apps.yunohost.org/ci/badges/scrutiny.status.svg) ![Estado de mantemento](https://ci-apps.yunohost.org/ci/badges/scrutiny.maintain.svg)
[![Nivel de integración](https://dash.yunohost.org/integration/scrutiny.svg)](https://ci-apps.yunohost.org/ci/apps/scrutiny/) ![Estado de funcionamento](https://ci-apps.yunohost.org/ci/badges/scrutiny.status.svg) ![Estado de mantemento](https://ci-apps.yunohost.org/ci/badges/scrutiny.maintain.svg)
[![Instalar Scrutiny con YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=scrutiny)

63
README_id.md Normal file
View file

@ -0,0 +1,63 @@
<!--
N.B.: README ini dibuat secara otomatis oleh <https://github.com/YunoHost/apps/tree/master/tools/readme_generator>
Ini TIDAK boleh diedit dengan tangan.
-->
# Scrutiny untuk YunoHost
[![Tingkat integrasi](https://dash.yunohost.org/integration/scrutiny.svg)](https://ci-apps.yunohost.org/ci/apps/scrutiny/) ![Status kerja](https://ci-apps.yunohost.org/ci/badges/scrutiny.status.svg) ![Status pemeliharaan](https://ci-apps.yunohost.org/ci/badges/scrutiny.maintain.svg)
[![Pasang Scrutiny dengan YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=scrutiny)
*[Baca README ini dengan bahasa yang lain.](./ALL_README.md)*
> *Paket ini memperbolehkan Anda untuk memasang Scrutiny secara cepat dan mudah pada server YunoHost.*
> *Bila Anda tidak mempunyai YunoHost, silakan berkonsultasi dengan [panduan](https://yunohost.org/install) untuk mempelajari bagaimana untuk memasangnya.*
## Ringkasan
**Scrutiny is a Hard Drive Health Dashboard & Monitoring solution, merging manufacturer provided S.M.A.R.T metrics with real-world failure rates.**
> NOTE: Scrutiny is a Work-in-Progress and still has some rough edges.
### Features
Scrutiny is a simple but focused application, with a couple of core features:
- Web UI Dashboard - focused on Critical metrics
- `smartd` integration (no re-inventing the wheel)
- Auto-detection of all connected hard-drives
- S.M.A.R.T metric tracking for historical trends
- Customized thresholds using real world failure rates
- Temperature tracking
- Provided as an all-in-one Docker image (but can be installed manually)
- Configurable Alerting/Notifications via Webhooks
- (Future) Hard Drive performance testing & tracking
**Versi terkirim:** 0.8.1~ynh1
## Tangkapan Layar
![Tangkapan Layar pada Scrutiny](./doc/screenshots/dashboard.png)
## Dokumentasi dan sumber daya
- Dokumentasi admin resmi: <https://github.com/AnalogJ/scrutiny/tree/master/docs>
- Depot kode aplikasi hulu: <https://github.com/AnalogJ/scrutiny>
- Gudang YunoHost: <https://apps.yunohost.org/app/scrutiny>
- Laporkan bug: <https://github.com/YunoHost-Apps/scrutiny_ynh/issues>
## Info developer
Silakan kirim pull request ke [`testing` branch](https://github.com/YunoHost-Apps/scrutiny_ynh/tree/testing).
Untuk mencoba branch `testing`, silakan dilanjutkan seperti:
```bash
sudo yunohost app install https://github.com/YunoHost-Apps/scrutiny_ynh/tree/testing --debug
atau
sudo yunohost app upgrade scrutiny -u https://github.com/YunoHost-Apps/scrutiny_ynh/tree/testing --debug
```
**Info lebih lanjut mengenai pemaketan aplikasi:** <https://yunohost.org/packaging_apps>

63
README_ru.md Normal file
View file

@ -0,0 +1,63 @@
<!--
Важно: этот README был автоматически сгенерирован <https://github.com/YunoHost/apps/tree/master/tools/readme_generator>
Он НЕ ДОЛЖЕН редактироваться вручную.
-->
# Scrutiny для YunoHost
[![Уровень интеграции](https://dash.yunohost.org/integration/scrutiny.svg)](https://ci-apps.yunohost.org/ci/apps/scrutiny/) ![Состояние работы](https://ci-apps.yunohost.org/ci/badges/scrutiny.status.svg) ![Состояние сопровождения](https://ci-apps.yunohost.org/ci/badges/scrutiny.maintain.svg)
[![Установите Scrutiny с YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=scrutiny)
*[Прочтите этот README на других языках.](./ALL_README.md)*
> *Этот пакет позволяет Вам установить Scrutiny быстро и просто на YunoHost-сервер.*
> *Если у Вас нет YunoHost, пожалуйста, посмотрите [инструкцию](https://yunohost.org/install), чтобы узнать, как установить его.*
## Обзор
**Scrutiny is a Hard Drive Health Dashboard & Monitoring solution, merging manufacturer provided S.M.A.R.T metrics with real-world failure rates.**
> NOTE: Scrutiny is a Work-in-Progress and still has some rough edges.
### Features
Scrutiny is a simple but focused application, with a couple of core features:
- Web UI Dashboard - focused on Critical metrics
- `smartd` integration (no re-inventing the wheel)
- Auto-detection of all connected hard-drives
- S.M.A.R.T metric tracking for historical trends
- Customized thresholds using real world failure rates
- Temperature tracking
- Provided as an all-in-one Docker image (but can be installed manually)
- Configurable Alerting/Notifications via Webhooks
- (Future) Hard Drive performance testing & tracking
**Поставляемая версия:** 0.8.1~ynh1
## Снимки экрана
![Снимок экрана Scrutiny](./doc/screenshots/dashboard.png)
## Документация и ресурсы
- Официальная документация администратора: <https://github.com/AnalogJ/scrutiny/tree/master/docs>
- Репозиторий кода главной ветки приложения: <https://github.com/AnalogJ/scrutiny>
- Магазин YunoHost: <https://apps.yunohost.org/app/scrutiny>
- Сообщите об ошибке: <https://github.com/YunoHost-Apps/scrutiny_ynh/issues>
## Информация для разработчиков
Пришлите Ваш запрос на слияние в [ветку `testing`](https://github.com/YunoHost-Apps/scrutiny_ynh/tree/testing).
Чтобы попробовать ветку `testing`, пожалуйста, сделайте что-то вроде этого:
```bash
sudo yunohost app install https://github.com/YunoHost-Apps/scrutiny_ynh/tree/testing --debug
или
sudo yunohost app upgrade scrutiny -u https://github.com/YunoHost-Apps/scrutiny_ynh/tree/testing --debug
```
**Больше информации о пакетировании приложений:** <https://yunohost.org/packaging_apps>

View file

@ -5,7 +5,7 @@
# YunoHost 上的 Scrutiny
[![集成程度](https://dash.yunohost.org/integration/scrutiny.svg)](https://dash.yunohost.org/appci/app/scrutiny) ![工作状态](https://ci-apps.yunohost.org/ci/badges/scrutiny.status.svg) ![维护状态](https://ci-apps.yunohost.org/ci/badges/scrutiny.maintain.svg)
[![集成程度](https://dash.yunohost.org/integration/scrutiny.svg)](https://ci-apps.yunohost.org/ci/apps/scrutiny/) ![工作状态](https://ci-apps.yunohost.org/ci/badges/scrutiny.status.svg) ![维护状态](https://ci-apps.yunohost.org/ci/badges/scrutiny.maintain.svg)
[![使用 YunoHost 安装 Scrutiny](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=scrutiny)

View file

@ -15,7 +15,8 @@ code = "https://github.com/AnalogJ/scrutiny"
fund = "https://paypal.me/analogj/usd10"
[integration]
yunohost = ">= 11.2"
yunohost = ">= 11.2.18"
helpers_version = "2.1"
architectures = ["amd64", "arm64"]
multi_instance = false
ldap = "not_relevant"
@ -41,7 +42,7 @@ ram.runtime = "50M"
[resources]
[resources.sources]
[resources.sources.main]
[resources.sources.scrutiny-web-linux]
in_subdir = false
rename = "scrutiny-web-linux"
amd64.url = "https://github.com/AnalogJ/scrutiny/releases/download/v0.8.1/scrutiny-web-linux-amd64"
@ -55,6 +56,7 @@ ram.runtime = "50M"
[resources.sources.scrutiny-collector-metrics-linux]
in_subdir = false
rename = "scrutiny-collector-metrics-linux"
amd64.url = "https://github.com/AnalogJ/scrutiny/releases/download/v0.8.1/scrutiny-collector-metrics-linux-amd64"
amd64.sha256 = "904056ddc4e0bd3455a0db45d56f98084135a967eef018d18bfc8e4c0ef6887e"
arm64.url = "https://github.com/AnalogJ/scrutiny/releases/download/v0.8.1/scrutiny-collector-metrics-linux-arm64"
@ -75,9 +77,6 @@ ram.runtime = "50M"
[resources.system_user]
[resources.install_dir]
dir = "/var/www/__APP__"
owner = "__APP__:rwx"
group = "__APP__:rx"
[resources.permissions]
main.url = "/"

View file

@ -1,25 +1,12 @@
#!/bin/bash
#=================================================
# COMMON VARIABLES
#=================================================
ynh_arch="$YNH_ARCH"
#=================================================
# PERSONAL HELPERS
# COMMON VARIABLES AND CUSTOM HELPERS
#=================================================
myynh_set_permissions () {
chown -R $app: "$install_dir"
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir"
chmod -R +x "$install_dir/bin/"
chown -R $app: "$install_dir"
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir"
chmod -R +x "$install_dir/bin/"
}
#=================================================
# EXPERIMENTAL HELPERS
#=================================================
#=================================================
# FUTURE OFFICIAL HELPERS
#=================================================

View file

@ -1,30 +1,21 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
ynh_print_info --message="Declaring files to be backed up..."
ynh_print_info "Declaring files to be backed up..."
#=================================================
# BACKUP THE APP MAIN DIR
#=================================================
ynh_backup --src_path="$install_dir"
ynh_backup "$install_dir"
#=================================================
# BACKUP THE NGINX CONFIGURATION
#=================================================
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# SPECIFIC BACKUP
@ -32,19 +23,19 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
# BACKUP LOGROTATE
#=================================================
ynh_backup --src_path="/etc/logrotate.d/$app"
ynh_backup --src_path="/var/log/$app"
ynh_backup "/etc/logrotate.d/$app"
ynh_backup "/var/log/$app"
#=================================================
# BACKUP SYSTEMD
#=================================================
ynh_backup --src_path="/etc/systemd/system/scrutiny-web-server.service"
ynh_backup --src_path="/etc/systemd/system/scrutiny-collector.service"
ynh_backup --src_path="/etc/systemd/system/scrutiny-collector.timer"
ynh_backup "/etc/systemd/system/scrutiny-web-server.service"
ynh_backup "/etc/systemd/system/scrutiny-collector.service"
ynh_backup "/etc/systemd/system/scrutiny-collector.timer"
#=================================================
# END OF SCRIPT
#=================================================
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."

View file

@ -1,34 +1,26 @@
#!/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_script_progression "Stopping $app's systemd service..."
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"
ynh_systemctl --service="influxdb" --action="stop"
ynh_systemctl --service="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"
ynh_systemctl --service="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_script_progression "Updating NGINX web server configuration..."
ynh_change_url_nginx_config
ynh_config_change_url_nginx
#=================================================
# SPECIFIC MODIFICATIONS
@ -48,34 +40,32 @@ then
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"
ynh_store_file_checksum "$install_dir/config/scrutiny.yaml"
# Update collector.yaml
port=$(ynh_app_setting_get --app=$app --key=port)
port=$(ynh_app_setting_get --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"
ynh_store_file_checksum "$install_dir/config/collector.yaml"
fi
#=================================================
# GENERIC FINALISATION
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_script_progression "Starting $app's systemd service..."
systemctl daemon-reload
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"
ynh_systemctl --service="influxdb" --action="start"
ynh_systemctl --service="scrutiny-web-server.service" --action="start" --log_path="/var/log/$app/web-server.log"
if [ $collector -eq 1 ]
then
ynh_systemd_action --service_name="scrutiny-collector.timer" --action="start" --log_path="/var/log/$app/collector.log"
ynh_systemctl --service="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
ynh_script_progression "Change of URL completed for $app"

View file

@ -1,11 +1,5 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
@ -14,10 +8,10 @@ source /usr/share/yunohost/helpers
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..." --weight=1
ynh_script_progression "Setting up source files..."
mkdir -p "$install_dir/bin"
ynh_setup_source --source_id="main" --dest_dir="$install_dir/bin"
ynh_setup_source --source_id="scrutiny-web-linux" --dest_dir="$install_dir/bin"
ynh_setup_source --source_id="scrutiny-collector-metrics-linux" --dest_dir="$install_dir/bin"
mkdir -p "$install_dir/web"
@ -26,30 +20,30 @@ ynh_setup_source --source_id="scrutiny-web-frontend" --dest_dir="$install_dir/we
#=================================================
# SYSTEM CONFIGURATION
#=================================================
ynh_script_progression --message="Adding system configurations related to $app ..." --weight=1
ynh_script_progression "Adding system configurations related to $app ..."
# Create a dedicated NGINX config using the conf/nginx.conf template
ynh_add_nginx_config
ynh_config_add_nginx
# Create a dedicated systemd config
ynh_add_systemd_config --service="scrutiny-web-server" --template="systemd-scrutiny-web-server.service"
ynh_config_add_systemd --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/web-server.log" --test_status="systemctl show scrutiny-web-server.service -p ActiveState --value | grep -v failed"
ynh_add_config --template="systemd-scrutiny-collector.service" --destination="/etc/systemd/system/scrutiny-collector.service"
ynh_config_add --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" --test_status="systemctl show scrutiny-collector.service -p ActiveState --value | grep -v failed"
fi
# Use logrotate to manage application logfile(s)
ynh_use_logrotate --specific_user="$app"
ynh_config_add_logrotate
#=================================================
# APP INITIAL CONFIGURATION
#=================================================
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Adding a configuration file..." --weight=1
ynh_script_progression "Adding $app's configuration..."
mkdir -p "$install_dir/config"
if [ "${path}" == "/" ]
@ -58,10 +52,10 @@ then
else
base_path="${path}"
fi
ynh_add_config --template="config/scrutiny.yaml" --destination="$install_dir/config/scrutiny.yaml"
ynh_config_add --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"
ynh_add_config --template="config/collector.yaml" --destination="$install_dir/config/collector.yaml"
ynh_config_add --template="systemd-scrutiny-collector.timer" --destination="/etc/systemd/system/scrutiny-collector.timer"
ynh_config_add --template="config/collector.yaml" --destination="$install_dir/config/collector.yaml"
#=================================================
# SET FILE OWNERSHIP / PERMISSIONS
@ -69,26 +63,24 @@ ynh_add_config --template="config/collector.yaml" --destination="$install_dir/co
myynh_set_permissions
#=================================================
# GENERIC FINALIZATION
#=================================================
# START SYSTEMD SERVICE
#=================================================
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_script_progression "Starting $app's systemd service..."
ynh_systemctl --service="influxdb" --action="enable"
ynh_systemctl --service="influxdb" --action="start"
ynh_systemd_action --service_name="scrutiny-web-server.service" --action="enable"
ynh_systemd_action --service_name="scrutiny-web-server.service" --action="start" --log_path="/var/log/$app/web-server.log"
ynh_systemctl --service="scrutiny-web-server.service" --action="enable"
ynh_systemctl --service="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.timer" --action="enable"
ynh_systemd_action --service_name="scrutiny-collector.timer" --action="start" --log_path="/var/log/$app/collector.log"
ynh_systemctl --service="scrutiny-collector.timer" --action="enable"
ynh_systemctl --service="scrutiny-collector.timer" --action="start" --log_path="/var/log/$app/collector.log"
fi
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of $app completed" --last
ynh_script_progression "Installation of $app completed"

View file

@ -1,44 +1,39 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# REMOVE SYSTEM CONFIGURATIONS
#=================================================
# REMOVE SYSTEMD SERVICE
# REMOVE SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
ynh_script_progression "Removing system configurations related to $app..."
if ynh_exec_warn_less yunohost service status "scrutiny-web-server" >/dev/null
if ynh_hide_warnings yunohost service status "scrutiny-web-server" >/dev/null
then
ynh_script_progression --message="Removing scrutiny-web-server service integration..." --weight=1
ynh_script_progression "Removing scrutiny-web-server service integration..."
yunohost service remove "scrutiny-web-server"
fi
if ynh_exec_warn_less yunohost service status "scrutiny-collector" >/dev/null
if ynh_hide_warnings yunohost service status "scrutiny-collector" >/dev/null
then
ynh_script_progression --message="Removing scrutiny-collector service integration..." --weight=1
ynh_script_progression "Removing scrutiny-collector service integration..."
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_config_remove_systemd"scrutiny-web-server"
ynh_config_remove_systemd"scrutiny-collector"
ynh_safe_rm "/etc/systemd/system/scrutiny-collector.timer"
ynh_remove_nginx_config
ynh_config_remove_nginx
ynh_remove_logrotate
ynh_config_remove_logrotate
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Removal of $app completed" --last
ynh_script_progression "Removal of $app completed"

View file

@ -1,63 +1,55 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring the app main directory..." --weight=1
ynh_script_progression "Restoring the app main directory..."
ynh_restore_file --origin_path="$install_dir"
ynh_restore "$install_dir"
#=================================================
# RESTORE SYSTEM CONFIGURATIONS
#=================================================
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
ynh_script_progression "Restoring system configurations related to $app..."
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_restore_file --origin_path="/etc/systemd/system/scrutiny-web-server.service"
ynh_restore_file --origin_path="/etc/systemd/system/scrutiny-collector.service"
ynh_restore_file --origin_path="/etc/systemd/system/scrutiny-collector.timer"
ynh_restore "/etc/systemd/system/scrutiny-web-server.service"
ynh_restore "/etc/systemd/system/scrutiny-collector.service"
ynh_restore "/etc/systemd/system/scrutiny-collector.timer"
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
ynh_restore_file --origin_path="/var/log/$app"
ynh_restore "/etc/logrotate.d/$app"
ynh_restore "/var/log/$app"
#=================================================
# GENERIC FINALIZATION
#=================================================
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
#=================================================
ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
ynh_script_progression "Reloading NGINX web server and $app's service..."
systemctl daemon-reload
ynh_systemd_action --service_name="nginx" --action="reload"
ynh_systemctl --service="nginx" --action="reload"
ynh_systemd_action --service_name="influxdb" --action="enable"
ynh_systemd_action --service_name="influxdb" --action="start"
ynh_systemctl --service="influxdb" --action="enable"
ynh_systemctl --service="influxdb" --action="start"
systemctl enable "/etc/systemd/system/scrutiny-web-server.service" --quiet
yunohost service add "scrutiny-web-server" --description="WebUI for smartd S.M.A.R.T monitoring" --log="/var/log/$app/web-server.log" --test_status="systemctl show scrutiny-web-server.service -p ActiveState --value | grep -v failed"
ynh_systemd_action --service_name="scrutiny-web-server.service" --action="start" --log_path="/var/log/$app/web-server.log"
ynh_systemctl --service="scrutiny-web-server.service" --action="start" --log_path="/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" --test_status="systemctl show scrutiny-collector.service -p ActiveState --value | grep -v failed"
ynh_systemd_action --service_name="scrutiny-collector.timer" --action="enable"
ynh_systemd_action --service_name="scrutiny-collector.timer" --action="start" --log_path="/var/log/$app/collector.log"
ynh_systemctl --service="scrutiny-collector.timer" --action="enable"
ynh_systemctl --service="scrutiny-collector.timer" --action="start" --log_path="/var/log/$app/collector.log"
fi
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Restoration completed for $app" --last
ynh_script_progression "Restoration completed for $app"

View file

@ -1,35 +1,23 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
ynh_secure_remove --file="$install_dir/bin/scrutiny-web-linux-$YNH_ARCH"
ynh_secure_remove --file="$install_dir/bin/scrutiny-collector-metrics-linux-$YNH_ARCH"
#ynh_script_progression "Ensuring downward compatibility..."
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Stopping a systemd service..." --weight=1
ynh_script_progression "Stopping $app's systemd service..."
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"
ynh_systemctl --service="influxdb" --action="stop"
ynh_systemctl --service="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"
ynh_systemctl --service="scrutiny-collector.timer" --action="stop" --log_path="/var/log/$app/collector.log"
fi
#=================================================
@ -38,37 +26,37 @@ fi
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Upgrading source files..." --weight=1
ynh_script_progression "Upgrading source files..."
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --source_id="main" --dest_dir="$install_dir/bin"
ynh_setup_source --source_id="scrutiny-web-linux" --dest_dir="$install_dir/bin"
ynh_setup_source --source_id="scrutiny-collector-metrics-linux" --dest_dir="$install_dir/bin"
ynh_setup_source --source_id="scrutiny-web-frontend" --dest_dir="$install_dir/web"
#=================================================
# REAPPLY SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
ynh_script_progression "Upgrading system configurations related to $app..."
ynh_add_nginx_config
ynh_config_add_nginx
ynh_add_systemd_config --service="scrutiny-web-server" --template="systemd-scrutiny-web-server.service"
ynh_config_add_systemd --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/web-server.log" --test_status="systemctl show scrutiny-web-server.service -p ActiveState --value | grep -v failed"
ynh_add_config --template="systemd-scrutiny-collector.service" --destination="/etc/systemd/system/scrutiny-collector.service"
ynh_config_add --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" --test_status="systemctl show scrutiny-collector.service -p ActiveState --value | grep -v failed"
fi
ynh_use_logrotate --specific_user="$app" --non-append
ynh_config_add_logrotate
#=================================================
# RECONFIGURE THE APP (UPDATE CONF, APPLY MIGRATIONS, ...)
#=================================================
# UPDATE A CONFIG FILE
#=================================================
ynh_script_progression --message="Updating a configuration file..." --weight=1
ynh_script_progression "Updating configuration..."
if [ "${path}" == "/" ]
then
@ -76,10 +64,10 @@ then
else
base_path="${path}"
fi
ynh_add_config --template="config/scrutiny.yaml" --destination="$install_dir/config/scrutiny.yaml"
ynh_config_add --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"
ynh_add_config --template="config/collector.yaml" --destination="$install_dir/config/collector.yaml"
ynh_config_add --template="systemd-scrutiny-collector.timer" --destination="/etc/systemd/system/scrutiny-collector.timer"
ynh_config_add --template="config/collector.yaml" --destination="$install_dir/config/collector.yaml"
#=================================================
# SET FILE OWNERSHIP / PERMISSIONS
@ -90,23 +78,23 @@ myynh_set_permissions
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_script_progression "Starting $app's systemd service..."
systemctl daemon-reload
ynh_systemd_action --service_name="influxdb" --action="enable"
ynh_systemd_action --service_name="influxdb" --action="start"
ynh_systemctl --service="influxdb" --action="enable"
ynh_systemctl --service="influxdb" --action="start"
ynh_systemd_action --service_name="scrutiny-web-server.service" --action="enable"
ynh_systemd_action --service_name="scrutiny-web-server.service" --action="start" --log_path="/var/log/$app/web-server.log"
ynh_systemctl --service="scrutiny-web-server.service" --action="enable"
ynh_systemctl --service="scrutiny-web-server.service" --action="start" --log_path="/var/log/$app/web-server.log"
if [ $collector -eq 1 ]
then
ynh_systemd_action --service_name="scrutiny-collector.timer" --action="enable"
ynh_systemd_action --service_name="scrutiny-collector.timer" --action="start" --log_path="/var/log/$app/collector.log"
ynh_systemctl --service="scrutiny-collector.timer" --action="enable"
ynh_systemctl --service="scrutiny-collector.timer" --action="start" --log_path="/var/log/$app/collector.log"
fi
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Upgrade of $app completed" --last
ynh_script_progression "Upgrade of $app completed"