Merge pull request 'Configuration de Grafana' (#14) from grafana into main

Reviewed-on: https://git.weko.io/resilien/services/pulls/14
This commit is contained in:
Simon 2021-11-28 15:49:26 +01:00
commit c6821a547f
7 changed files with 109 additions and 12 deletions

View File

@ -1,3 +1,44 @@
########
# DOCKER
#DOCKER_CONTEXT=
#DOCKER_HOST=
SERVICES_DIR=..
COMPOSE_FILE=${SERVICES_DIR}/grafana/docker-compose.yml:${SERVICES_DIR}/grafana/docker-compose.traefik.yml
#COMPOSE_PROJECT_NAME=
#########
# GRAFANA
GRAFANA_DOMAIN=grafana.cool.life
#GRAFANA_VOLUME_NAME=
#GRAFANA_CONTAINER_NAME=
#GRAFANA_IMAGE=
GF_SECURITY_ADMIN_USER=admin
GF_SECURITY_ADMIN_PASSWORD=admin
GF_SECURITY_ADMIN_PASSWORD=password
#GF_SECURITY_DISABLE_GRAVATAR=
#GF_SECURITY_COOKIE_SECURE=
#GF_USERS_ALLOW_SIGN_UP=
GF_INSTALL_PLUGINS=grafana-piechart-panel
######
# SMTP
#GF_SMTP_HOST=
#GF_SMTP_USER=
#GF_SMTP_PASSWORD=
#GF_SMTP_FROM_ADDRESS=
#GF_SMTP_FROM_NAME=
#######
# REDIS
#GF_REMOTE_CACHE_CONNSTR=
#########
# TRAEFIK
#TRAEFIK_NETWORK_NAME=
#TRAEFIK_ROUTER_NAME= # Don't use char '.'
#TRAEFIK_ENTRYPOINTS=

19
grafana/README.md Normal file
View File

@ -0,0 +1,19 @@
# Grafana
> Grafana est un logiciel libre sous licence GNU Affero General Public License Version 32 (anciennement sous licence Apache 2.0 avant avril 2021) qui permet la visualisation de données. Il permet de réaliser des tableaux de bord et des graphiques depuis plusieurs sources dont des bases de données temporelles comme Graphite (en), InfluxDB et OpenTSDB3.
>
> -- <cite>[Wikipédia](https://fr.wikipedia.org/wiki/Grafana)</cite>
## 🔧 Configuration
La configuration du service ce base sur la documentation officiel plusieurs pages sont intéressante à lire :
- [Lancer l'image Docker de Grafana](https://grafana.com/docs/grafana/latest/installation/docker/)
- [Configuration l'image Docker Grafana](https://grafana.com/docs/grafana/latest/administration/configure-docker/)
- [Surcharger la configuration à l'aide des variables d'environment](https://grafana.com/docs/grafana/latest/administration/configuration/#override-configuration-with-environment-variables)
## 🔗 Liens
- [Site officiel](https://grafana.com)
- [La documentation](https://grafana.com/docs)
- [Github](https://github.com/grafana/grafana)
- [L'image Docker sur Docker Hub](https://hub.docker.com/r/grafana/grafana)

View File

@ -0,0 +1,11 @@
version: "3.8"
services:
grafana:
environment:
# https://grafana.com/docs/grafana/latest/administration/configuration/#database
GF_DATABASE_TYPE: postgres
GF_DATABASE_HOST: postgres # Name is same as ../postgres/docker-compose.yml:8
GF_DATABASE_NAME: ${POSTGRES_DB:?err}
GF_DATABASE_USER: ${POSTGRES_USER:?err}
GF_DATABASE_PASSWORD: ${POSTGRES_PASSWORD:?err}

View File

@ -0,0 +1,8 @@
version: "3.8"
services:
grafana:
environment:
# https://grafana.com/docs/grafana/latest/administration/configuration/#remote_cache
GF_REMOTE_CACHE_TYPE: redis
GF_REMOTE_CACHE_CONNSTR: ${GF_REMOTE_CACHE_CONNSTR:-addr=redis:6379,ssl=false}

View File

@ -0,0 +1,12 @@
version: "3.8"
services:
grafana:
environment:
# https://grafana.com/docs/grafana/latest/administration/configuration/#smtp
GF_SMTP_ENABLED: true
GF_SMTP_HOST: ${GF_SMTP_HOST:?err} # with port
GF_SMTP_USER: ${GF_SMTP_USER:?err}
GF_SMTP_PASSWORD: ${GF_SMTP_PASSWORD:?err}
GF_SMTP_FROM_ADDRESS: ${GF_SMTP_FROM_ADDRESS:?err}
GF_SMTP_FROM_NAME: ${GF_SMTP_FROM_NAME:?err}

View File

@ -0,0 +1,13 @@
version: "3.8"
networks:
default:
name: ${TRAEFIK_NETWORK_NAME:-traefik}
services:
grafana:
labels:
- traefik.enable=true
- traefik.docker.network=${TRAEFIK_NETWORK_NAME:-traefik}
- traefik.http.routers.${TRAEFIK_ROUTER_NAME:-grafana}.rule=Host(`${GRAFANA_DOMAIN:?err}`)
- traefik.http.routers.${TRAEFIK_ROUTER_NAME:-grafana}.entrypoints=${TRAEFIK_ENTRYPOINTS:-web}

View File

@ -1,9 +1,5 @@
---
version: "3"
networks:
default:
name: ${TRAEFIK_NETWORK_NAME:-traefik}
version: "3.8"
volumes:
grafana:
@ -12,17 +8,14 @@ volumes:
services:
grafana:
container_name: ${GRAFANA_CONTAINER_NAME:-grafana}
image: ${GRAFANA_IMAGE:-grafana/grafana:8.2.2}
image: ${GRAFANA_IMAGE:-grafana/grafana:8.2.5}
restart: always
volumes:
- grafana:/var/lib/grafana
environment:
GF_SECURITY_ADMIN_USER: ${GF_SECURITY_ADMIN_USER:?err}
GF_SECURITY_ADMIN_PASSWORD: ${GF_SECURITY_ADMIN_PASSWORD:?err}
GF_SECURITY_DISABLE_GRAVATAR: ${GF_SECURITY_DISABLE_GRAVATAR:-true}
GF_SECURITY_COOKIE_SECURE: ${GF_SECURITY_COOKIE_SECURE:-true}
GF_USERS_ALLOW_SIGN_UP: ${GF_USERS_ALLOW_SIGN_UP:-false}
GF_INSTALL_PLUGINS: ${GF_INSTALL_PLUGINS}
labels:
traefik.enable: 'true'
traefik.docker.network: ${TRAEFIK_NETWORK_NAME:-traefik}
traefik.http.routers.grafana.rule: 'Host(`${GRAFANA_DOMAIN:?err}`)'
traefik.http.routers.grafana.entrypoints: 'web'