Skip to content

Commit

Permalink
Add Dockerfile and configs
Browse files Browse the repository at this point in the history
  • Loading branch information
adeveloper-wq committed Jan 31, 2024
1 parent 727fd6d commit 26b597f
Show file tree
Hide file tree
Showing 14 changed files with 20,974 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
GF_SECURITY_ADMIN_USER=admin-priobike
GF_SECURITY_ADMIN_PASSWORD=grafana@priobike-2022
GF_USERS_ALLOW_SIGN_UP=false
GF_SERVER_ROOT_URL=%(protocol)s://%(domain)s:%(http_port)s/staging/grafana/
GF_SERVER_SERVE_FROM_SUB_PATH=true
GF_INSTALL_PLUGINS=grafana-clock-panel,grafana-simple-json-datasource
GF_PLUGINS_ENABLE_ALPHA=true
GF_PANELS_ENABLE_ALPHA=true
52 changes: 52 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Build

on:
push:
branches:
- main
- stable
- release
tags:
- v*

env:
REGISTRY: bikenow.vkw.tu-dresden.de
IMAGE_NAME: ${{ github.repository }}

jobs:
publish-grafana:
runs-on: self-hosted
container: docker:latest

permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Log in to the container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.NEXUS_DOCKER_PUB_USERNAME }}
password: ${{ secrets.NEXUS_DOCKER_PUB_PASSWORD }}

- name: Extract metadata (tags, labels) for Docker
id: meta
# See: https://github.com/docker/metadata-action
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
NEXUS_READ_USERNAME=${{ secrets.NEXUS_READ_USERNAME }}
NEXUS_READ_PASSWORD=${{ secrets.NEXUS_READ_PASSWORD }}
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM grafana/grafana:9.5.3

COPY provisioning /etc/grafana/provisioning

COPY data /var/lib/grafana

4 changes: 4 additions & 0 deletions data/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
grafana.db
png/
plugins/
csv/
49 changes: 49 additions & 0 deletions data/alerting/1/__default__.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@

{{ define "__subject" }}[{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ end }}] {{ .GroupLabels.SortedPairs.Values | join " " }} {{ if gt (len .CommonLabels) (len .GroupLabels) }}({{ with .CommonLabels.Remove .GroupLabels.Names }}{{ .Values | join " " }}{{ end }}){{ end }}{{ end }}

{{ define "__text_alert_list" }}{{ range . }}
Value: {{ or .ValueString "[no value]" }}
Labels:
{{ range .Labels.SortedPairs }} - {{ .Name }} = {{ .Value }}
{{ end }}Annotations:
{{ range .Annotations.SortedPairs }} - {{ .Name }} = {{ .Value }}
{{ end }}{{ if gt (len .GeneratorURL) 0 }}Source: {{ .GeneratorURL }}
{{ end }}{{ if gt (len .SilenceURL) 0 }}Silence: {{ .SilenceURL }}
{{ end }}{{ if gt (len .DashboardURL) 0 }}Dashboard: {{ .DashboardURL }}
{{ end }}{{ if gt (len .PanelURL) 0 }}Panel: {{ .PanelURL }}
{{ end }}{{ end }}{{ end }}

{{ define "default.title" }}{{ template "__subject" . }}{{ end }}

{{ define "default.message" }}{{ if gt (len .Alerts.Firing) 0 }}**Firing**
{{ template "__text_alert_list" .Alerts.Firing }}{{ if gt (len .Alerts.Resolved) 0 }}

{{ end }}{{ end }}{{ if gt (len .Alerts.Resolved) 0 }}**Resolved**
{{ template "__text_alert_list" .Alerts.Resolved }}{{ end }}{{ end }}


{{ define "__teams_text_alert_list" }}{{ range . }}
Value: {{ or .ValueString "[no value]" }}
Labels:
{{ range .Labels.SortedPairs }} - {{ .Name }} = {{ .Value }}
{{ end }}
Annotations:
{{ range .Annotations.SortedPairs }} - {{ .Name }} = {{ .Value }}
{{ end }}
{{ if gt (len .GeneratorURL) 0 }}Source: {{ .GeneratorURL }}

{{ end }}{{ if gt (len .SilenceURL) 0 }}Silence: {{ .SilenceURL }}

{{ end }}{{ if gt (len .DashboardURL) 0 }}Dashboard: {{ .DashboardURL }}

{{ end }}{{ if gt (len .PanelURL) 0 }}Panel: {{ .PanelURL }}

{{ end }}
{{ end }}{{ end }}


{{ define "teams.default.message" }}{{ if gt (len .Alerts.Firing) 0 }}**Firing**
{{ template "__teams_text_alert_list" .Alerts.Firing }}{{ if gt (len .Alerts.Resolved) 0 }}

{{ end }}{{ end }}{{ if gt (len .Alerts.Resolved) 0 }}**Resolved**
{{ template "__teams_text_alert_list" .Alerts.Resolved }}{{ end }}{{ end }}
12 changes: 12 additions & 0 deletions provisioning/dashboards/dashboards.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: 1

providers:
- name: 'Prometheus'
orgId: 1
folder: ''
type: file
disableDeletion: false
editable: true
allowUiUpdates: true
options:
path: /etc/grafana/provisioning/dashboards
Loading

0 comments on commit 26b597f

Please sign in to comment.