This commit is contained in:
CaffeineFueled 2024-10-23 09:49:35 +02:00
commit 2b007e3235
Signed by: CaffeineFueled
GPG key ID: 739D3C8D00944004
9 changed files with 1391 additions and 0 deletions

21
LICENSE Normal file
View file

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2024 CF
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

48
README.md Normal file
View file

@ -0,0 +1,48 @@
# Notes
`git clone https://git.ittavern.com/CaffeineFueled/podman-grafana-loki.git`
`cd podman-grafana-loki`
`podman kube play grafana-stack.yaml`
Taking it down
`podman kube down grafana-stack.yaml`
> Note: not ready for production!
# Configuration
## Endpoint
Grafana
`localhost:3000`
Loki
`localhost:3100`
## Auth
Open Grafana, default creds are `admin`/`admin`.
## Data Source
Add Loki as data source `localhost:3100` to display them in grafana
# Changelog
from initial project
- Removed Tempo/Mimir
- Loki Config `loki-local-config.yaml`
- `store: boltdb-shipper` > `store: tsdb`
- `schema: v11` > `schema: v13`
# Links
[Initial Article](https://grafana.com/blog/2022/09/08/how-to-deploy-the-grafana-stack-using-podman/)
[Initial Repo](https://github.com/CastawayEGR/grafana-stack-podman)
# TODO
- [ ] Authentication for Loki

63
grafana-stack.yaml Normal file
View file

@ -0,0 +1,63 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: grafana-stack
labels:
app: grafana-stack
spec:
replicas: 1
selector:
matchLabels:
app: grafana-stack
template:
metadata:
labels:
app: grafana-stack
spec:
containers:
- name: grafana
image: docker.io/grafana/grafana:latest
ports:
- containerPort: 3000
hostPort: 3000
protocol: TCP
volumeMounts:
- mountPath: /etc/grafana/grafana.ini:Z
name: grafana-config
- mountPath: /var/lib/grafana:Z
name: grafana
- name: loki
image: docker.io/grafana/loki:latest
args:
- --config.file=/mnt/config/loki-local-config.yaml
securityContext:
runAsUser: 1000
ports:
- containerPort: 3100
hostPort: 3100
protocol: TCP
- containerPort: 9096
hostPort: 9096
protocol: TCP
volumeMounts:
- mountPath: /tmp/loki:Z
name: loki
- mountPath: /mnt/config/loki-local-config.yaml:Z
name: loki-config
volumes:
- hostPath:
path: ./grafana/data
type: Directory
name: grafana
- hostPath:
path: ./grafana/grafana.ini
type: File
name: grafana-config
- hostPath:
path: ./loki/data
type: Directory
name: loki
- hostPath:
path: ./loki/loki-local-config.yaml
type: File
name: loki-config

4
grafana/data/.gitignore vendored Normal file
View file

@ -0,0 +1,4 @@
*
*/
!.gitignore
!.gitkeep

0
grafana/data/.gitkeep Normal file
View file

1201
grafana/grafana.ini Normal file

File diff suppressed because it is too large Load diff

4
loki/data/.gitignore vendored Normal file
View file

@ -0,0 +1,4 @@
*
*/
!.gitignore
!.gitkeep

0
loki/data/.gitkeep Normal file
View file

View file

@ -0,0 +1,50 @@
# Do not use this configuration in production.
# It is for demonstration purposes only.
auth_enabled: false
server:
http_listen_port: 3100
grpc_listen_port: 9096
common:
path_prefix: /tmp/loki
storage:
filesystem:
chunks_directory: /tmp/loki/chunks
rules_directory: /tmp/loki/rules
replication_factor: 1
ring:
instance_addr: 127.0.0.1
kvstore:
store: inmemory
schema_config:
configs:
- from: 2024-10-20
store: tsdb
object_store: filesystem
schema: v13
index:
prefix: index_
period: 24h
ruler:
enable_api: true
storage:
type: local
local:
directory: /tmp/loki/rules
rule_path: /tmp/loki/rules-temp
# By default, Loki will send anonymous, but uniquely-identifiable usage and configuration
# analytics to Grafana Labs. These statistics are sent to https://stats.grafana.org/
#
# Statistics help us better understand how Loki is used, and they show us performance
# levels for most users. This helps us prioritize features and documentation.
# For more information on what's sent, look at
# https://github.com/grafana/loki/blob/main/pkg/usagestats/stats.go
# Refer to the buildReport method to see what goes into a report.
#
# If you would like to disable reporting, uncomment the following lines:
#analytics:
# reporting_enabled: false