1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/grafana_ynh.git synced 2024-09-03 20:36:29 +02:00
This commit is contained in:
Éric Gaspar 2023-10-24 23:40:11 +02:00
parent e7691ecef0
commit ce15c659b3
2 changed files with 1619 additions and 30 deletions

1582
conf/graphana.ini Normal file

File diff suppressed because it is too large Load diff

View file

@ -61,38 +61,45 @@ sed -i '/^\[\[opentsdb\]\]$/,/^\[/ s/^.* enabled = false/enabled = true/' /etc/i
ynh_systemd_action --service_name=influxdb --action="restart" ynh_systemd_action --service_name=influxdb --action="restart"
# Configure Grafana # Configure Grafana
cp ../conf/ldap.toml /etc/grafana #cp ../conf/ldap.toml /etc/grafana
grafana_conf="/etc/grafana/grafana.ini" ynh_add_config --template="ldap.toml" --destination="/etc/grafana/ldap.toml"
# Set final port
sed -i "/^\[server\]$/,/^\[/ s@;http_port = .*@http_port = $port@" $grafana_conf
# Set domain
sed -i "/^\[server\]$/,/^\[/ s@;domain = .*@domain = $domain@" $grafana_conf
# Set final URL
sed -i "/^\[server\]$/,/^\[/ s@;root_url = .*@root_url = https://$domain$path@" $grafana_conf
# Disable check for updates
sed -i '/^\[analytics\]$/,/^\[/ s/;check_for_updates = .*/check_for_updates = false/' $grafana_conf
# Disable analytics reporting
sed -i '/^\[analytics\]$/,/^\[/ s/;reporting_enabled = .*/reporting_enabled = false/' $grafana_conf
# Disable organization creation
sed -i '/^\[users\]$/,/^\[/ s/;allow_org_create = .*/allow_org_create = false/' $grafana_conf
# Enable HTTP and LDAP authentication
sed -i '/^\[auth.basic\]$/,/^\[/ s/;enabled = .*/enabled = false/' $grafana_conf
sed -i '/^\[auth.proxy\]$/,/^\[/ s/;enabled = .*/enabled = true/' $grafana_conf
sed -i '/^\[auth.ldap\]$/,/^\[/ {
s/;enabled = .*/enabled = true/
s/;allow_sign_up = .*/allow_sign_up = true/
}' $grafana_conf
# Set log level to debug
sed -i '/^\[log\]$/,/^\[/ s/;level = .*/level = debug/' $grafana_conf
# Change URL and database credentials #grafana_conf="/etc/grafana/grafana.ini"
sed -i "/^\[database\]$/,/^\[/ { ## Set final port
s/;type = .*/type = mysql/ # sed -i "/^\[server\]$/,/^\[/ s@;http_port = .*@http_port = $port@" $grafana_conf
s/;name = .*/name = $db_name/ # # Set domain
s/;user = .*/user = $db_user/ # sed -i "/^\[server\]$/,/^\[/ s@;domain = .*@domain = $domain@" $grafana_conf
s/;\?password =.*/password = $db_pwd/ # # Set final URL
}" $grafana_conf # sed -i "/^\[server\]$/,/^\[/ s@;root_url = .*@root_url = https://$domain$path@" $grafana_conf
# # Disable check for updates
# sed -i '/^\[analytics\]$/,/^\[/ s/;check_for_updates = .*/check_for_updates = false/' $grafana_conf
# # Disable analytics reporting
# sed -i '/^\[analytics\]$/,/^\[/ s/;reporting_enabled = .*/reporting_enabled = false/' $grafana_conf
# # Disable organization creation
# sed -i '/^\[users\]$/,/^\[/ s/;allow_org_create = .*/allow_org_create = false/' $grafana_conf
# # Enable HTTP and LDAP authentication
# sed -i '/^\[auth.basic\]$/,/^\[/ s/;enabled = .*/enabled = false/' $grafana_conf
# sed -i '/^\[auth.proxy\]$/,/^\[/ s/;enabled = .*/enabled = true/' $grafana_conf
# sed -i '/^\[auth.ldap\]$/,/^\[/ {
# s/;enabled = .*/enabled = true/
# s/;allow_sign_up = .*/allow_sign_up = true/
# }' $grafana_conf
# # Set log level to debug
# sed -i '/^\[log\]$/,/^\[/ s/;level = .*/level = debug/' $grafana_conf
# # Change URL and database credentials
# sed -i "/^\[database\]$/,/^\[/ {
# s/;type = .*/type = mysql/
# s/;name = .*/name = $db_name/
# s/;user = .*/user = $db_user/
# s/;\?password =.*/password = $db_pwd/
# }" $grafana_conf
ynh_add_config --template="grafana.ini" --destination="/etc/grafana/grafana.ini"
chmod 650 "/etc/grafana/grafana.ini"
chown $app:$app "/etc/grafana/grafana.ini"
# Calculate and store the config file checksum into the app settings # Calculate and store the config file checksum into the app settings
ynh_store_file_checksum --file="$grafana_conf" ynh_store_file_checksum --file="$grafana_conf"