Skip to content

Commit 98b5bc3

Browse files
committed
feat: Add OAuth support for Grafana authentication
1 parent 8c501d6 commit 98b5bc3

File tree

2 files changed

+29
-6
lines changed

2 files changed

+29
-6
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,12 @@
11
[users]
22
home_page = /d/f90500a0-a12e-4081-a2f0-07ed96f27915/1-postgres-node-performance-overview-high-level/
3+
4+
[auth]
5+
# When OAuth is enabled, optionally disable the basic login form
6+
disable_login_form = false
7+
8+
[auth.generic_oauth]
9+
# OAuth is disabled by default; enable via GF_AUTH_GENERIC_OAUTH_ENABLED env var
10+
enabled = false
11+
name = PostgresAI
12+
allow_sign_up = true

docker-compose.yml

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,19 @@ services:
119119
GF_SECURITY_ADMIN_USER: monitor
120120
GF_SECURITY_ADMIN_PASSWORD: ${GF_SECURITY_ADMIN_PASSWORD:-demo}
121121
GF_INSTALL_PLUGINS: yesoreyeram-infinity-datasource
122+
# OAuth configuration (disabled by default, enabled via Ansible)
123+
GF_AUTH_GENERIC_OAUTH_ENABLED: ${GRAFANA_OAUTH_ENABLED:-false}
124+
GF_AUTH_GENERIC_OAUTH_NAME: ${GRAFANA_OAUTH_NAME:-PostgresAI}
125+
GF_AUTH_GENERIC_OAUTH_ALLOW_SIGN_UP: ${GRAFANA_OAUTH_ALLOW_SIGN_UP:-true}
126+
GF_AUTH_GENERIC_OAUTH_CLIENT_ID: ${GRAFANA_OAUTH_CLIENT_ID:-}
127+
GF_AUTH_GENERIC_OAUTH_CLIENT_SECRET: ${GRAFANA_OAUTH_CLIENT_SECRET:-}
128+
GF_AUTH_GENERIC_OAUTH_SCOPES: ${GRAFANA_OAUTH_SCOPES:-openid email profile}
129+
GF_AUTH_GENERIC_OAUTH_AUTH_URL: ${GRAFANA_OAUTH_AUTH_URL:-}
130+
GF_AUTH_GENERIC_OAUTH_TOKEN_URL: ${GRAFANA_OAUTH_TOKEN_URL:-}
131+
GF_AUTH_GENERIC_OAUTH_API_URL: ${GRAFANA_OAUTH_API_URL:-}
132+
# Optional: disable login form when OAuth is primary auth
133+
GF_AUTH_DISABLE_LOGIN_FORM: ${GRAFANA_DISABLE_LOGIN_FORM:-false}
134+
GF_SERVER_ROOT_URL: ${GF_SERVER_ROOT_URL:-}
122135
ports:
123136
- "${GRAFANA_BIND_HOST:-}3000:3000"
124137
volumes:
@@ -194,18 +207,18 @@ services:
194207
- /var/lib/docker/:/var/lib/docker:ro
195208
- /dev/disk/:/dev/disk:ro
196209
command:
197-
- '--housekeeping_interval=30s'
198-
- '--docker_only=true'
199-
- '--disable_metrics=percpu,sched,tcp,udp,hugetlb,referenced_memory,cpu_topology,resctrl'
200-
- '--store_container_labels=false'
210+
- "--housekeeping_interval=30s"
211+
- "--docker_only=true"
212+
- "--disable_metrics=percpu,sched,tcp,udp,hugetlb,referenced_memory,cpu_topology,resctrl"
213+
- "--store_container_labels=false"
201214

202215
# Node Exporter - System metrics
203216
node-exporter:
204217
image: prom/node-exporter:v1.8.2
205218
container_name: node-exporter
206219
command:
207-
- '--path.rootfs=/host'
208-
- '--collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc)($$|/)'
220+
- "--path.rootfs=/host"
221+
- "--collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc)($$|/)"
209222
volumes:
210223
- /:/host:ro,rslave
211224
restart: unless-stopped

0 commit comments

Comments
 (0)