Skip to content

Commit

Permalink
Added formula initialization information
Browse files Browse the repository at this point in the history
  • Loading branch information
jpeedroza committed Oct 11, 2021
1 parent 1fe42d7 commit 78948e3
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
10 changes: 8 additions & 2 deletions vkpr/loki/install/src/unix/formula/formula.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,20 @@ runFormula() {

checkGlobalConfig $DOMAIN "localhost" "domain" "DOMAIN"

startInfos
addRepLoki
installLoki
existGrafana
}

startInfos() {
echo "=============================="
echoColor "bold" "$(echoColor "green" "VKPR Loki Install Routine")"
echo "=============================="
}

addRepLoki(){
echoColor "green" "Installing Loki..."
registerHelmRepository grafana https://grafana.github.io/helm-charts
registerHelmRepository grafana https://grafana.github.io/helm-charts
}

installLoki(){
Expand Down
22 changes: 18 additions & 4 deletions vkpr/prometheus-stack/install/src/unix/formula/formula.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,25 @@ runFormula() {

local VKPR_ENV_GRAFANA_DOMAIN="grafana.${VKPR_ENV_DOMAIN}"
local VKPR_ENV_ALERT_MANAGER_DOMAIN="alertmanager.${VKPR_ENV_DOMAIN}"


startInfos
addRepoPrometheusStack
installPrometheusStack
}

startInfos() {
echo "=============================="
echoColor "bold" "$(echoColor "green" "VKPR Prometheus-Stack Install Routine")"
echoColor "bold" "$(echoColor "blue" "Prometheus AlertManager enabled:") ${VKPR_ENV_PROMETHEUS_ALERT_MANAGER}"
echoColor "bold" "$(echoColor "blue" "Ingress Controller:") ${VKPR_ENV_PROMETHEUS_INGRESS}"
echoColor "bold" "$(echoColor "blue" "Grafana domain:") ${VKPR_ENV_GRAFANA_DOMAIN}"
echoColor "bold" "$(echoColor "blue" "Grafana password:") ${GRAFANA_PASSWORD}"
if [[ $VKPR_ENV_PROMETHEUS_ALERT_MANAGER == true ]]; then
echoColor "bold" "$(echoColor "blue" "Prometheus AlertManager domain:") ${VKPR_ENV_ALERT_MANAGER_DOMAIN}"
fi
echo "=============================="
}

addRepoPrometheusStack() {
registerHelmRepository prometheus-community https://prometheus-community.github.io/helm-charts
}
Expand Down Expand Up @@ -44,7 +58,7 @@ settingStack() {
.grafana.ingress.ingressClassName = "traefik"
'
fi
if [[ $(checkExistingLoki) = "true" ]]; then
if [[ $(checkPodName "loki-stack") = "true" ]]; then
YQ_VALUES=''$YQ_VALUES' |
.grafana.additionalDataSources[0].name = "Loki" |
.grafana.additionalDataSources[0].type = "loki" |
Expand All @@ -54,10 +68,10 @@ settingStack() {
.grafana.additionalDataSources[0].editable = true
'
fi
if [[ $(checkExistingKeycloak) = "true" ]]; then
if [[ $(checkPodName "keycloak") = "true" ]]; then
# addapt to use https (only find http)
local K3D_PORTS=":$($VKPR_K3D cluster ls vkpr-local -o yaml | $VKPR_YQ eval '.[].cluster.nodes[0].portMappings.80/tcp[0].hostport' -)"
local KEYCLOAK_DOMAIN="vkpr-keycloak.$($VKPR_YQ eval .global.domain $VKPR_GLOBAL)${K3D_PORTS}/auth/realms/grafana/protocol/openid-connect"
local KEYCLOAK_DOMAIN="keycloak.$($VKPR_YQ eval .global.domain $VKPR_GLOBAL)${K3D_PORTS}/auth/realms/grafana/protocol/openid-connect"
local ROLES="contains(roles[], 'admin') && 'Admin' || contains(roles[], 'editor') && 'Editor' || 'Viewer'"
YQ_VALUES=''$YQ_VALUES' |
.grafana.env.GF_SERVER_ROOT_URL = "http://'${VKPR_ENV_GRAFANA_DOMAIN}${K3D_PORTS}'/" |
Expand Down

0 comments on commit 78948e3

Please sign in to comment.