Skip to content

Commit

Permalink
Merge pull request #145 from Vinci-C/master
Browse files Browse the repository at this point in the history
ENH:Created a compose file to deploy a grafana container
  • Loading branch information
khalford authored Jun 20, 2024
2 parents fb7897c + 6c94b86 commit 57d906d
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 0 deletions.
34 changes: 34 additions & 0 deletions grafana_monitoring/cloud_datasource.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
apiVersion: 1

datasources:
- name: CloudInfluxDB
type: influxdb
access: proxy
uid: "openstack_grafana"
user: $PROD_INFLUX_USERNAME
url: $PROD_INFLUX_DB_URL
#database: "cloud" # this is a deprecated field but works for v10
jsonData:
dbName : "cloud"
httpMode: POST
timeInterval: "60"
maxSeries: 200
secureJsonData:
password: $PROD_INFLUX_PASSWORD

- name: grafana-power-metrics
type: grafana-opensearch-datasource
access: proxy
uid: "opensearch-grafana"
url: $PROD_OPENSEARCH_URL
basicAuth: true
basicAuthUser: admin
jsonData:
tlsSkipVerify: true
database: "[cloud-ipmi-power-]YYYY.MM.DD"
interval: Daily
timeField: "@timestamp"
version: "2.3.0"
flavor: "opensearch"
secureJsonData:
basicAuthPassword: $PROD_OPENSEARCH_PASSWORD
28 changes: 28 additions & 0 deletions grafana_monitoring/compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
services:
grafana:
image: grafana/grafana-oss
container_name: grafana-instance
environment:
- GF_AUTH_GENERIC_OAUTH_CLIENT_ID=$IRIS_CLIENT_ID
- GF_AUTH_GENERIC_OAUTH_CLIENT_SECRET=$IRIS_CLIENT_SECRET
- GF_AUTH_GENERIC_OAUTH_AUTH_URL=https://iris-iam.stfc.ac.uk/authorize
- GF_AUTH_GENERIC_OAUTH_API_URL=https://iris-iam.stfc.ac.uk/userinfo
- GF_AUTH_GENERIC_OAUTH_ENABLED=TRUE
- GF_AUTH_GENERIC_OAUTH_SCOPES=openid profile email
- GF_AUTH_GENERIC_OAUTH_TOKEN_URL=https://iris-iam.stfc.ac.uk/token
- GF_AUTH_GENERIC_OAUTH_GROUPS_ATTRIBUTE_PATH=groups[*]
- GF_AUTH_GENERIC_OAUTH_ALLOWED_GROUPS=stfc-cloud/admins
- GF_AUTH_GENERIC_OAUTH_DOMAIN=$GRAFANA_DOMAIN_NAME
- GF_AUTH_GENERIC_OAUTH_ROOT_URL=$GRAFANA_ROOT_URL
- GF_AUTH_GENERIC_OAUTH_PROTOCOL=http
- GF_AUTH_GENERIC_OAUTH_HTTP_PORT=3000
- PROD_INFLUX_USERNAME=$PROD_INFLUX_USERNAME
- PROD_INFLUX_PASSWORD=$PROD_INFLUX_PASSWORD
- PROD_OPENSEARCH_PASSWORD=$PROD_OPENSEARCH_PASSWORD
- PROD_INFLUX_DB_URL=$PROD_INFLUX_DB_URL
- PROD_OPENSEARCH_URL=$PROD_OPENSEARCH_URL
- GRAFANA_DOMAIN_NAME=$GRAFANA_DOMAIN_NAME
- GRAFANA_ROOT_URL=$GRAFANA_ROOT_URL
volumes:
- ./cloud_datasource.yaml:/etc/grafana/provisioning/datasources/cloud_datasource.yaml
- ./cloud-grafana-dashboards/:/etc/grafana/provisioning/dashboards
11 changes: 11 additions & 0 deletions grafana_monitoring/env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash
export IRIS_CLIENT_ID=
export IRIS_CLIENT_SECRET=
export PROD_INFLUX_USERNAME=
export PROD_INFLUX_PASSWORD=
export PROD_OPENSEARCH_PASSWORD=
export PROD_INFLUX_DB_URL=
export PROD_OPENSEARCH_URL=
export GRAFANA_DOMAIN_NAME=
export GRAFANA_ROOT_URL=

11 changes: 11 additions & 0 deletions grafana_monitoring/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
All required environment variables can be found in env.sh and should be updated before deploying, environment variables are included in compose.yaml and will be copied to the container

#compose.yaml
Specifies the image, name, and environment variables used when arranging docker

#cloud_datasource.yaml
When grafana see this file it makes connection to the databases specified in this file

#env.sh
Stores environment variables which cannot be published onto github
User should edit and run this script to export the environment variables

0 comments on commit 57d906d

Please sign in to comment.