attempt loki dashboard

This commit is contained in:
Seth Call 2025-12-07 13:50:51 -06:00
parent 48b900d4c7
commit 8c30544be7
5 changed files with 264 additions and 0 deletions

6
k8s/loki/Chart.lock Normal file
View File

@ -0,0 +1,6 @@
dependencies:
- name: loki
repository: https://grafana.github.io/helm-charts
version: 5.42.0
digest: sha256:34be6df7db0ab68667bf53c60f1a4788e02f2865d979fba2bca35ff362dc7d1b
generated: "2025-12-06T18:43:16.062019-06:00"

View File

@ -0,0 +1,183 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: loki-verification-dashboard
labels:
grafana_dashboard: "1"
data:
loki-verification.json: |
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"target": {
"limit": 100,
"matchAny": false,
"tags": [],
"type": "dashboard"
},
"type": "dashboard"
}
]
},
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"id": null,
"links": [],
"liveNow": false,
"panels": [
{
"datasource": {
"type": "loki",
"uid": "loki"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 24,
"x": 0,
"y": 0
},
"id": 2,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "loki",
"uid": "loki"
},
"editorMode": "builder",
"expr": "sum(count_over_time({job=~\".+\"}[1m]))",
"legendFormat": "",
"queryType": "range",
"refId": "A"
}
],
"title": "Log Volume",
"type": "timeseries"
},
{
"datasource": {
"type": "loki",
"uid": "loki"
},
"gridPos": {
"h": 16,
"w": 24,
"x": 0,
"y": 8
},
"id": 1,
"options": {
"dedupStrategy": "none",
"enableLogDetails": true,
"prettifyLogMessage": false,
"showCommonLabels": false,
"showLabels": false,
"showTime": true,
"sortOrder": "Descending",
"wrapLogMessage": false
},
"targets": [
{
"datasource": {
"type": "loki",
"uid": "loki"
},
"editorMode": "builder",
"expr": "{job=~\".+\"}",
"queryType": "range",
"refId": "A"
}
],
"title": "Logs",
"type": "logs"
}
],
"refresh": "",
"schemaVersion": 38,
"style": "dark",
"tags": [],
"templating": {
"list": []
},
"time": {
"from": "now-1h",
"to": "now"
},
"timepicker": {},
"timezone": "",
"title": "Loki Verification",
"uid": "loki-verification",
"version": 0,
"weekStart": ""
}

View File

@ -0,0 +1 @@
templates/alerts.yaml

72
scripts/deploy.sh Executable file
View File

@ -0,0 +1,72 @@
#!/bin/bash
set -e
ENVIRONMENT=$1
if [ -z "$ENVIRONMENT" ]; then
echo "Usage: $0 <staging|production>"
exit 1
fi
if [ "$ENVIRONMENT" == "staging" ]; then
echo "Deploying to STAGING..."
# Source activation script
if [ -f ~/bin/activate_stg ]; then
source ~/bin/activate_stg
else
echo "Error: ~/bin/activate_stg not found."
exit 1
fi
# Set BITBUCKET_BRANCH
export BITBUCKET_BRANCH=$(git rev-parse --abbrev-ref HEAD)
if [ -z "$BITBUCKET_BRANCH" ]; then
export BITBUCKET_BRANCH="develop"
fi
echo "Using branch: $BITBUCKET_BRANCH"
# Template argocd/base/applications.yaml
echo "Templating k8s/argocd/base/applications.yaml..."
envsubst < k8s/argocd/base/applications.yaml > k8s/argocd/base/applications.yaml.tmp
mv k8s/argocd/base/applications.yaml.tmp k8s/argocd/base/applications.yaml
# Apply Kustomize
echo "Applying Kustomize for staging..."
kubectl -n argocd apply -k k8s/argocd/overlays/staging
# Rollout restarts
echo "Restarting coturn deployments..."
kubectl -n coturn rollout restart deployment/coturn
kubectl -n coturn rollout status -w deployment/coturn
kubectl -n coturn-dns rollout restart deployment/coturn-dns
kubectl -n coturn-dns rollout status -w deployment/coturn-dns
elif [ "$ENVIRONMENT" == "production" ]; then
echo "Deploying to PRODUCTION..."
# Source activation script
if [ -f ~/bin/activate_prd ]; then
source ~/bin/activate_prd
else
echo "Error: ~/bin/activate_prd not found."
exit 1
fi
# Apply Kustomize
echo "Applying Kustomize for production..."
kubectl -n argocd apply -k k8s/argocd/overlays/production
# Rollout restarts
echo "Restarting coturn deployments..."
kubectl -n coturn rollout restart deployment/coturn
kubectl -n coturn rollout status -w deployment/coturn
kubectl -n coturn-dns rollout restart deployment/coturn-dns
kubectl -n coturn-dns rollout status -w deployment/coturn-dns
else
echo "Invalid environment: $ENVIRONMENT. Must be 'staging' or 'production'."
exit 1
fi
echo "Deployment complete!"

View File

@ -0,0 +1,2 @@
# run in k8s/monitoring folder
helm upgrade monitoring . --namespace monitoring -f values-staging.yaml