Page MenuHomeDevCentral

D3377.diff
No OneTemporary

D3377.diff

diff --git a/pillar/paas/alkane/windriver/main.sls b/pillar/paas/alkane/windriver/main.sls
--- a/pillar/paas/alkane/windriver/main.sls
+++ b/pillar/paas/alkane/windriver/main.sls
@@ -117,6 +117,7 @@
nasqueron.org:
- api51
+ - grafana
- tools51
- www51
diff --git a/roles/grafana/grafana/files/grafana.ini b/roles/grafana/grafana/files/grafana.ini
new file mode 100644
--- /dev/null
+++ b/roles/grafana/grafana/files/grafana.ini
@@ -0,0 +1,26 @@
+# -------------------------------------------------------------
+# Grafana configuration
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# License: Trivial work, not eligible to copyright
+# Source file: roles/grafana/grafana/files/grafana.ini
+# -------------------------------------------------------------
+#
+# <auto-generated>
+# This file is managed by our rOPS SaltStack repository.
+#
+# Changes to this file may cause incorrect behavior
+# and will be lost if the state is redeployed.
+# </auto-generated>
+
+[paths]
+data = /var/db/grafana
+logs = /var/log/grafana
+plugins = /var/db/grafana/plugins
+provisioning = /usr/local/etc/grafana/provisioning
+
+[server]
+protocol = socket
+socket_gid = {{ socket.gid }}
+socket = {{ socket.dir }}/grafana.sock
+domain = {{ domain }}
diff --git a/roles/grafana/grafana/files/rc/grafana.conf b/roles/grafana/grafana/files/rc/grafana.conf
new file mode 100644
--- /dev/null
+++ b/roles/grafana/grafana/files/rc/grafana.conf
@@ -0,0 +1,16 @@
+# -------------------------------------------------------------
+# grafana — rc configuration
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# License: Trivial work, not eligible to copyright
+# Source file: roles/grafana/grafana/files/rc/grafana.conf
+# -------------------------------------------------------------
+#
+# <auto-generated>
+# This file is managed by our rOPS SaltStack repository.
+#
+# Changes to this file may cause incorrect behavior
+# and will be lost if the state is redeployed.
+# </auto-generated>
+
+grafana_enable="YES"
diff --git a/roles/grafana/grafana/init.sls b/roles/grafana/grafana/init.sls
new file mode 100644
--- /dev/null
+++ b/roles/grafana/grafana/init.sls
@@ -0,0 +1,77 @@
+# -------------------------------------------------------------
+# Salt — Provision Grafana
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# License: Trivial work, not eligible to copyright
+# -------------------------------------------------------------
+
+{% from "map.jinja" import dirs with context %}
+
+# -------------------------------------------------------------
+# Software
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+grafana:
+ pkg.installed
+
+# -------------------------------------------------------------
+# Config
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+{{ dirs.etc }}/grafana/grafana.ini:
+ file.managed:
+ - source: salt://roles/grafana/grafana/files/grafana.ini
+ - template: jinja
+ - context:
+ domain: grafana.nasqueron.org
+ socket:
+ dir: /var/run/web/grafana
+ gid: 9003 # web
+
+# -------------------------------------------------------------
+# Socket
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+/var/run/web/grafana:
+ file.directory:
+ - user: grafana
+ - group: web
+
+ensure_grafana_user_is_in_group_web:
+ user.present:
+ - name: grafana
+ - groups:
+ - web
+ - remove_groups: False
+ - createhome: False
+
+# -------------------------------------------------------------
+# Plugins access by nginx
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+/var/db/grafana:
+ file.directory:
+ - mode: 0751
+
+/var/db/grafana/plugins:
+ file.directory:
+ - user: grafana
+ - group: web
+ - mode: 0750
+
+# -------------------------------------------------------------
+# Service
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+{% if grains['os'] == 'FreeBSD' %}
+
+/etc/rc.conf.d/grafana:
+ file.managed:
+ - source: salt://roles/grafana/grafana/files/rc/grafana.conf
+ - template: jinja
+
+{% endif %}
+
+grafana_running:
+ service.running:
+ - name: grafana
diff --git a/roles/grafana/init.sls b/roles/grafana/init.sls
new file mode 100644
--- /dev/null
+++ b/roles/grafana/init.sls
@@ -0,0 +1,9 @@
+# -------------------------------------------------------------
+# Salt — Provision Grafana
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# License: Trivial work, not eligible to copyright
+# -------------------------------------------------------------
+
+include:
+ - .grafana
diff --git a/roles/webserver-alkane/nginx/files/vhosts/nasqueron.org/grafana.conf b/roles/webserver-alkane/nginx/files/vhosts/nasqueron.org/grafana.conf
new file mode 100644
--- /dev/null
+++ b/roles/webserver-alkane/nginx/files/vhosts/nasqueron.org/grafana.conf
@@ -0,0 +1,69 @@
+# -------------------------------------------------------------
+# Webserver
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# Site: grafana.nasqueron.org
+# License: Trivial work, not eligible to copyright
+# Source file: roles/webserver-alkane/nginx/files/vhosts/nasqueron.org/grafana.conf
+# -------------------------------------------------------------
+#
+# <auto-generated>
+# This file is managed by our rOPS SaltStack repository.
+#
+# Changes to this file may cause incorrect behavior
+# and will be lost if the state is redeployed.
+# </auto-generated>
+
+# -------------------------------------------------------------
+# Back-end
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+upstream grafana {
+ server unix:/var/run/web/grafana/grafana.sock;
+}
+
+# -------------------------------------------------------------
+# grafana.nasqueron.org configuration
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+server {
+ listen 80;
+ listen [::]:80;
+ server_name grafana.nasqueron.org;
+
+ return 301 https://grafana.nasqueron.org$request_uri;
+}
+
+server {
+ server_name grafana.nasqueron.org;
+
+ include includes/tls;
+ ssl_certificate /usr/local/etc/letsencrypt/live/grafana.nasqueron.org/fullchain.pem;
+ ssl_certificate_key /usr/local/etc/letsencrypt/live/grafana.nasqueron.org/privkey.pem;
+
+ error_log /var/log/www/nasqueron.org/grafana-error.log;
+ access_log /var/log/www/nasqueron.org/grafana-access.log;
+
+ include includes/letsencrypt;
+
+ location /public {
+ alias /usr/local/share/grafana/public;
+ }
+
+ location /public/plugins {
+ alias /var/db/grafana/plugins;
+ }
+
+ location / {
+ proxy_pass http://grafana;
+ include includes/proxy;
+ }
+
+ location /api/live/ {
+ proxy_http_version 1.1;
+ proxy_set_header Upgrade $http_upgrade;
+ proxy_set_header Connection $connection_upgrade;
+ proxy_set_header Host $host;
+ proxy_pass http://grafana;
+ }
+}
diff --git a/top.sls b/top.sls
--- a/top.sls
+++ b/top.sls
@@ -25,6 +25,7 @@
- roles/dbserver-mysql
- roles/dbserver-pgsql
- roles/devserver
+ - roles/grafana
- roles/redis
- roles/saas-nextcloud
- roles/webserver-alkane

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 23, 14:19 (18 h, 59 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2258207
Default Alt Text
D3377.diff (7 KB)

Event Timeline