This commit is contained in:
2023-09-26 18:14:36 -06:00
commit fb5a0fc542
443 changed files with 21892 additions and 0 deletions

110
Grafana/.drone.yml Normal file
View File

@@ -0,0 +1,110 @@
---
kind: pipeline
type: docker
name: deploy
environment:
PACKAGE: Grafana
URL: grafana.alexlebens.net
steps:
- name: Tests
image: ps03fd.alexlebens.net:5000/droneimage:latest
commands:
- /scripts/tests.sh
- name: Nofification > Discord | Tests - Failure
image: appleboy/drone-discord
settings:
webhook_id:
from_secret: discord_webhook_id
webhook_token:
from_secret: discord_webhook_token
username: DroneCI - ps03fd
message: Docker compose validation for Grafana failed.
when:
status:
- failure
- name: Configuration
image: ps03fd.alexlebens.net:5000/droneimage:latest
commands:
- mkdir ~/.ssh/
- echo "$SSH_KEY" > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- ssh-keyscan -H $HOST_IP >> ~/.ssh/known_hosts
- /scripts/configuration.sh
environment:
SSH_KEY:
from_secret: ssh_key_ps03fd_drone
DOCKER_HOST:
from_secret: docker_host_ps03fd
HOST_IP:
from_secret: host_ip_ps03fd
UPTIMEKUMA_NAME:
from_secret: uptimekuma_name
UPTIMEKUMA_PASSWORD:
from_secret: uptimekuma_password
UPTIMEKUMA_URL:
from_secret: uptimekuma_url
when:
branch:
- main
- name: Nofification > Discord | Configuration - Failure
image: appleboy/drone-discord
settings:
webhook_id:
from_secret: discord_webhook_id
webhook_token:
from_secret: discord_webhook_token
username: DroneCI - ps03fd
message: Configuration for Grafana failed.
when:
status:
- failure
- name: Deploy
image: ps03fd.alexlebens.net:5000/droneimage:latest
commands:
- mkdir ~/.ssh/
- echo "$SSH_KEY" > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- ssh-keyscan -H $HOST_IP >> ~/.ssh/known_hosts
- /scripts/deploy.sh
environment:
SSH_KEY:
from_secret: ssh_key_ps03fd_drone
DOCKER_HOST:
from_secret: docker_host_ps03fd
HOST_IP:
from_secret: host_ip_ps03fd
when:
branch:
- main
- name: Nofification > Discord | Deploy - Success
image: appleboy/drone-discord
settings:
webhook_id:
from_secret: discord_webhook_id
webhook_token:
from_secret: discord_webhook_token
username: DroneCI - ps03fd
message: Docker compose deployment for Grafana succeeded
when:
status:
- sucess
- name: Nofification > Discord | Deploy - Failure
image: appleboy/drone-discord
settings:
webhook_id:
from_secret: discord_webhook_id
webhook_token:
from_secret: discord_webhook_token
username: DroneCI - ps03fd
message: Docker compose deployment for Grafana failed.
when:
status:
- failure

31
Grafana/.env Normal file
View File

@@ -0,0 +1,31 @@
PATH='/usr/share/grafana/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
GF_PATHS_DATA='/var/lib/grafana'
GF_PATHS_LOGS='/var/log/grafana'
GF_PATHS_PLUGINS='/var/lib/grafana/plugins'
GF_PATHS_PROVISIONING='/etc/grafana/provisioning'
GF_SERVER_ROOT_URL='alexlebens.net'
GF_SERVER_ROOT_URL='https://grafana.alexlebens.net'
GF_USERS_AUTO_ASSIGN_ORG='true'
GF_USERS_AUTO_ASSIGN_ORG_ID='1'
GF_AUTH_LOGIN_COOKIE_NAME='grafana_session'
GF_AUTH_DISABLE_LOGIN_FORM='true'
GF_AUTH_OAUTH_AUTO_LOGIN='false'
GF_AUTH_OAUTH_ALLOW_INSECURE_EMAIL_LOOKUP='true'
GF_AUTH_GENERIC_OAUTH_ENABLED='true'
GF_AUTH_GENERIC_OAUTH_NAME='Authentik'
GF_AUTH_GENERIC_OAUTH_CLIENT_ID='7811f038dc09d084b36c253d92d4164d1b9a2096'
GF_AUTH_GENERIC_OAUTH_CLIENT_SECRET='dbcef3c8baaf0fb038e2780ccbb2fc606d9a4f3ac5d55877b6d22d608ec995d300d5c269c51398063babdf226437caf87e345da87bc22f7cbc3d1d5c4f573b67'
GF_AUTH_GENERIC_OAUTH_SCOPES='openid email profile'
GF_AUTH_GENERIC_OAUTH_AUTH_URL='https://authentik.alexlebens.net/application/o/authorize/'
GF_AUTH_GENERIC_OAUTH_TOKEN_URL='https://authentik.alexlebens.net/application/o/token/'
GF_AUTH_GENERIC_OAUTH_API_URL='https://authentik.alexlebens.net/application/o/userinfo/'
GF_AUTH_SIGNOUT_REDIRECT_URL='https://authentik.alexlebens.net/application/o/grafana/end-session/'
GF_AUTH_GENERIC_OAUTH_ROLE_ATTRIBUTE_PATH="contains(realm_access.roles[*], 'Grafana Admins') && 'Admin' || contains(realm_access.roles[*], 'Grafana Editors') && 'Editor' || 'Viewer'"
GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS='grafana-clock-panel,grafana-worldmap-panel,grafana-simple-json-datasource,grafana-piechart-panel'

3
Grafana/README.md Normal file
View File

@@ -0,0 +1,3 @@
# Grafana
[![Build Status](https://drone.alexlebens.net/api/badges/alexlebens/Grafana/status.svg)](https://drone.alexlebens.net/alexlebens/Grafana)

View File

@@ -0,0 +1,17 @@
{
"type": "docker",
"name": "Grafana - Docker",
"interval": 60,
"retryInterval": 20,
"maxretries": 1,
"notificationIDList": [
3,
4
],
"url": "https://grafana.alexlebens.net",
"accepted_statuscodes": [
"200-299"
],
"docker_container": "grafana",
"docker_host": 1
}

View File

@@ -0,0 +1,15 @@
{
"type": "http",
"name": "Grafana - Web",
"interval": 60,
"retryInterval": 20,
"maxretries": 1,
"notificationIDList": [
3,
4
],
"url": "https://grafana.alexlebens.net/login",
"accepted_statuscodes": [
"200-299"
]
}

View File

@@ -0,0 +1,36 @@
services:
grafana:
container_name: grafana
env_file:
- .env
image: grafana/grafana-oss:latest
labels:
traefik.docker.network: traefik
traefik.enable: true
traefik.http.routers.grafana.entrypoints: websecure
traefik.http.routers.grafana.rule: Host(`grafana.alexlebens.net`)
traefik.http.routers.grafana.service: grafana
traefik.http.services.grafana.loadbalancer.server.port: 3000
logging:
driver: json-file
options:
max-size: 50m
max-file: "3"
networks:
traefik: null
restart: always
volumes:
- lib:/var/lib/grafana
networks:
traefik:
name: traefik
external: true
volumes:
lib:
driver: local
driver_opts:
type: none
o: bind
device: /var/lib/docker/volumes/partition/grafana_lib