1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/netdata_ynh.git synced 2024-09-03 19:46:33 +02:00

Merge pull request #82 from YunoHost-Apps/testing

Apply last example_ynh
This commit is contained in:
yalh76 2022-06-23 23:15:37 +02:00 committed by GitHub
commit c90f4a235f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 299 additions and 104 deletions

View file

@ -1,3 +1,7 @@
SOURCE_URL=https://github.com/netdata/netdata/releases/download/v1.33.0/netdata-v1.33.0.tar.gz
SOURCE_SUM=d167d4b2d8529119fa4047ae40d22833dac9d360a6ed07c314ba313807c027eb
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=
SOURCE_EXTRACT=true

View file

@ -1,22 +1,21 @@
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
location ~ __PATH__/(?<ndpath>.*) {
proxy_redirect off;
proxy_set_header Host $host;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "";
proxy_http_version 1.1;
proxy_pass_request_headers on;
proxy_set_header Connection "keep-alive";
proxy_store off;
proxy_pass http://127.0.0.1:19999/$ndpath$is_args$args;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "";
proxy_http_version 1.1;
proxy_pass_request_headers on;
proxy_set_header Connection "keep-alive";
proxy_store off;
proxy_pass http://127.0.0.1:19999/$ndpath$is_args$args;
gzip on;
gzip_proxied any;
gzip_types *;
gzip on;
gzip_proxied any;
gzip_types *;
# Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc;

View file

@ -1,4 +1,7 @@
SOURCE_URL=https://raw.githubusercontent.com/netdata/netdata/v1.15.0/packaging/installer/netdata-uninstaller.sh
SOURCE_SUM=a4727069b47138cea5c466bc902934545841c88dc5f641728ef0feb921efd218
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=sh
SOURCE_IN_SUBDIR=false
SOURCE_FILENAME=netdata-uninstaller.sh
SOURCE_EXTRACT=false

0
doc/.gitkeep Normal file
View file

8
doc/DESCRIPTION.md Normal file
View file

@ -0,0 +1,8 @@
[NetData](http://my-netdata.io/) is a system for **distributed real-time performance and health monitoring**.
It provides **unparalleled insights, in real-time**, of everything happening on the
system it runs (including applications such as web and database servers), using
**modern interactive web dashboards**.
_netdata is **fast** and **efficient**, designed to permanently run on all systems
(**physical** & **virtual** servers, **containers**, **IoT** devices), without
disrupting their core function._

176
doc/DISCLAIMER.md Normal file
View file

@ -0,0 +1,176 @@
**Customization brought by the package:**
* Netdata Cloud functionality disabled
* grant MySQL statistics access via a `netdata` user
* nginx root log statistics via putting `netdata` user in the `adm` group
* Dovecot statistics via giving access to Dovecot stats stocket to `netdata` user (works only with Dovecot 2.2.16+)
**Further recommendations:**
We don't allow YunoHost packages to make changes to sensitive system files. So here are further customizations you can make to allow more monitoring:
* Nginx:
* requests/connections: follow [these recommandations](https://github.com/netdata/netdata/tree/master/collectors/python.d.plugin/nginx) to enable `/stab_status`; for example by creating the file `/etc/nginx/conf.d/default.d/netdat_stub.conf` with the following content:
```
# For Netdata
location /stub_status {
stub_status on;
# Security: Only allow access from the IP below.
allow 127.0.0.1;
# Deny anyone else
deny all;
}
```
* weblogs: you can monitor all your nginx weblogs for errors; follow [these recommendations](https://github.com/firehol/netdata/tree/master/python.d#nginx_log)
* phpfpm: follow [these recommandations](https://github.com/firehol/netdata/tree/master/python.d#phpfpm)
* NetData registry: set the instance as its own NetData registry server to avoid leaking any information by default
It has been tested on x86_64 and ARM.
## How it works
Netdata is a highly efficient, highly modular, metrics management engine. Its lockless design makes it ideal for
concurrent operations on the metrics.
![image](https://user-images.githubusercontent.com/2662304/48323827-b4c17580-e636-11e8-842c-0ee72fcb4115.png)
This is how it works:
| Function | Description | Documentation |
| :---------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :-------------------------------------------------- |
| **Collect** | Multiple independent data collection workers are collecting metrics from their sources using the optimal protocol for each application and push the metrics to the database. Each data collection worker has lockless write access to the metrics it collects. | [`collectors`](/collectors/README.md) |
| **Store** | Metrics are first stored in RAM in a custom database engine that then "spills" historical metrics to disk for efficient long-term metrics storage. | [`database`](/database/README.md) |
| **Check** | A lockless independent watchdog is evaluating **health checks** on the collected metrics, triggers alarms, maintains a health transaction log and dispatches alarm notifications. | [`health`](/health/README.md) |
| **Stream** | A lockless independent worker is streaming metrics, in full detail and in real-time, to remote Netdata servers, as soon as they are collected. | [`streaming`](/streaming/README.md) |
| **Archive** | A lockless independent worker is down-sampling the metrics and pushes them to **backend** time-series databases. | [`backends`](/backends/README.md) |
| **Query** | Multiple independent workers are attached to the [internal web server](/web/server/README.md), servicing API requests, including [data queries](/web/api/queries/README.md). | [`web/api`](/web/api/README.md) |
The result is a highly efficient, low-latency system, supporting multiple readers and one writer on each metric.
## Infographic
This is a high level overview of Netdata feature set and architecture. Click it to to interact with it (it has direct
links to our documentation).
[![image](https://user-images.githubusercontent.com/43294513/60951037-8ba5d180-a2f8-11e9-906e-e27356f168bc.png)](https://my-netdata.io/infographic.html)
## Features
![finger-video](https://user-images.githubusercontent.com/2662304/48346998-96cf3180-e685-11e8-9f4e-059d23aa3aa5.gif)
This is what you should expect from Netdata:
### General
- **1s granularity** - The highest possible resolution for all metrics.
- **Unlimited metrics** - Netdata collects all the available metrics—the more, the better.
- **1% CPU utilization of a single core** - It's unbelievably optimized.
- **A few MB of RAM** - The highly-efficient database engine stores per-second metrics in RAM and then "spills"
historical metrics to disk long-term storage.
- **Minimal disk I/O** - While running, Netdata only writes historical metrics and reads `error` and `access` logs.
- **Zero configuration** - Netdata auto-detects everything, and can collect up to 10,000 metrics per server out of the
box.
- **Zero maintenance** - You just run it. Netdata does the rest.
- **Zero dependencies** - Netdata runs a custom web server for its static web files and its web API (though its
plugins may require additional libraries, depending on the applications monitored).
- **Scales to infinity** - You can install it on all your servers, containers, VMs, and IoT devices. Metrics are not
centralized by default, so there is no limit.
- **Several operating modes** - Autonomous host monitoring (the default), headless data collector, forwarding proxy,
store and forward proxy, central multi-host monitoring, in all possible configurations. Each node may have different
metrics retention policies and run with or without health monitoring.
### Health Monitoring & Alarms
- **Sophisticated alerting** - Netdata comes with hundreds of alarms **out of the box**! It supports dynamic
thresholds, hysteresis, alarm templates, multiple role-based notification methods, and more.
- **Notifications**: [alerta.io](/health/notifications/alerta/), [amazon sns](/health/notifications/awssns/),
[discordapp.com](/health/notifications/discord/), [email](/health/notifications/email/),
[flock.com](/health/notifications/flock/), [hangouts](/health/notifications/hangouts/),
[irc](/health/notifications/irc/), [kavenegar.com](/health/notifications/kavenegar/),
[messagebird.com](/health/notifications/messagebird/), [pagerduty.com](/health/notifications/pagerduty/),
[prowl](health/notifications/prowl/), [pushbullet.com](/health/notifications/pushbullet/),
[pushover.net](health/notifications/pushover/), [rocket.chat](/health/notifications/rocketchat/),
[slack.com](/health/notifications/slack/), [smstools3](/health/notifications/smstools3/),
[syslog](/health/notifications/syslog/), [telegram.org](/health/notifications/telegram/),
[twilio.com](/health/notifications/twilio/), [web](/health/notifications/web/) and [custom
notifications](/health/notifications/custom/).
### Integrations
- **Time-series databases** - Netdata can archive its metrics to **Graphite**, **OpenTSDB**, **Prometheus**, **AWS
Kinesis**, **MongoDB**, **JSON document DBs**, in the same or lower resolution (lower: to prevent it from congesting
these servers due to the amount of data collected). Netdata also supports **Prometheus remote write API**, which
allows storing metrics to **Elasticsearch**, **Gnocchi**, **InfluxDB**, **Kafka**, **PostgreSQL/TimescaleDB**,
**Splunk**, **VictoriaMetrics** and a lot of other [storage
providers](https://prometheus.io/docs/operating/integrations/#remote-endpoints-and-storage).
## Visualization
- **Stunning interactive dashboards** - Our dashboard is mouse-, touchpad-, and touch-screen friendly in 2 themes:
`slate` (dark) and `white`.
- **Amazingly fast visualization** - Even on low-end hardware, the dashboard responds to all queries in less than 1 ms
per metric.
- **Visual anomaly detection** - Our UI/UX emphasizes the relationships between charts so you can better detect
anomalies visually.
- **Embeddable** - Charts can be embedded on your web pages, wikis and blogs. You can even use [Atlassian's Confluence
as a monitoring dashboard](/web/gui/confluence/README.md).
- **Customizable** - You can build custom dashboards using simple HTML. No JavaScript needed!
### Positive and negative values
To improve clarity on charts, Netdata dashboards present **positive** values for metrics representing `read`, `input`,
`inbound`, `received` and **negative** values for metrics representing `write`, `output`, `outbound`, `sent`.
![positive-and-negative-values](https://user-images.githubusercontent.com/2662304/48309090-7c5c6180-e57a-11e8-8e03-3a7538c14223.gif)
_Netdata charts showing the bandwidth and packets of a network interface. `received` is positive and `sent` is
negative._
### Autoscaled y-axis
Netdata charts automatically zoom vertically, to visualize the variation of each metric within the visible time-frame.
![non-zero-based](https://user-images.githubusercontent.com/2662304/48309139-3d2f1000-e57c-11e8-9a44-b91758134b00.gif)
_A zero-based `stacked` chart, automatically switches to an auto-scaled `area` chart when a single dimension is
selected._
### Charts are synchronized
Charts on Netdata dashboards are synchronized to each other. There is no master chart. Any chart can be panned or zoomed
at any time, and all other charts will follow.
![charts-are-synchronized](https://user-images.githubusercontent.com/2662304/48309003-b4fb3b80-e578-11e8-86f6-f505c7059c15.gif)
_Charts are panned by dragging them with the mouse. Charts can be zoomed in/out with`SHIFT` + `mouse wheel` while the
mouse pointer is over a chart._
> The visible time-frame (pan and zoom) is propagated from Netdata server to Netdata server when navigating via the
> [My nodes menu](/registry/README.md).
### Highlighted time-frame
To improve visual anomaly detection across charts, the user can highlight a time-frame (by pressing `Alt` + `mouse
selection`) on all charts.
![highlighted-timeframe](https://user-images.githubusercontent.com/2662304/48311876-f9093300-e5ae-11e8-9c74-e3e291741990.gif)
_A highlighted time-frame can be given by pressing `Alt` + `mouse selection` on any chart. Netdata will highlight the
same range on all charts._
> Highlighted ranges are propagated from Netdata server to Netdata server, when navigating via the [My nodes
> menu](/registry/README.md).
## What Netdata monitors
Netdata can collect metrics from 200+ popular services and applications, on top of dozens of system-related metrics
jocs, such as CPU, memory, disks, filesystems, networking, and more. We call these **collectors**, and they're managed
by [**plugins**](/collectors/plugins.d/README.md), which support a variety of programming languages, including Go and
Python.
Popular collectors include **Nginx**, **Apache**, **MySQL**, **statsd**, **cgroups** (containers, Docker, Kubernetes,
LXC, and more), **Traefik**, **web server `access.log` files**, and much more.
See the **full list of [supported collectors](/collectors/COLLECTORS.md)**.
Netdata's data collection is **extensible**, which means you can monitor anything you can get a metric for. You can even
write a collector for your custom application using our [plugin API](/collectors/plugins.d/README.md).

0
doc/screenshots/.gitkeep Normal file
View file

View file

@ -6,8 +6,15 @@
"en": "Real-time performance and health monitoring",
"fr": "Monitoring serveur en temps reel"
},
"version": "1.33.0~ynh1",
"version": "1.33.0~ynh2",
"url": "http://my-netdata.io/",
"upstream": {
"license": "GPL-3.0",
"website": "http://my-netdata.io",
"demo": "https://learn.netdata.cloud/docs/agent/demo-sites/",
"admindoc": "https://learn.netdata.cloud/docs",
"code": "https://github.com/netdata/netdata"
},
"license": "GPL-3.0",
"maintainer": {
"name": "JimboJoe",
@ -15,14 +22,14 @@
"url": ""
},
"requirements": {
"yunohost": ">= 4.2.0"
"yunohost": ">= 4.3.0"
},
"multi_instance": false,
"services": [
"nginx"
],
"arguments": {
"install" : [
"install": [
{
"name": "domain",
"type": "domain"

View file

@ -6,7 +6,7 @@
# IMPORT GENERIC HELPERS
#=================================================
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
@ -15,7 +15,6 @@ source /usr/share/yunohost/helpers
#=================================================
ynh_clean_setup () {
### Remove this function if there's nothing to clean before calling the remove script.
true
}
# Exit if an error occurs during the execution of the script
@ -32,7 +31,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
domain=$(ynh_app_setting_get --app=$app --key=domain)
#=================================================
# STANDARD BACKUP STEPS
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
ynh_print_info --message="Declaring files to be backed up..."

View file

@ -29,7 +29,7 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1
@ -39,7 +39,7 @@ ynh_clean_setup () {
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
# restore it if the upgrade fails
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
@ -73,23 +73,23 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
ynh_script_progression --message="Updating nginx web server configuration..." --weight=1
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
# Change the path in the nginx config file
# Change the path in the NGINX config file
if [ $change_path -eq 1 ]
then
# Make a backup of the original nginx config file if modified
# Make a backup of the original NGINX config file if modified
ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
# Set global variables for nginx helper
# Set global variables for NGINX helper
domain="$old_domain"
path_url="$new_path"
# Create a dedicated nginx config
# Create a dedicated NGINX config
ynh_add_nginx_config
fi
# Change the domain for nginx
# Change the domain for NGINX
if [ $change_domain -eq 1 ]
then
# Delete file checksum for the old conf file location
@ -102,6 +102,8 @@ fi
#=================================================
# SPECIFIC MODIFICATIONS
#=================================================
# ...
#=================================================
# Change registry link
ynh_replace_string --match_string="registry to announce = https://$old_domain$old_path" --replace_string="registry to announce = https://$new_domain$new_path" --target_file="/opt/netdata/etc/netdata/netdata.conf"

View file

@ -14,7 +14,6 @@ source /usr/share/yunohost/helpers
#=================================================
ynh_clean_setup () {
### Remove this function if there's nothing to clean before calling the remove script.
true
}
# Exit if an error occurs during the execution of the script
@ -26,15 +25,14 @@ ynh_abort_if_errors
domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH
admin=$YNH_APP_ARG_ADMIN
is_public=$YNH_APP_ARG_IS_PUBLIC
admin=$YNH_APP_ARG_ADMIN
app=$YNH_APP_INSTANCE_NAME
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#=================================================
ynh_script_progression --message="Validating installation parameters..." --weight=1
final_path=/opt/$app
@ -68,10 +66,6 @@ ynh_install_app_dependencies $pkg_dependencies
#=================================================
ynh_script_progression --message="Setting up source files..." --weight=11
### `ynh_setup_source` is used to install an app from a zip or tar.gz file,
### downloaded from an upstream source, like a git repository.
### `ynh_setup_source` use the file conf/app.src
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src
NETDATA_TMPDIR=$(mktemp -d)
@ -82,13 +76,14 @@ ynh_setup_source --dest_dir="$NETDATA_TMPDIR"
#=================================================
ynh_script_progression --message="Configuring NGINX web server..." --weight=2
# Create a dedicated nginx config
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# SPECIFIC SETUP
#=================================================
# EXECUTE NETDATA INSTALLER
#=================================================
ynh_script_progression --message="Executing Netdata installer..." --weight=30
# create a temporary file for the log
@ -98,7 +93,7 @@ exec 3>${tmp}
# Launch netdata installation in /opt directory
pushd $NETDATA_TMPDIR
./netdata-installer.sh --install /opt --dont-wait --disable-cloud --disable-telemetry --stable-channel >&3 2>&3 || ynh_die "FAILED TO COMPILE/INSTALL NETDATA"
./netdata-installer.sh --install /opt --dont-wait --disable-cloud --disable-telemetry --stable-channel >&3 2>&3 || ynh_die "FAILED TO COMPILE/INSTALL NETDATA"
popd
# close fd 3
@ -112,6 +107,7 @@ configure_netdata
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..."
yunohost service add $app --description "Real-time performance and health monitoring for systems and applications" --log "$final_path/var/log/netdata/error.log" "$final_path/var/log/netdata/access.log" "$final_path/var/log/netdata/debug.log"
@ -129,14 +125,15 @@ ynh_systemd_action --service_name=$app --action="restart" --log_path="$final_pat
ynh_script_progression --message="Configuring permissions..." --weight=1
# Make app public if necessary
if [ $is_public -eq 1 ]; then
if [ $is_public -eq 1 ]
then
# Everyone can access the app.
# The "main" permission is automatically created before the install script.
ynh_permission_update --permission "main" --add "visitors"
ynh_permission_update --permission="main" --add="visitors"
fi
# Add direct access in the portal to admin only
ynh_permission_update --permission "main" --add "$admin"
ynh_permission_update --permission="main" --add="$admin"
#=================================================
# RELOAD NGINX

View file

@ -25,13 +25,21 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
# REMOVE SERVICE INTEGRATION IN YUNOHOST
#=================================================
# Remove the service from the list of services known by Yunohost (added from `yunohost service add`)
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
if ynh_exec_warn_less yunohost service status $app >/dev/null
then
ynh_script_progression --message="Removing $app service..." --weight=2
ynh_script_progression --message="Removing $app service integration..." --weight=2
yunohost service remove $app
fi
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
# Remove the dedicated NGINX config
ynh_remove_nginx_config
#=================================================
# REMOVE DEPENDENCIES
#=================================================
@ -41,41 +49,34 @@ ynh_script_progression --message="Removing dependencies..." --weight=8
ynh_remove_app_dependencies
#=================================================
# REMOVE APP MAIN DIR
# UNINSTALLING NETDATA
#=================================================
ynh_script_progression --message="Uninstalling Netdata..." --weight=6
# Prepare to execute uninstaller(generated by NetData install script)
UNINSTALL_SCRIPT="netdata-uninstaller.sh"
tmpdir=$(mktemp -d)
ynh_setup_source "/tmp" uninstaller
chmod +x /tmp/$UNINSTALL_SCRIPT
ynh_setup_source --dest_dir="$tmpdir" --source_id="uninstaller"
chmod +x $tmpdir/$UNINSTALL_SCRIPT
# Move outside the directory (which will be removed)
cd /tmp
pushd $tmpdir
# create a temporary file for the log
tmp=$(mktemp /tmp/netdata-uninstaller-log-XXXXXX.log)
# open fd 3 and send it to tmp
exec 3>${tmp}
# create a temporary file for the log
tmp=$(mktemp /tmp/netdata-uninstaller-log-XXXXXX.log)
# open fd 3 and send it to tmp
exec 3>${tmp}
# Execute the uninstall script
./${UNINSTALL_SCRIPT} --yes --force --env $final_path/etc/netdata/.environment >&3 2>&3
# Execute the uninstall script
./${UNINSTALL_SCRIPT} --yes --force --env $final_path/etc/netdata/.environment >&3 2>&3
# close fd 3
exec 3<&-
# close fd 3
exec 3<&-
popd
# Remove MySQL netdata user
ynh_mysql_execute_as_root "drop user 'netdata'@'localhost'; flush privileges;"
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
# Remove the dedicated nginx config
ynh_remove_nginx_config
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -6,7 +6,7 @@
# IMPORT GENERIC HELPERS
#=================================================
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
@ -15,7 +15,6 @@ source /usr/share/yunohost/helpers
#=================================================
ynh_clean_setup () {
#### Remove this function if there's nothing to clean before calling the remove script.
true
}
# Exit if an error occurs during the execution of the script
@ -42,12 +41,6 @@ test ! -d $final_path \
#=================================================
# STANDARD RESTORATION STEPS
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
@ -65,10 +58,16 @@ ynh_script_progression --message="Reinstalling dependencies..." --weight=7
# Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX web server configuration..."
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# INSTALL AND RESTORE THE APP CONFIGURATION
#=================================================
ynh_script_progression --message="Reinstalling Netdata..." --weight=18
# Download, check integrity, uncompress and patch the source from app.src
@ -93,6 +92,7 @@ configure_netdata
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..."
yunohost service add $app --description "Real-time performance and health monitoring for systems and applications" --log "$final_path/var/log/netdata/error.log" "$final_path/var/log/netdata/access.log" "$final_path/var/log/netdata/debug.log"

View file

@ -35,12 +35,14 @@ ynh_script_progression --message="Backing up the app before upgrading (may take
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# restore it if the upgrade fails
ynh_restore_upgradebackup
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
@ -66,8 +68,6 @@ if ynh_legacy_permissions_exists; then
ynh_app_setting_delete --app=$app --key=is_public
fi
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
@ -76,35 +76,35 @@ if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading source files..." --weight=18
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
# Download, check integrity, uncompress and patch the source from app.src
NETDATA_TMPDIR=$(mktemp -d)
ynh_setup_source "$NETDATA_TMPDIR"
# Download, check integrity, uncompress and patch the source from app.src
NETDATA_TMPDIR=$(mktemp -d)
ynh_setup_source "$NETDATA_TMPDIR"
#=================================================
# SPECIFIC UPGRADE
#=================================================
#=================================================
# SPECIFIC UPGRADE
#=================================================
# signal netdata to start saving its database
# this is handy if your database is big
pids=$(pidof netdata)
[ ! -z "${pids}" ] && kill -USR1 ${pids}
# signal netdata to start saving its database
# this is handy if your database is big
pids=$(pidof netdata)
[ ! -z "${pids}" ] && kill -USR1 ${pids}
# create a temporary file for the log
tmp=$(mktemp /tmp/netdata-updater-log-XXXXXX.log)
# open fd 3 and send it to tmp
exec 3>${tmp}
# create a temporary file for the log
tmp=$(mktemp /tmp/netdata-updater-log-XXXXXX.log)
# open fd 3 and send it to tmp
exec 3>${tmp}
# Launch netdata installation in /opt directory
pushd $NETDATA_TMPDIR
./netdata-installer.sh --install /opt --dont-wait --disable-cloud >&3 2>&3 || ynh_die "FAILED TO COMPILE/INSTALL NETDATA"
popd
# Launch netdata installation in /opt directory
pushd $NETDATA_TMPDIR
./netdata-installer.sh --install /opt --dont-wait --disable-cloud >&3 2>&3 || ynh_die "FAILED TO COMPILE/INSTALL NETDATA"
popd
# close fd 3
exec 3<&-
# close fd 3
exec 3<&-
fi
# Specific configuration
@ -115,7 +115,7 @@ configure_netdata
#=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
# Create a dedicated nginx config
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
@ -127,11 +127,10 @@ ynh_install_app_dependencies $pkg_dependencies
#=================================================
# GENERIC FINALIZATION
#=================================================
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..."
yunohost service add $app --description "Real-time performance and health monitoring for systems and applications" --log "$final_path/var/log/netdata/error.log" "$final_path/var/log/netdata/access.log" "$final_path/var/log/netdata/debug.log"