mirror of
https://github.com/YunoHost-Apps/netdata_ynh.git
synced 2024-09-03 19:46:33 +02:00
Refactor, use latest YunoHost 2.7.2 standards
This commit is contained in:
parent
3f12eab1dd
commit
0478e79ea8
13 changed files with 419 additions and 299 deletions
75
README.md
75
README.md
|
@ -1,6 +1,9 @@
|
||||||
NetData for YunoHost
|
NetData for YunoHost
|
||||||
---------------------
|
---------------------
|
||||||
|
|
||||||
|
[](https://install-app.yunohost.org/?app=piwigo)
|
||||||
|
[](https://ci-apps.yunohost.org/jenkins/job/piwigo%20%28Community%29/lastBuild/consoleFull)
|
||||||
|
|
||||||
|
|
||||||
[NetData](http://my-netdata.io/) is a system for **distributed real-time performance and health monitoring**.
|
[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
|
It provides **unparalleled insights, in real-time**, of everything happening on the
|
||||||
|
@ -37,47 +40,52 @@ It has been tested on x86_64 and ARM.
|
||||||
|
|
||||||
- **Stunning interactive bootstrap dashboards**<br/>
|
- **Stunning interactive bootstrap dashboards**<br/>
|
||||||
mouse and touch friendly, in 2 themes: dark, light
|
mouse and touch friendly, in 2 themes: dark, light
|
||||||
|
|
||||||
- **Amazingly fast**<br/>
|
- **Amazingly fast**<br/>
|
||||||
responds to all queries in less than 0.5 ms per metric,
|
responds to all queries in less than 0.5 ms per metric,
|
||||||
even on low-end hardware
|
even on low-end hardware
|
||||||
|
|
||||||
- **Highly efficient**<br/>
|
- **Highly efficient**<br/>
|
||||||
collects thousands of metrics per server per second,
|
collects thousands of metrics per server per second,
|
||||||
with just 1% CPU utilization of a single core, a few MB of RAM and no disk I/O at all
|
with just 1% CPU utilization of a single core, a few MB of RAM and no disk I/O at all
|
||||||
|
|
||||||
- **Sophisticated alarming**<br/>
|
- **Sophisticated alarming**<br/>
|
||||||
|
hundreds of alarms, **out of the box**!<br/>
|
||||||
supports dynamic thresholds, hysteresis, alarm templates,
|
supports dynamic thresholds, hysteresis, alarm templates,
|
||||||
multiple role-based notification methods (such as email, slack.com,
|
multiple role-based notification methods (such as email, slack.com,
|
||||||
pushover.net, pushbullet.com telegram.org, twilio.com, messagebird.com)
|
pushover.net, pushbullet.com, telegram.org, twilio.com, messagebird.com)
|
||||||
|
|
||||||
- **Extensible**<br/>
|
- **Extensible**<br/>
|
||||||
you can monitor anything you can get a metric for,
|
you can monitor anything you can get a metric for,
|
||||||
using its Plugin API (anything can be a netdata plugin,
|
using its Plugin API (anything can be a netdata plugin,
|
||||||
BASH, python, perl, node.js, java, Go, ruby, etc)
|
BASH, python, perl, node.js, java, Go, ruby, etc)
|
||||||
|
|
||||||
- **Embeddable**<br/>
|
- **Embeddable**<br/>
|
||||||
it can run anywhere a Linux kernel runs (even IoT)
|
it can run anywhere a Linux kernel runs (even IoT)
|
||||||
and its charts can be embedded on your web pages too
|
and its charts can be embedded on your web pages too
|
||||||
|
|
||||||
- **Customizable**<br/>
|
- **Customizable**<br/>
|
||||||
custom dashboards can be built using simple HTML (no javascript necessary)
|
custom dashboards can be built using simple HTML (no javascript necessary)
|
||||||
|
|
||||||
- **Zero configuration**<br/>
|
- **Zero configuration**<br/>
|
||||||
auto-detects everything, it can collect up to 5000 metrics
|
auto-detects everything, it can collect up to 5000 metrics
|
||||||
per server out of the box
|
per server out of the box
|
||||||
|
|
||||||
- **Zero dependencies**<br/>
|
- **Zero dependencies**<br/>
|
||||||
it is even its own web server, for its static web files and its web API
|
it is even its own web server, for its static web files and its web API
|
||||||
|
|
||||||
- **Zero maintenance**<br/>
|
- **Zero maintenance**<br/>
|
||||||
you just run it, it does the rest
|
you just run it, it does the rest
|
||||||
|
|
||||||
- **scales to infinity**<br/>
|
- **scales to infinity**<br/>
|
||||||
requiring minimal central resources
|
requiring minimal central resources
|
||||||
|
|
||||||
- **back-ends supported**<br/>
|
- **several operating modes**<br/>
|
||||||
can archive its metrics on `graphite` or `opentsdb`, in the same or lower detail
|
autonomous host monitoring, headless data collector, forwarding proxy, store and forward proxy, central multi-host monitoring, in all possible configurations.
|
||||||
|
Each node may have different metrics retention policy and run with or without health monitoring.
|
||||||
|
|
||||||
|
- **time-series back-ends supported**<br/>
|
||||||
|
can archive its metrics on `graphite`, `opentsdb`, `prometheus`, json document DBs, in the same or lower detail
|
||||||
(lower: to prevent it from congesting these servers due to the amount of data collected)
|
(lower: to prevent it from congesting these servers due to the amount of data collected)
|
||||||
|
|
||||||

|

|
||||||
|
@ -86,7 +94,7 @@ It has been tested on x86_64 and ARM.
|
||||||
|
|
||||||
## What does it monitor?
|
## What does it monitor?
|
||||||
|
|
||||||
netdata monitors several thousands of metrics per device.
|
netdata collects several thousands of metrics per device.
|
||||||
All these metrics are collected and visualized in real-time.
|
All these metrics are collected and visualized in real-time.
|
||||||
|
|
||||||
> _Almost all metrics are auto-detected, without any configuration._
|
> _Almost all metrics are auto-detected, without any configuration._
|
||||||
|
@ -94,13 +102,13 @@ All these metrics are collected and visualized in real-time.
|
||||||
This is a list of what it currently monitors:
|
This is a list of what it currently monitors:
|
||||||
|
|
||||||
- **CPU**<br/>
|
- **CPU**<br/>
|
||||||
usage, interrupts, softirqs, frequency, total and per core
|
usage, interrupts, softirqs, frequency, total and per core, CPU states
|
||||||
|
|
||||||
- **Memory**<br/>
|
- **Memory**<br/>
|
||||||
RAM, swap and kernel memory usage, KSM (Kernel Samepage Merging), NUMA
|
RAM, swap and kernel memory usage, KSM (Kernel Samepage Merging), NUMA
|
||||||
|
|
||||||
- **Disks**<br/>
|
- **Disks**<br/>
|
||||||
per disk: I/O, operations, backlog, utilization, space
|
per disk: I/O, operations, backlog, utilization, space, software RAID (md)
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
@ -176,6 +184,9 @@ This is a list of what it currently monitors:
|
||||||
- **Tomcat**<br/>
|
- **Tomcat**<br/>
|
||||||
accesses, threads, free memory, volume
|
accesses, threads, free memory, volume
|
||||||
|
|
||||||
|
- **web server log files**<br/>
|
||||||
|
extracting in real-time, web server performance metrics and applying several health checks
|
||||||
|
|
||||||
- **mySQL databases**<br/>
|
- **mySQL databases**<br/>
|
||||||
multiple servers, each showing: bandwidth, queries/s, handlers, locks, issues,
|
multiple servers, each showing: bandwidth, queries/s, handlers, locks, issues,
|
||||||
tmp operations, connections, binlog metrics, threads, innodb metrics, and more
|
tmp operations, connections, binlog metrics, threads, innodb metrics, and more
|
||||||
|
@ -188,12 +199,21 @@ This is a list of what it currently monitors:
|
||||||
- **Redis databases**<br/>
|
- **Redis databases**<br/>
|
||||||
multiple servers, each showing: operations, hit rate, memory, keys, clients, slaves
|
multiple servers, each showing: operations, hit rate, memory, keys, clients, slaves
|
||||||
|
|
||||||
|
- **mongodb**<br/>
|
||||||
|
operations, clients, transactions, cursors, connections, asserts, locks, etc
|
||||||
|
|
||||||
- **memcached databases**<br/>
|
- **memcached databases**<br/>
|
||||||
multiple servers, each showing: bandwidth, connections, items
|
multiple servers, each showing: bandwidth, connections, items
|
||||||
|
|
||||||
|
- **elasticsearch**<br/>
|
||||||
|
search and index performance, latency, timings, cluster statistics, threads statistics, etc
|
||||||
|
|
||||||
- **ISC Bind name servers**<br/>
|
- **ISC Bind name servers**<br/>
|
||||||
multiple servers, each showing: clients, requests, queries, updates, failures and several per view metrics
|
multiple servers, each showing: clients, requests, queries, updates, failures and several per view metrics
|
||||||
|
|
||||||
|
- **NSD name servers**<br/>
|
||||||
|
queries, zones, protocols, query types, transfers, etc.
|
||||||
|
|
||||||
- **Postfix email servers**<br/>
|
- **Postfix email servers**<br/>
|
||||||
message queue (entries, size)
|
message queue (entries, size)
|
||||||
|
|
||||||
|
@ -202,14 +222,26 @@ This is a list of what it currently monitors:
|
||||||
|
|
||||||
- **Dovecot** POP3/IMAP servers<br/>
|
- **Dovecot** POP3/IMAP servers<br/>
|
||||||
|
|
||||||
|
- **ISC dhcpd**<br/>
|
||||||
|
pools utilization, leases, etc.
|
||||||
|
|
||||||
- **IPFS**<br/>
|
- **IPFS**<br/>
|
||||||
bandwidth, peers
|
bandwidth, peers
|
||||||
|
|
||||||
- **Squid proxy servers**<br/>
|
- **Squid proxy servers**<br/>
|
||||||
multiple servers, each showing: clients bandwidth and requests, servers bandwidth and requests
|
multiple servers, each showing: clients bandwidth and requests, servers bandwidth and requests
|
||||||
|
|
||||||
|
- **HAproxy**<br/>
|
||||||
|
bandwidth, sessions, backends, etc
|
||||||
|
|
||||||
|
- **varnish**<br/>
|
||||||
|
threads, sessions, hits, objects, backends, etc
|
||||||
|
|
||||||
|
- **OpenVPN**<br/>
|
||||||
|
status per tunnel
|
||||||
|
|
||||||
- **Hardware sensors**<br/>
|
- **Hardware sensors**<br/>
|
||||||
temperature, voltage, fans, power, humidity
|
`lm_sensors` and `IPMI`: temperature, voltage, fans, power, humidity
|
||||||
|
|
||||||
- **NUT and APC UPSes**<br/>
|
- **NUT and APC UPSes**<br/>
|
||||||
load, charge, battery voltage, temperature, utility metrics, output metrics
|
load, charge, battery voltage, temperature, utility metrics, output metrics
|
||||||
|
@ -220,11 +252,16 @@ This is a list of what it currently monitors:
|
||||||
- **hddtemp**<br/>
|
- **hddtemp**<br/>
|
||||||
disk temperatures
|
disk temperatures
|
||||||
|
|
||||||
|
- **smartd**<br/>
|
||||||
|
disk S.M.A.R.T. values
|
||||||
|
|
||||||
- **SNMP devices**<br/>
|
- **SNMP devices**<br/>
|
||||||
can be monitored too (although you will need to configure these)
|
can be monitored too (although you will need to configure these)
|
||||||
|
|
||||||
And you can extend it, by writing plugins that collect data from any source, using any computer language.
|
- **statsd**<br/>
|
||||||
|
[netdata is a fully featured statsd server](https://github.com/firehol/netdata/wiki/statsd)
|
||||||
|
|
||||||
|
And you can extend it, by writing plugins that collect data from any source, using any computer language.
|
||||||
|
|
||||||
## Links
|
## Links
|
||||||
|
|
||||||
|
|
|
@ -17,10 +17,6 @@
|
||||||
wrong_user=0
|
wrong_user=0
|
||||||
wrong_path=1
|
wrong_path=1
|
||||||
incorrect_path=1
|
incorrect_path=1
|
||||||
corrupt_source=0
|
|
||||||
fail_download_source=0
|
|
||||||
port_already_use=0
|
|
||||||
final_path_already_use=0
|
|
||||||
;;; Levels
|
;;; Levels
|
||||||
Level 1=auto
|
Level 1=auto
|
||||||
Level 2=auto
|
Level 2=auto
|
||||||
|
@ -34,3 +30,6 @@
|
||||||
Level 8=0
|
Level 8=0
|
||||||
Level 9=0
|
Level 9=0
|
||||||
Level 10=0
|
Level 10=0
|
||||||
|
;;; Options
|
||||||
|
Email=
|
||||||
|
Notification=none
|
4
conf/app.src
Normal file
4
conf/app.src
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
SOURCE_URL=https://github.com/firehol/netdata/releases/download/v1.7.0/netdata-1.7.0.tar.gz
|
||||||
|
SOURCE_SUM=d088d5c6c22ac9241b87480df76de65a414ba9955be3399bd593929ca3c7a417
|
||||||
|
SOURCE_FORMAT=tar.gz
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
Section: misc
|
|
||||||
Priority: optional
|
|
||||||
Homepage: https://https://my-netdata.io/
|
|
||||||
Standards-Version: 3.9.2
|
|
||||||
|
|
||||||
Package: netdata-deps
|
|
||||||
Version: 1.6.0-1
|
|
||||||
Depends: zlib1g-dev, uuid-dev, libmnl-dev, gcc, make, git, autoconf, autoconf-archive, autogen, automake, pkg-config, curl, jq, nodejs, python-mysqldb, libipmimonitoring-dev
|
|
||||||
Architecture: all
|
|
||||||
Description: meta package for NetData dependencies
|
|
||||||
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.
|
|
||||||
.
|
|
||||||
This meta-package is only responsible of installing its dependencies.
|
|
|
@ -1,8 +1,8 @@
|
||||||
location YNH_WWW_PATH {
|
#for-subdir location __PATH__ {
|
||||||
return 301 YNH_WWW_PATH/;
|
#for-subdir return 301 __PATH__/;
|
||||||
}
|
#for-subdir }
|
||||||
|
|
||||||
location ~ YNH_WWW_PATH/(?<ndpath>.*) {
|
location ~ __PATH__/(?<ndpath>.*) {
|
||||||
proxy_redirect off;
|
proxy_redirect off;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
location / {
|
|
||||||
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_pass http://127.0.0.1:19999;
|
|
||||||
proxy_http_version 1.1;
|
|
||||||
proxy_pass_request_headers on;
|
|
||||||
proxy_set_header Connection "keep-alive";
|
|
||||||
proxy_store off;
|
|
||||||
|
|
||||||
# Include SSOWAT user panel.
|
|
||||||
include conf.d/yunohost_panel.conf.inc;
|
|
||||||
}
|
|
|
@ -15,7 +15,7 @@
|
||||||
"url": ""
|
"url": ""
|
||||||
},
|
},
|
||||||
"requirements": {
|
"requirements": {
|
||||||
"yunohost": ">> 2.4.0"
|
"yunohost": ">= 2.7.2"
|
||||||
},
|
},
|
||||||
"multi_instance": false,
|
"multi_instance": false,
|
||||||
"services": [
|
"services": [
|
||||||
|
|
|
@ -3,42 +3,32 @@
|
||||||
# Common variables
|
# Common variables
|
||||||
#
|
#
|
||||||
|
|
||||||
# Application version
|
pkg_dependencies="zlib1g-dev uuid-dev libmnl-dev gcc make git autoconf autoconf-archive autogen automake pkg-config curl jq nodejs python-mysqldb libipmimonitoring-dev"
|
||||||
VERSION="1.7.0"
|
|
||||||
|
|
||||||
# Remote URL to fetch application source archive
|
# Configure NetData
|
||||||
APPLICATION_SOURCE_URL="https://github.com/firehol/netdata/releases/download/v${VERSION}/netdata-${VERSION}.tar.gz"
|
configure_netdata() {
|
||||||
|
# Create netdata user to monitor MySQL (if needed)
|
||||||
|
is_mysql_user_existing=$(ynh_mysql_execute_as_root "select user from mysql.user where user = 'netdata';")
|
||||||
|
if [ -z "$is_mysql_user_existing" ] ; then
|
||||||
|
ynh_mysql_execute_as_root "create user 'netdata'@'localhost';
|
||||||
|
grant usage on *.* to 'netdata'@'localhost' with grant option;
|
||||||
|
flush privileges;"
|
||||||
|
fi
|
||||||
|
|
||||||
# Package name for NetData dependencies
|
# Give dovecot privileges to netdata user to monitor Dovecot
|
||||||
DEPS_PKG_NAME="netdata-deps"
|
# Need dovecot 2.2.16+
|
||||||
|
setfacl -m u:netdata:rw /var/run/dovecot/stats
|
||||||
|
|
||||||
#
|
# Add netdata to the adm group to access web logs
|
||||||
# Common helpers
|
usermod -a -G adm netdata
|
||||||
#
|
|
||||||
|
|
||||||
# Download and extract application sources to the given directory
|
# Declare service for YunoHost monitoring
|
||||||
# usage: extract_application_to DESTDIR
|
yunohost service add netdata --log "/opt/netdata/var/log/netdata/error.log" "/opt/netdata/var/log/netdata/access.log" "/opt/netdata/var/log/netdata/debug.log"
|
||||||
extract_application() {
|
|
||||||
TMPDIR=$(mktemp -d)
|
# Restart NetData
|
||||||
chmod 755 $TMPDIR
|
systemctl restart netdata
|
||||||
archive="${TMPDIR}/application.tar.gz"
|
|
||||||
wget -q -O "$archive" "$APPLICATION_SOURCE_URL" \
|
# Store the uninstaller for the removal script
|
||||||
|| ynh_die "Unable to download application archive"
|
mv ./netdata-uninstaller.sh /opt/netdata/etc/netdata
|
||||||
tar xf "$archive" -C "$TMPDIR" --strip-components 1 \
|
|
||||||
|| ynh_die "Unable to extract application archive"
|
|
||||||
rm "$archive"
|
|
||||||
echo "$TMPDIR"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Fix path if needed
|
|
||||||
# usage: fix_patch PATH_TO_FIX
|
|
||||||
fix_path() {
|
|
||||||
local path=$1
|
|
||||||
if [ "${path:0:1}" != "/" ] && [ ${#path} -gt 0 ]; then
|
|
||||||
path="/$path"
|
|
||||||
fi
|
|
||||||
if [ "${path:${#path}-1}" == "/" ] && [ ${#path} -gt 1 ]; then
|
|
||||||
path="${path:0:${#path}-1}"
|
|
||||||
fi
|
|
||||||
echo "$path"
|
|
||||||
}
|
|
|
@ -1,17 +1,45 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Exit on command errors and treat unset variables as an error
|
#=================================================
|
||||||
|
# GENERIC START
|
||||||
|
#=================================================
|
||||||
|
# MANAGE SCRIPT FAILURE
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Exit on command errors and treat access to unset variables as an error
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# IMPORT GENERIC HELPERS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
if [ ! -e _common.sh ]; then
|
||||||
|
# Get the _common.sh file if it's not in the current directory
|
||||||
|
cp ../settings/scripts/_common.sh ./_common.sh
|
||||||
|
chmod a+rx _common.sh
|
||||||
|
fi
|
||||||
|
source _common.sh
|
||||||
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# LOAD SETTINGS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
# Source YunoHost helpers
|
domain=$(ynh_app_setting_get "$app" domain)
|
||||||
source /usr/share/yunohost/helpers
|
|
||||||
|
#=================================================
|
||||||
|
# STANDARD BACKUP STEPS
|
||||||
|
#=================================================
|
||||||
|
# BACKUP THE APP CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
|
||||||
# Backup configuration files
|
# Backup configuration files
|
||||||
# Note: the last argument is where to save this path, see the restore script.
|
ynh_backup "/opt/netdata/etc/netdata"
|
||||||
ynh_backup "/opt/netdata/etc/netdata" "conf"
|
|
||||||
|
|
||||||
# Copy NGINX configuration
|
#=================================================
|
||||||
domain=$(ynh_app_setting_get "$app" domain)
|
# BACKUP THE NGINX CONFIGURATION
|
||||||
ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf" "nginx.conf"
|
#=================================================
|
||||||
|
|
||||||
|
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
158
scripts/install
158
scripts/install
|
@ -1,89 +1,121 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Exit on command errors and treat unset variables as an error
|
#=================================================
|
||||||
set -eu
|
# GENERIC START
|
||||||
|
#=================================================
|
||||||
|
# IMPORT GENERIC HELPERS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
shopt -s extglob # sets extended pattern matching options in the bash shell
|
source _common.sh
|
||||||
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# MANAGE SCRIPT FAILURE
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
# Source local helpers
|
#=================================================
|
||||||
source ./_common.sh
|
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
SRCPATH=$(pwd)
|
# Normalize the url path syntax
|
||||||
|
path_url=$(ynh_normalize_url_path $path_url)
|
||||||
|
|
||||||
# Retrieve arguments
|
# Check web path availability
|
||||||
domain=$YNH_APP_ARG_DOMAIN
|
ynh_webpath_available $domain $path_url
|
||||||
path=$YNH_APP_ARG_PATH
|
# Register (book) web path
|
||||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
ynh_webpath_register $app $domain $path_url
|
||||||
|
|
||||||
# Source YunoHost helpers
|
#=================================================
|
||||||
source /usr/share/yunohost/helpers
|
# STORE SETTINGS FROM MANIFEST
|
||||||
|
#=================================================
|
||||||
|
|
||||||
# Save app settings
|
ynh_app_setting_set $app domain $domain
|
||||||
ynh_app_setting_set "$app" is_public "$is_public"
|
ynh_app_setting_set $app path $path_url
|
||||||
|
ynh_app_setting_set $app is_public $is_public
|
||||||
|
|
||||||
# Fix path if needed
|
#=================================================
|
||||||
path=$(fix_path $path)
|
# STANDARD MODIFICATIONS
|
||||||
|
#=================================================
|
||||||
|
# INSTALL DEPENDENCIES
|
||||||
|
#=================================================
|
||||||
|
|
||||||
# Check domain/path availability
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
sudo yunohost app checkurl "${domain}${path}" -a "$app" \
|
|
||||||
|| ynh_die "Path not available: ${domain}${path}"
|
|
||||||
|
|
||||||
# Download and extract application
|
#=================================================
|
||||||
NETDATA_TMPDIR=$(extract_application)
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
|
#=================================================
|
||||||
|
|
||||||
# Install dependencies
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
ynh_package_install_from_equivs ../conf/${DEPS_PKG_NAME}.control \
|
NETDATA_TMPDIR=$(mktemp -d)
|
||||||
|| ynh_die "Unable to install dependencies"
|
ynh_setup_source "$NETDATA_TMPDIR"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# NGINX CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
nginx_conf="../conf/nginx.conf"
|
||||||
|
if [ "$path_url" = "/" ]
|
||||||
|
then
|
||||||
|
# Handle root path, avoid double slash.
|
||||||
|
# Temporary fix, in waiting for an upgrade of the helper. (#361)
|
||||||
|
path_url_slash_less=${path_url%/}
|
||||||
|
ynh_replace_string "__PATH__/" "$path_url_slash_less/" $nginx_conf
|
||||||
|
else
|
||||||
|
# Move prefix comment #for-subdir at end of lines
|
||||||
|
ynh_replace_string "#for-subdir\(.*\)" "\1 #for-subdir" $nginx_conf
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Create a dedicated nginx config
|
||||||
|
ynh_add_nginx_config
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SPECIFIC SETUP
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# INSTALL AND CONFIGURE NETDATA
|
||||||
|
#=================================================
|
||||||
|
|
||||||
# Launch netdata installation in /opt directory
|
# Launch netdata installation in /opt directory
|
||||||
cd $NETDATA_TMPDIR
|
pushd $NETDATA_TMPDIR
|
||||||
sudo ./netdata-installer.sh --install /opt --dont-wait
|
./netdata-installer.sh --install /opt --dont-wait
|
||||||
|
|
||||||
# Create netdata user to monitor MySQL
|
configure_netdata
|
||||||
ynh_mysql_execute_as_root "create user 'netdata'@'localhost';
|
|
||||||
grant usage on *.* to 'netdata'@'localhost' with grant option;
|
|
||||||
flush privileges;"
|
|
||||||
|
|
||||||
# Give dovecot privileges to netdata user to monitor Dovecot
|
# Store the app.src file
|
||||||
# Need dovecot 2.2.16+
|
popd
|
||||||
sudo setfacl -m u:netdata:rw /var/run/dovecot/stats
|
cp ../conf/app.src /opt/netdata/etc/netdata
|
||||||
|
|
||||||
# Add netdata to the adm group to access web logs
|
#=================================================
|
||||||
sudo usermod -a -G adm netdata
|
# GENERIC FINALIZATION
|
||||||
|
#=================================================
|
||||||
|
|
||||||
# Extend weblog path to process logs for every domain
|
#=================================================
|
||||||
sed -i "s@path: '/var/log/nginx/access.log'@path: '/var/log/nginx/*-access.log'@g" /opt/netdata/etc/netdata/python.d/web_log.conf
|
# SETUP SSOWAT
|
||||||
|
#=================================================
|
||||||
# Declare service for YunoHost monitoring
|
|
||||||
sudo yunohost service add netdata --log "/opt/netdata/var/log/netdata/error.log" "/opt/netdata/var/log/netdata/access.log" "/opt/netdata/var/log/netdata/debug.log"
|
|
||||||
|
|
||||||
# Restart NetData
|
|
||||||
sudo systemctl restart netdata
|
|
||||||
|
|
||||||
# Store the uninstaller for the removal script
|
|
||||||
sudo mv ./netdata-uninstaller.sh /opt/netdata/etc/netdata
|
|
||||||
|
|
||||||
# Store useful files for backup/restore scripts
|
|
||||||
sudo cp $SRCPATH/_common.sh /opt/netdata/etc/netdata
|
|
||||||
sudo cp $SRCPATH/../conf/netdata-deps.control /opt/netdata/etc/netdata
|
|
||||||
|
|
||||||
# Modify Nginx configuration file and copy it to Nginx conf directory
|
|
||||||
if [[ "$path" == "/" ]] ; then
|
|
||||||
nginx_conf=$SRCPATH/../conf/nginx_root.conf
|
|
||||||
else
|
|
||||||
nginx_conf=$SRCPATH/../conf/nginx_sub_dir.conf
|
|
||||||
fi
|
|
||||||
|
|
||||||
sed -i "s@YNH_WWW_PATH@$path@g" $nginx_conf
|
|
||||||
sudo cp $nginx_conf /etc/nginx/conf.d/$domain.d/$app.conf
|
|
||||||
|
|
||||||
# If app is public, add url to SSOWat conf as skipped_uris
|
# If app is public, add url to SSOWat conf as skipped_uris
|
||||||
if [[ $is_public -eq 1 ]]; then
|
if [ $is_public -eq 1 ]; then
|
||||||
# unprotected_uris allows SSO credentials to be passed anyway.
|
# unprotected_uris allows SSO credentials to be passed anyway.
|
||||||
ynh_app_setting_set "$app" unprotected_uris "/"
|
ynh_app_setting_set "$app" unprotected_uris "/"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Reload services
|
|
||||||
sudo systemctl reload nginx
|
#=================================================
|
||||||
|
# RELOAD NGINX
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
systemctl reload nginx
|
||||||
|
|
|
@ -1,53 +1,65 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Treat unset variables as an error
|
#=================================================
|
||||||
set -u
|
# GENERIC START
|
||||||
|
#=================================================
|
||||||
|
# IMPORT GENERIC HELPERS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
# See comments in install script
|
if [ ! -e _common.sh ]; then
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
# Get file fonction if not been to the current directory
|
||||||
|
cp ../settings/scripts/_common.sh ./_common.sh
|
||||||
# Source YunoHost helpers
|
chmod a+rx _common.sh
|
||||||
|
fi
|
||||||
|
# Source app helpers
|
||||||
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
# Source local helpers
|
#=================================================
|
||||||
source ./_common.sh
|
# LOAD SETTINGS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
# Retrieve app settings
|
|
||||||
domain=$(ynh_app_setting_get "$app" domain)
|
domain=$(ynh_app_setting_get "$app" domain)
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# STANDARD REMOVE
|
||||||
|
#=================================================
|
||||||
|
# REMOVE DEPENDENCIES
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Remove metapackage and its dependencies
|
||||||
|
ynh_remove_app_dependencies
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# REMOVE APP
|
||||||
|
#=================================================
|
||||||
|
|
||||||
# Prepare to execute uninstaller(generated by NetData install script)
|
# Prepare to execute uninstaller(generated by NetData install script)
|
||||||
UNINSTALL_SCRIPT="netdata-uninstaller.sh"
|
UNINSTALL_SCRIPT="netdata-uninstaller.sh"
|
||||||
|
|
||||||
# Move outside the directory (which will be removed)
|
# Move outside the directory (which will be removed)
|
||||||
sudo mv /opt/netdata/etc/netdata/${UNINSTALL_SCRIPT} /tmp
|
mv /opt/netdata/etc/netdata/${UNINSTALL_SCRIPT} /tmp
|
||||||
cd /tmp
|
cd /tmp
|
||||||
|
|
||||||
# Remove the need for interaction
|
# Remove the need for interaction
|
||||||
sudo sed -i "s/rm -i/rm -f/g" ${UNINSTALL_SCRIPT}
|
ynh_replace_string "rm -i" "rm -f" ${UNINSTALL_SCRIPT}
|
||||||
sudo sed -i "s/rm -I/rm -f/g" ${UNINSTALL_SCRIPT}
|
ynh_replace_string "rm -I" "rm -f" ${UNINSTALL_SCRIPT}
|
||||||
# Execute the uninstall script
|
# Execute the uninstall script
|
||||||
sudo ./${UNINSTALL_SCRIPT} --force
|
./${UNINSTALL_SCRIPT} --force
|
||||||
|
|
||||||
# Remove app dependencies
|
#=================================================
|
||||||
ynh_package_autoremove "$DEPS_PKG_NAME" || true
|
# REMOVE NGINX CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
|
||||||
# Remove access rights for Dovecot monitoring
|
# Remove the dedicated nginx config
|
||||||
sudo setfacl -x u:netdata /var/run/dovecot/stats
|
ynh_remove_nginx_config
|
||||||
|
|
||||||
# Remove user and group
|
|
||||||
sudo userdel netdata
|
|
||||||
|
|
||||||
# Remove service from YunoHost monitoring
|
|
||||||
sudo yunohost service remove netdata
|
|
||||||
|
|
||||||
# Remove MySQL user
|
|
||||||
echo "drop user 'netdata'@'localhost';" | mysql -uroot -p$(sudo cat /etc/yunohost/mysql)
|
|
||||||
|
|
||||||
# Remove nginx configuration file
|
|
||||||
sudo rm -f /etc/nginx/conf.d/$domain.d/$app.conf
|
|
||||||
sudo rm -rf /home/yunohost.app/$app
|
|
||||||
|
|
||||||
# Reload nginx service
|
|
||||||
sudo systemctl reload nginx
|
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SPECIFIC REMOVE
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# The following command is kept as a matter of transition with the previous way
|
||||||
|
# of managing dependencies
|
||||||
|
ynh_package_autoremove "netdata-deps" || true
|
||||||
|
|
113
scripts/restore
113
scripts/restore
|
@ -1,67 +1,88 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Exit on command errors and treat unset variables as an error
|
#=================================================
|
||||||
|
# GENERIC START
|
||||||
|
#=================================================
|
||||||
|
# MANAGE SCRIPT FAILURE
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Exit on command errors and treat access to unset variables as an error
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# IMPORT GENERIC HELPERS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
if [ ! -e _common.sh ]; then
|
||||||
|
# Get the _common.sh file if it's not in the current directory
|
||||||
|
cp ../settings/scripts/_common.sh ./_common.sh
|
||||||
|
chmod a+rx _common.sh
|
||||||
|
fi
|
||||||
|
source _common.sh
|
||||||
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# LOAD SETTINGS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
# Source YunoHost helpers
|
domain=$(ynh_app_setting_get $app domain)
|
||||||
source /usr/share/yunohost/helpers
|
path_url=$(ynh_app_setting_get $app path)
|
||||||
|
|
||||||
# Retrieve old app settings
|
#=================================================
|
||||||
domain=$(ynh_app_setting_get "$app" domain)
|
# CHECK IF THE APP CAN BE RESTORED
|
||||||
path=$(ynh_app_setting_get "$app" path)
|
#=================================================
|
||||||
|
|
||||||
# Source local helpers
|
ynh_webpath_available $domain $path_url \
|
||||||
source ./conf/_common.sh
|
|| ynh_die "Path not available: ${domain}${path_url}"
|
||||||
SRCPATH=$(pwd)
|
|
||||||
|
|
||||||
# Fix path if needed
|
#=================================================
|
||||||
path=$(fix_path $path)
|
# STANDARD RESTORATION STEPS
|
||||||
|
#=================================================
|
||||||
|
# RESTORE THE NGINX CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
|
||||||
# Check domain/path availability
|
ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
sudo yunohost app checkurl "${domain}${path}" -a "$app" \
|
|
||||||
|| ynh_die "Path not available: ${domain}${path}"
|
|
||||||
|
|
||||||
# Download and extract application
|
|
||||||
NETDATA_TMPDIR=$(extract_application)
|
|
||||||
|
|
||||||
# Install dependencies
|
#=================================================
|
||||||
ynh_package_install_from_equivs ./conf/${DEPS_PKG_NAME}.control \
|
# INSTALL DEPENDENCIES
|
||||||
|| ynh_die "Unable to install dependencies"
|
#=================================================
|
||||||
|
|
||||||
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Retrieve app.src from archive for ynh_setup_source helper
|
||||||
|
mkdir ../conf
|
||||||
|
cp opt/netdata/etc/netdata/app.src ../conf
|
||||||
|
|
||||||
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
|
NETDATA_TMPDIR=$(mktemp -d)
|
||||||
|
ynh_setup_source "$NETDATA_TMPDIR"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# INSTALL AND RESTORE THE APP CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
|
||||||
# Launch netdata installation in /opt directory
|
# Launch netdata installation in /opt directory
|
||||||
cd $NETDATA_TMPDIR
|
cd $NETDATA_TMPDIR
|
||||||
sudo ./netdata-installer.sh --install /opt --dont-wait
|
./netdata-installer.sh --install /opt --dont-wait
|
||||||
|
|
||||||
# Create netdata user to monitor MySQL (if needed)
|
configure_netdata
|
||||||
echo "select User from mysql.user where User = 'netdata';"| mysql -uroot -p$(sudo cat /etc/yunohost/mysql) || echo "create user 'netdata'@'localhost';
|
|
||||||
grant usage on *.* to 'netdata'@'localhost' with grant option;
|
|
||||||
flush privileges;" | mysql -uroot -p$(sudo cat /etc/yunohost/mysql)
|
|
||||||
|
|
||||||
# Give dovecot privileges to netdata user to monitor Dovecot
|
|
||||||
# Need dovecot 2.2.16+
|
|
||||||
sudo setfacl -m u:netdata:rw /var/run/dovecot/stats
|
|
||||||
|
|
||||||
# Add netdata to the adm group to access web logs
|
|
||||||
sudo usermod -a -G adm netdata
|
|
||||||
|
|
||||||
# Restart NetData
|
|
||||||
sudo systemctl restart netdata
|
|
||||||
|
|
||||||
# Store the uninstaller for the removal script
|
|
||||||
sudo mv ./netdata-uninstaller.sh /opt/netdata
|
|
||||||
|
|
||||||
# Restore configuration files
|
# Restore configuration files
|
||||||
conf_path="/opt/netdata/etc/netdata"
|
ynh_restore_file "/opt/netdata/etc/netdata"
|
||||||
sudo cp -a $SRCPATH/conf/* "$conf_path"
|
|
||||||
|
|
||||||
# Restore permissions to app files
|
# Restore permissions to app files
|
||||||
# you may need to make some file and/or directory writeable by www-data (nginx user)
|
chown -R root: "/opt/netdata/etc/netdata"
|
||||||
sudo chown -R root: "$conf_path"
|
|
||||||
|
|
||||||
# Restore NGINX configuration
|
#=================================================
|
||||||
sudo cp -a $SRCPATH/nginx.conf "/etc/nginx/conf.d/${domain}.d/${app}.conf"
|
# GENERIC FINALISATION
|
||||||
|
#=================================================
|
||||||
|
# RELOAD NGINX AND PHP-FPM
|
||||||
|
#=================================================
|
||||||
|
|
||||||
# Restart webserver
|
systemctl reload nginx
|
||||||
sudo systemctl reload nginx
|
|
||||||
|
|
146
scripts/upgrade
146
scripts/upgrade
|
@ -1,38 +1,86 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Exit on command errors and treat unset variables as an error
|
#=================================================
|
||||||
set -eu
|
# GENERIC START
|
||||||
|
#=================================================
|
||||||
|
# IMPORT GENERIC HELPERS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
shopt -s extglob # sets extended pattern matching options in the bash shell
|
source _common.sh
|
||||||
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# LOAD SETTINGS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
# Source local helpers
|
domain=$(ynh_app_setting_get $app domain)
|
||||||
source ./_common.sh
|
path_url=$(ynh_app_setting_get $app path)
|
||||||
SRCPATH=$(pwd)
|
is_public=$(ynh_app_setting_get $app is_public)
|
||||||
|
|
||||||
# Source YunoHost helpers
|
|
||||||
source /usr/share/yunohost/helpers
|
|
||||||
|
|
||||||
# Retrieve app settings
|
#=================================================
|
||||||
domain=$(ynh_app_setting_get "$app" domain)
|
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||||
path=$(ynh_app_setting_get "$app" path)
|
#=================================================
|
||||||
is_public=$(ynh_app_setting_get "$app" is_public)
|
|
||||||
|
|
||||||
# Fix path if needed
|
ynh_backup_before_upgrade # Backup the current version of the app
|
||||||
path=$(fix_path $path)
|
ynh_clean_setup () {
|
||||||
|
ynh_restore_upgradebackup # restore it if the upgrade fails
|
||||||
|
}
|
||||||
|
ynh_abort_if_errors # Active trap pour arrêter le script si une erreur est détectée.
|
||||||
|
|
||||||
# Upgrade dependencies
|
#=================================================
|
||||||
ynh_package_install_from_equivs ../conf/${DEPS_PKG_NAME}.control \
|
# CHECK THE PATH
|
||||||
|| ynh_die "Unable to upgrade dependencies"
|
#=================================================
|
||||||
|
|
||||||
# Download and extract application
|
# Normalize the URL path syntax
|
||||||
NETDATA_TMPDIR=$(extract_application)
|
path_url=$(ynh_normalize_url_path $path_url)
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# STANDARD UPGRADE STEPS
|
||||||
|
#=================================================
|
||||||
|
#=================================================
|
||||||
|
# NGINX CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
nginx_conf="../conf/nginx.conf"
|
||||||
|
if [ "$path_url" = "/" ]
|
||||||
|
then
|
||||||
|
# Handle root path, avoid double slash.
|
||||||
|
# Temporary fix, in waiting for an upgrade of the helper. (#361)
|
||||||
|
path_url_slash_less=${path_url%/}
|
||||||
|
ynh_replace_string "__PATH__/" "$path_url_slash_less/" $nginx_conf
|
||||||
|
else
|
||||||
|
# Move prefix comment #for-subdir at end of lines
|
||||||
|
ynh_replace_string "#for-subdir\(.*\)" "\1 #for-subdir" $nginx_conf
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Create a dedicated nginx config
|
||||||
|
ynh_add_nginx_config
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# UPGRADE DEPENDENCIES
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# 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"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SPECIFIC UPGRADE
|
||||||
|
#=================================================
|
||||||
|
|
||||||
# signal netdata to start saving its database
|
# signal netdata to start saving its database
|
||||||
# this is handy if your database is big
|
# this is handy if your database is big
|
||||||
pids=$(pidof netdata)
|
pids=$(pidof netdata)
|
||||||
[ ! -z "${pids}" ] && sudo kill -USR1 ${pids}
|
[ ! -z "${pids}" ] && kill -USR1 ${pids}
|
||||||
|
|
||||||
# create a temporary file for the log
|
# create a temporary file for the log
|
||||||
tmp=$(mktemp /tmp/netdata-updater-log-XXXXXX.log)
|
tmp=$(mktemp /tmp/netdata-updater-log-XXXXXX.log)
|
||||||
|
@ -40,53 +88,29 @@ tmp=$(mktemp /tmp/netdata-updater-log-XXXXXX.log)
|
||||||
exec 3>${tmp}
|
exec 3>${tmp}
|
||||||
|
|
||||||
# Launch netdata installation in /opt directory
|
# Launch netdata installation in /opt directory
|
||||||
cd $NETDATA_TMPDIR
|
pushd $NETDATA_TMPDIR
|
||||||
sudo ./netdata-installer.sh --install /opt --dont-wait >&3 2>&3 || ynh_die "FAILED TO COMPILE/INSTALL NETDATA"
|
./netdata-installer.sh --install /opt --dont-wait >&3 2>&3 || ynh_die "FAILED TO COMPILE/INSTALL NETDATA"
|
||||||
|
|
||||||
# Create netdata user to monitor MySQL (if needed)
|
configure_netdata
|
||||||
is_mysql_user_existing=$(ynh_mysql_execute_as_root "select user from mysql.user where user = 'netdata';")
|
|
||||||
if [ -z "$is_mysql_user_existing" ] ; then
|
|
||||||
ynh_mysql_execute_as_root "create user 'netdata'@'localhost';
|
|
||||||
grant usage on *.* to 'netdata'@'localhost' with grant option;
|
|
||||||
flush privileges;"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Give dovecot privileges to netdata user to monitor Dovecot
|
# Store the app.src file
|
||||||
# Need dovecot 2.2.16+
|
popd
|
||||||
sudo setfacl -m u:netdata:rw /var/run/dovecot/stats
|
cp ../conf/app.src /opt/netdata/etc/netdata
|
||||||
|
|
||||||
# Add netdata to the adm group to access web logs
|
|
||||||
sudo usermod -a -G adm netdata
|
|
||||||
|
|
||||||
# Extend weblog path to process logs for every domain
|
|
||||||
sed -i "s@path: '/var/log/nginx/access.log'@path: '/var/log/nginx/*-access.log'@g" /opt/netdata/etc/netdata/python.d/web_log.conf
|
|
||||||
|
|
||||||
# Declare service for YunoHost monitoring
|
|
||||||
sudo yunohost service add netdata --log "/opt/netdata/var/log/netdata/error.log" "/opt/netdata/var/log/netdata/access.log" "/opt/netdata/var/log/netdata/debug.log"
|
|
||||||
|
|
||||||
# Restart NetData
|
|
||||||
sudo systemctl restart netdata
|
|
||||||
|
|
||||||
# Store the uninstaller for the removal script
|
|
||||||
sudo mv ./netdata-uninstaller.sh /opt/netdata/etc/netdata
|
|
||||||
# Store the local helper for backup/restore scripts
|
|
||||||
sudo cp $SRCPATH/_common.sh /opt/netdata/etc/netdata
|
|
||||||
|
|
||||||
# Modify Nginx configuration file and copy it to Nginx conf directory
|
|
||||||
if [[ "$path" == "/" ]] ; then
|
|
||||||
nginx_conf=$SRCPATH/../conf/nginx_root.conf
|
|
||||||
else
|
|
||||||
nginx_conf=$SRCPATH/../conf/nginx_sub_dir.conf
|
|
||||||
fi
|
|
||||||
|
|
||||||
sed -i "s@YNH_WWW_PATH@${path}@g" $nginx_conf
|
|
||||||
sudo cp $nginx_conf /etc/nginx/conf.d/$domain.d/$app.conf
|
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# GENERIC FINALIZATION
|
||||||
|
#=================================================
|
||||||
|
# SETUP SSOWAT
|
||||||
|
#=================================================
|
||||||
# If app is public, add url to SSOWat conf as skipped_uris
|
# If app is public, add url to SSOWat conf as skipped_uris
|
||||||
if [[ $is_public -eq 1 ]]; then
|
if [[ $is_public -eq 1 ]]; then
|
||||||
# See install script
|
# See install script
|
||||||
ynh_app_setting_set "$app" unprotected_uris "/"
|
ynh_app_setting_set "$app" unprotected_uris "/"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Reload nginx service
|
#=================================================
|
||||||
sudo systemctl reload nginx
|
# RELOAD NGINX
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
systemctl reload nginx
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue