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 #137 from YunoHost-Apps/testing

Testing
This commit is contained in:
Salamandar 2024-02-04 18:47:25 +01:00 committed by GitHub
commit f023880adf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 167 additions and 1063 deletions

View file

@ -1,106 +0,0 @@
#!/bin/bash
#=================================================
# PACKAGE UPDATING HELPER
#=================================================
# This script is meant to be run by GitHub Actions
# The YunoHost-Apps organisation offers a template Action to run this script periodically
# Since each app is different, maintainers can adapt its contents so as to perform
# automatic actions when a new upstream release is detected.
#=================================================
# FETCHING LATEST RELEASE AND ITS ASSETS
#=================================================
# Fetching information
current_version=$(cat manifest.json | jq -j '.version|split("~")[0]')
repo=$(cat manifest.json | jq -j '.upstream.code|split("https://github.com/")[1]')
# Some jq magic is needed, because the latest upstream release is not always the latest version (e.g. security patches for older versions)
version=$(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '.[] | select( .prerelease != true ) | .tag_name' | sort -V | tail -1)
assets="https://github.com/netdata/netdata/releases/download/$version/netdata-$version.tar.gz"
# Later down the script, we assume the version has only digits and dots
# Sometimes the release name starts with a "v", so let's filter it out.
# You may need more tweaks here if the upstream repository has different naming conventions.
if [[ ${version:0:1} == "v" || ${version:0:1} == "V" ]]; then
version=${version:1}
fi
# Setting up the environment variables
echo "Current version: $current_version"
echo "Latest release from upstream: $version"
echo "VERSION=$version" >> $GITHUB_ENV
echo "REPO=$repo" >> $GITHUB_ENV
# For the time being, let's assume the script will fail
echo "PROCEED=false" >> $GITHUB_ENV
# Proceed only if the retrieved version is greater than the current one
if ! dpkg --compare-versions "$current_version" "lt" "$version" ; then
echo "::warning ::No new version available"
exit 0
# Proceed only if a PR for this new version does not already exist
elif git ls-remote -q --exit-code --heads https://github.com/$GITHUB_REPOSITORY.git ci-auto-update-v$version ; then
echo "::warning ::A branch already exists for this update"
exit 0
fi
#=================================================
# UPDATE SOURCE FILES
#=================================================
# Let's download source tarball
asset_url=$assets
echo "Handling asset at $asset_url"
src="app"
# Create the temporary directory
tempdir="$(mktemp -d)"
# Download sources and calculate checksum
filename=${asset_url##*/}
curl --silent -4 -L $asset_url -o "$tempdir/$filename"
checksum=$(sha256sum "$tempdir/$filename" | head -c 64)
# Delete temporary directory
rm -rf $tempdir
# Get extension
if [[ $filename == *.tar.gz ]]; then
extension=tar.gz
else
extension=${filename##*.}
fi
# Rewrite source file
cat <<EOT > conf/$src.src
SOURCE_URL=$asset_url
SOURCE_SUM=$checksum
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=$extension
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=
EOT
echo "... conf/$src.src updated"
#=================================================
# SPECIFIC UPDATE STEPS
#=================================================
# Any action on the app's source code can be done.
# The GitHub Action workflow takes care of committing all changes after this script ends.
#=================================================
# GENERIC FINALIZATION
#=================================================
# Replace new version in manifest
echo "$(jq -s --indent 4 ".[] | .version = \"$version~ynh1\"" manifest.json)" > manifest.json
# No need to update the README, yunohost-bot takes care of it
# The Action will proceed only if the PROCEED environment variable is set to true
echo "PROCEED=true" >> $GITHUB_ENV
exit 0

View file

@ -1,50 +0,0 @@
# This workflow allows GitHub Actions to automagically update your app whenever a new upstream release is detected.
# You need to enable Actions in your repository settings, and fetch this Action from the YunoHost-Apps organization.
# This file should be enough by itself, but feel free to tune it to your needs.
# It calls updater.sh, which is where you should put the app-specific update steps.
name: Check for new upstream releases
on:
# Allow to manually trigger the workflow
workflow_dispatch:
# Run it every day at 6:00 UTC
schedule:
- cron: '0 6 * * *'
jobs:
updater:
runs-on: ubuntu-latest
steps:
- name: Fetch the source code
uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Run the updater script
id: run_updater
run: |
# Setting up Git user
git config --global user.name 'yunohost-bot'
git config --global user.email 'yunohost-bot@users.noreply.github.com'
# Run the updater script
/bin/bash .github/workflows/updater.sh
- name: Commit changes
id: commit
if: ${{ env.PROCEED == 'true' }}
run: |
git commit -am "Upgrade to v$VERSION"
- name: Create Pull Request
id: cpr
if: ${{ env.PROCEED == 'true' }}
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Update to version ${{ env.VERSION }}
committer: 'yunohost-bot <yunohost-bot@users.noreply.github.com>'
author: 'yunohost-bot <yunohost-bot@users.noreply.github.com>'
signoff: false
base: testing
branch: ci-auto-update-v${{ env.VERSION }}
delete-branch: true
title: 'Upgrade to version ${{ env.VERSION }}'
body: |
Upgrade to v${{ env.VERSION }}
draft: false

183
README.md
View file

@ -16,7 +16,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
## Overview
[NetData](http://my-netdata.io/) is a system for **distributed real-time performance and health monitoring**.
NetData 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**.
@ -26,188 +26,9 @@ _netdata is **fast** and **efficient**, designed to permanently run on all syste
disrupting their core function._
**Shipped version:** 1.44.1~ynh2
**Shipped version:** 1.44.1~ynh1
**Demo:** https://learn.netdata.cloud/docs/agent/demo-sites/
## Disclaimers / important information
**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).
## Documentation and resources
* Official app website: <http://my-netdata.io>

View file

@ -16,7 +16,7 @@ Si vous navez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po
## Vue densemble
[NetData](http://my-netdata.io/) is a system for **distributed real-time performance and health monitoring**.
NetData 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**.
@ -26,188 +26,9 @@ _netdata is **fast** and **efficient**, designed to permanently run on all syste
disrupting their core function._
**Version incluse :** 1.44.1~ynh2
**Version incluse :** 1.44.1~ynh1
**Démo :** https://learn.netdata.cloud/docs/agent/demo-sites/
## Avertissements / informations importantes
**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).
## Documentations et ressources
* Site officiel de lapp : <http://my-netdata.io>

View file

@ -1,24 +0,0 @@
;; Complete test
auto_remove=1
; Manifest
domain="domain.tld"
path="/path"
admin="john"
is_public=1
; Checks
pkg_linter=1
setup_sub_dir=1
setup_root=1
setup_nourl=0
setup_private=1
setup_public=1
upgrade=1
backup_restore=1
multi_instance=0
wrong_user=0
wrong_path=1
change_url=1
# https://github.com/YunoHost-Apps/netdata_ynh/issues/4
;;; Options
Email=
Notification=none

View file

@ -1,6 +0,0 @@
SOURCE_URL=https://github.com/netdata/netdata/releases/download/v1.44.1/netdata-v1.44.1.tar.gz
SOURCE_SUM=77e94acf7085c23ab20b2d0d2d4d2bc5a289f121fc7aac5d0daffb960041fd95
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=

View file

@ -1,7 +0,0 @@
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

View file

@ -1,4 +1,4 @@
[NetData](http://my-netdata.io/) is a system for **distributed real-time performance and health monitoring**.
NetData 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**.

View file

@ -1,55 +0,0 @@
{
"name": "NetData",
"id": "netdata",
"packaging_format": 1,
"description": {
"en": "Real-time performance and health monitoring",
"fr": "Monitoring serveur en temps reel"
},
"version": "1.44.1~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",
"cpe": "cpe:2.3:a:netdata:netdata"
},
"license": "GPL-3.0",
"maintainer": {
"name": "JimboJoe",
"email": "jimmy@monin.net",
"url": ""
},
"requirements": {
"yunohost": ">= 11.2"
},
"multi_instance": false,
"services": [
"nginx"
],
"arguments": {
"install": [
{
"name": "domain",
"type": "domain"
},
{
"name": "path",
"type": "path",
"example": "/netdata",
"default": "/netdata"
},
{
"name": "is_public",
"type": "boolean",
"default": false
},
{
"name": "admin",
"type": "user"
}
]
}
}

65
manifest.toml Normal file
View file

@ -0,0 +1,65 @@
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/manifest.v2.schema.json
packaging_format = 2
id = "netdata"
name = "NetData"
description.en = "Real-time performance and health monitoring"
description.fr = "Monitoring serveur en temps reel"
version = "1.44.1~ynh1"
maintainers = ["JimboJoe"]
[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"
[integration]
yunohost = ">= 11.2"
architectures = "all"
multi_instance = false
ldap = false
sso = false
disk = "50M"
ram.build = "1500M"
ram.runtime = "50M"
[install]
[install.domain]
type = "domain"
[install.path]
type = "path"
default = "/netdata"
[install.init_main_permission]
type = "group"
default = false
[install.admin]
type = "user"
[resources]
[resources.sources]
[resources.sources.main]
url = "https://github.com/netdata/netdata/releases/download/v1.44.1/netdata-v1.44.1.tar.gz"
sha256 = "77e94acf7085c23ab20b2d0d2d4d2bc5a289f121fc7aac5d0daffb960041fd95"
autoupdate.strategy = "latest_github_tag"
[resources.system_user]
[resources.install_dir]
[resources.permissions]
main.url = "/"
[resources.apt]
packages = "zlib1g-dev, uuid-dev, libmnl-dev, gcc, make, git, autoconf, autoconf-archive, autogen, automake, pkg-config, curl, jq, nodejs, python3-mysqldb, libipmimonitoring-dev, acl, python3-pymongo, libuv1-dev, liblz4-dev, libjudy-dev, libssl-dev, cmake"

View file

@ -4,9 +4,6 @@
# COMMON VARIABLES
#=================================================
# dependencies used by the app
pkg_dependencies="zlib1g-dev uuid-dev libmnl-dev gcc make git autoconf autoconf-archive autogen automake pkg-config curl jq nodejs python3-mysqldb libipmimonitoring-dev acl python3-pymongo libuv1-dev liblz4-dev libjudy-dev libssl-dev cmake"
#=================================================
# PERSONAL HELPERS
#=================================================
@ -17,12 +14,12 @@ configure_netdata() {
# Set server as registry serveur
sed -i "/^\[registry\]$/,/^\[/ {
s/# enabled = no/enabled = yes/
s@# registry to announce = https://registry.my-netdata.io@registry to announce = https://$domain$path_url@
}" $final_path/etc/netdata/netdata.conf
s@# registry to announce = https://registry.my-netdata.io@registry to announce = https://$domain$path@
}" $install_dir/etc/netdata/netdata.conf
# Opt-out from sending anonymous statistics
# (see https://docs.netdata.cloud/docs/anonymous-statistics/#opt-out)
touch $final_path/etc/netdata/.opt-out-from-anonymous-statistics
touch $install_dir/etc/netdata/.opt-out-from-anonymous-statistics
# Add a web_log entry for every YunoHost domain
netdata_add_yunohost_web_logs
@ -57,9 +54,9 @@ configure_netdata() {
# Add a web_log entry for every YunoHost domain
netdata_add_yunohost_web_logs () {
local web_log_file="$final_path/etc/netdata/go.d/web_log.conf"
local web_log_file="$install_dir/etc/netdata/go.d/web_log.conf"
if [ ! -f $web_log_file ] ; then
cp $final_path/etc/netdata/orig/go.d/web_log.conf $web_log_file
cp $install_dir/etc/netdata/orig/go.d/web_log.conf $web_log_file
fi
if [ -z "$(grep "YUNOHOST" $web_log_file)" ] ; then
echo "# ------------YUNOHOST DOMAINS---------------" >> $web_log_file
@ -77,16 +74,16 @@ EOF
fi
chgrp netdata $web_log_file
# Manage upgrade case from python to go plugin
if [ -f "$final_path/etc/netdata/python.d/web_log.conf" ] ; then
ynh_secure_remove --file="$final_path/etc/netdata/python.d/web_log.conf"
if [ -f "$install_dir/etc/netdata/python.d/web_log.conf" ] ; then
ynh_secure_remove --file="$install_dir/etc/netdata/python.d/web_log.conf"
fi
}
# If PostgreSQL is installed, add a PostgreSQL entry using instance password
netdata_add_yunohost_postgres_configuration () {
local postgres_file="$final_path/etc/netdata/go.d/postgres.conf"
local postgres_file="$install_dir/etc/netdata/go.d/postgres.conf"
if [ ! -f $postgres_file ] ; then
cp $final_path/etc/netdata/orig/go.d/postgres.conf $postgres_file
cp $install_dir/etc/netdata/orig/go.d/postgres.conf $postgres_file
fi
if [ -f /etc/yunohost/psql ] && [ -z "$(grep "YUNOHOST" $postgres_file)" ] ; then
cat >> $postgres_file <<EOF
@ -97,7 +94,7 @@ EOF
fi
chgrp netdata $postgres_file
# Manage upgrade case from python to go plugin
if [ -f "$final_path/etc/netdata/python.d/postgres.conf" ] ; then
ynh_secure_remove --file="$final_path/etc/netdata/python.d/postgres.conf"
if [ -f "$install_dir/etc/netdata/python.d/postgres.conf" ] ; then
ynh_secure_remove --file="$install_dir/etc/netdata/python.d/postgres.conf"
fi
}

View file

@ -10,26 +10,6 @@
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
true
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
domain=$(ynh_app_setting_get --app=$app --key=domain)
#=================================================
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
@ -39,7 +19,7 @@ ynh_print_info --message="Declaring files to be backed up..."
# BACKUP THE APP MAIN DIR
#=================================================
ynh_backup --src_path="$final_path/etc/netdata"
ynh_backup --src_path="$install_dir/etc/netdata"
#=================================================
# BACKUP THE NGINX CONFIGURATION

View file

@ -9,58 +9,6 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# RETRIEVE ARGUMENTS
#=================================================
old_domain=$YNH_APP_OLD_DOMAIN
old_path=$YNH_APP_OLD_PATH
new_domain=$YNH_APP_NEW_DOMAIN
new_path=$YNH_APP_NEW_PATH
app=$YNH_APP_INSTANCE_NAME
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#=================================================
# 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
# Backup the current version of the app
ynh_backup_before_upgrade
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
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# CHECK WHICH PARTS SHOULD BE CHANGED
#=================================================
change_domain=0
if [ "$old_domain" != "$new_domain" ]
then
change_domain=1
fi
change_path=0
if [ "$old_path" != "$new_path" ]
then
change_path=1
fi
#=================================================
# STANDARD MODIFICATIONS
#=================================================
@ -68,45 +16,21 @@ fi
#=================================================
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="$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
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
# 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
ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
# Set global variables for NGINX helper
domain="$old_domain"
path_url="$new_path"
# Create a dedicated NGINX config
ynh_add_nginx_config
fi
# Change the domain for NGINX
if [ $change_domain -eq 1 ]
then
# Delete file checksum for the old conf file location
ynh_delete_file_checksum --file="$nginx_conf_path"
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
# Store file checksum for the new config file location
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
fi
ynh_change_url_nginx_config
#=================================================
# 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"
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="$install_dir/etc/netdata/netdata.conf"
#=================================================
# GENERIC FINALISATION
@ -115,14 +39,7 @@ ynh_replace_string --match_string="registry to announce = https://$old_domain$ol
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="restart" --log_path="$final_path/var/log/$app/error.log"
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
ynh_systemd_action --service_name="$app" --action="restart" --log_path="$install_dir/var/log/$app/error.log"
#=================================================
# END OF SCRIPT

View file

@ -9,106 +9,40 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
true
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH
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
# Register (book) web path
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
ynh_script_progression --message="Storing installation settings..." --weight=1
ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set --app=$app --key=admin --value=$admin
#=================================================
# STANDARD MODIFICATIONS
#=================================================
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing dependencies..." --weight=32
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..." --weight=11
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)
ynh_setup_source --dest_dir="$NETDATA_TMPDIR"
#=================================================
# NGINX CONFIGURATION
# BUILD
#=================================================
ynh_script_progression --message="Configuring NGINX web server..." --weight=2
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# SPECIFIC SETUP
#=================================================
# EXECUTE NETDATA INSTALLER
#=================================================
ynh_script_progression --message="Executing Netdata installer..." --weight=30
ynh_script_progression --message="Executing Netdata installer..." --weight=10
# 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}
tmplog=$(mktemp /tmp/netdata-updater-log-XXXXXX.log)
# Launch netdata installation in /opt directory
pushd $NETDATA_TMPDIR
./netdata-installer.sh --install-prefix /opt --dont-wait --disable-cloud --disable-telemetry --stable-channel >&3 2>&3 || ynh_die "FAILED TO COMPILE/INSTALL NETDATA"
pushd "$NETDATA_TMPDIR"
# the installer.sh script will append "netdata" after the --install-prefix arg
./netdata-installer.sh --install-prefix /var/www/ --dont-wait --disable-cloud --disable-telemetry --stable-channel >"$tmplog" 2>"$tmplog" || ynh_die "FAILED TO COMPILE/INSTALL NETDATA"
popd
# close fd 3
exec 3<&-
# Specific configuration
configure_netdata
#=================================================
# GENERIC FINALIZATION
# NGINX CONFIGURATION
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..."
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
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"
# Create a dedicated NGINX config
ynh_add_nginx_config
yunohost service add "$app" --description "Real-time performance and health monitoring" --log "$install_dir/var/log/netdata/error.log" "$install_dir/var/log/netdata/access.log" "$install_dir/var/log/netdata/debug.log"
#=================================================
# START SYSTEMD SERVICE
@ -116,30 +50,7 @@ yunohost service add $app --description "Real-time performance and health monito
ynh_script_progression --message="Starting a systemd service..." --weight=2
# Start a systemd service
ynh_systemd_action --service_name=$app --action="restart" --log_path="$final_path/var/log/$app/error.log"
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Configuring permissions..." --weight=1
# Make app public if necessary
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"
fi
# Add direct access in the portal to admin only
ynh_permission_update --permission="main" --remove="all_users" --add="$admin"
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
ynh_systemd_action --service_name="$app" --action="restart" --log_path="$install_dir/var/log/$app/error.log"
#=================================================
# END OF SCRIPT

View file

@ -10,72 +10,42 @@ source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#=================================================
# STANDARD REMOVE
#=================================================
# REMOVE SERVICE INTEGRATION IN YUNOHOST
# REMOVE SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
# 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 integration..." --weight=2
yunohost service remove $app
if ynh_exec_warn_less yunohost service status "$app" >/dev/null; then
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
#=================================================
ynh_script_progression --message="Removing dependencies..." --weight=8
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#=================================================
# 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)
# Kill all netdata processes (essentially what the official uninstaller does)
pkill netdata
pkill -U netdata
ynh_setup_source --dest_dir="$tmpdir" --source_id="uninstaller"
chmod +x $tmpdir/$UNINSTALL_SCRIPT
# Move outside the directory (which will be removed)
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}
# Execute the uninstall script
./${UNINSTALL_SCRIPT} --yes --force --env $final_path/etc/netdata/.environment >&3 2>&3
# close fd 3
exec 3<&-
popd
# Remove MySQL netdata user
ynh_mysql_execute_as_root "drop user 'netdata'@'localhost'; flush privileges;"
# Rm all files that netdata may have installed (this is copypasta of the official uninstaller script)
ynh_secure_remove /etc/logrotate.d/netdata
ynh_secure_remove /etc/systemd/system/netdata.service
ynh_secure_remove /lib/systemd/system/netdata.service
ynh_secure_remove /usr/lib/systemd/system/netdata.service
ynh_secure_remove /etc/init.d/netdata
ynh_secure_remove /etc/periodic/daily/netdata-updater
ynh_secure_remove /etc/cron.daily/netdata-updater
ynh_secure_remove "/usr/sbin/netdata"
ynh_secure_remove "/usr/share/netdata"
ynh_secure_remove "/usr/libexec/netdata"
ynh_secure_remove "/var/lib/netdata"
ynh_secure_remove "/var/cache/netdata"
ynh_secure_remove "/var/log/netdata"
ynh_secure_remove "/etc/netdata"
#=================================================
# END OF SCRIPT

View file

@ -10,32 +10,6 @@
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
true
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
ynh_script_progression --message="Validating restoration parameters..." --weight=1
#=================================================
# STANDARD RESTORATION STEPS
#=================================================
@ -43,24 +17,7 @@ ynh_script_progression --message="Validating restoration parameters..." --weight
#=================================================
ynh_script_progression --message="Restoring Netdata configuration directory..." --weight=1
ynh_restore_file --origin_path="$final_path/etc/netdata"
#=================================================
# SPECIFIC RESTORATION
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
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"
ynh_restore_file --origin_path="$install_dir/etc/netdata"
#=================================================
# INSTALL AND RESTORE THE APP CONFIGURATION
@ -72,40 +29,31 @@ NETDATA_TMPDIR=$(mktemp -d)
ynh_setup_source --dest_dir="$NETDATA_TMPDIR"
# 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}
tmplog=$(mktemp /tmp/netdata-updater-log-XXXXXX.log)
# Launch netdata installation in /opt directory
cd $NETDATA_TMPDIR
./netdata-installer.sh --install-prefix /opt --dont-wait --disable-cloud --disable-telemetry --stable-channel >&3 2>&3 || ynh_die "FAILED TO COMPILE/INSTALL NETDATA"
# close fd 3
exec 3<&-
pushd "$NETDATA_TMPDIR"
# the installer.sh script will append "netdata" after the --install-prefix arg
./netdata-installer.sh --install-prefix /var/www/ --dont-wait --disable-cloud --disable-telemetry --stable-channel >"$tmplog" 2>"$tmplog" || ynh_die "FAILED TO COMPILE/INSTALL NETDATA"
popd
# Specific configuration
configure_netdata
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
# RESTORE SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..."
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
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"
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
yunohost service add "$app" --description "Real-time performance and health monitoring" --log "$install_dir/var/log/netdata/error.log" "$install_dir/var/log/netdata/access.log" "$install_dir/var/log/netdata/debug.log"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
ynh_systemd_action --service_name=$app --action="start" --log_path="$final_path/var/log/$app/error.log"
#=================================================
# GENERIC FINALIZATION
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name="$app" --action="start" --log_path="$install_dir/var/log/$app/error.log"
ynh_systemd_action --service_name=nginx --action=reload

View file

@ -10,143 +10,56 @@ source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
admin=$(ynh_app_setting_get --app=$app --key=admin)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#=================================================
# CHECK VERSION
#=================================================
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=3
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# 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
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
# If final_path doesn't exist, create it
if [ -z "$final_path" ]; then
final_path=/opt/$app
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
fi
# If final_path wrongly refers to /var/www
# see http://tldp.org/LDP/abs/html/comparison-ops.html for syntax reference
if [[ $final_path == /var/www* ]]; then
final_path=/opt/$app
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
fi
# Cleaning legacy permissions
if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all
ynh_app_setting_delete --app=$app --key=is_public
fi
ynh_script_progression --message="Upgrading source files..." --weight=18
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading source files..." --weight=18
# Download, check integrity, uncompress and patch the source from app.src
NETDATA_TMPDIR=$(mktemp -d)
ynh_setup_source "$NETDATA_TMPDIR"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
#=================================================
# SPECIFIC UPGRADE
#=================================================
# Download, check integrity, uncompress and patch the source from app.src
NETDATA_TMPDIR=$(mktemp -d)
ynh_setup_source "$NETDATA_TMPDIR"
#=================================================
# 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}
# 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-prefix /opt --dont-wait --disable-cloud >&3 2>&3 || ynh_die "FAILED TO COMPILE/INSTALL NETDATA"
popd
# close fd 3
exec 3<&-
# signal netdata to start saving its database
# this is handy if your database is big
pids=$(pidof netdata)
if [ -n "${pids}" ]; then
kill -USR1 ${pids}
fi
# create a temporary file for the log
tmplog=$(mktemp /tmp/netdata-updater-log-XXXXXX.log)
pushd "$NETDATA_TMPDIR"
# the installer.sh script will append "netdata" after the --install-prefix arg
./netdata-installer.sh --install-prefix /var/www/ --dont-wait --disable-cloud >"$tmplog" 2>"$tmplog" || ynh_die "FAILED TO COMPILE/INSTALL NETDATA"
popd
# Specific configuration
configure_netdata
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_script_progression --message="Upgrading dependencies..." --weight=7
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"
yunohost service add "$app" --description "Real-time performance and health monitoring" --log "$install_dir/var/log/netdata/error.log" "$install_dir/var/log/netdata/access.log" "$install_dir/var/log/netdata/debug.log"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="restart" --log_path="$final_path/var/log/$app/error.log"
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
ynh_systemd_action --service_name="$app" --action="restart" --log_path="$install_dir/var/log/$app/error.log"
#=================================================
# END OF SCRIPT

9
tests.toml Normal file
View file

@ -0,0 +1,9 @@
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/tests.v1.schema.json
test_format = 1.0
[default]
# ------------
# Tests to run
# ------------