Hello!
- What Grafana version and what operating system are you using?
- Grafana Version: 9.2.6
- Docker version: 24.0.5
- What are you trying to achieve?
Change admin password inside the Grafana container with CLI command (‘grafana-cli admin reset-admin-password password’)
- How are you trying to achieve it?
Currently running Grafana with MariaDB as Backend, using a Swarn Stack. DB passwords are passed by Swarn Secrets.
If I set the variable “GF_DATABASE_PASSWORD__FILE” using Secrets, I can’t change the admin password inside the Grafana container with CLI command:
grafana-cli admin reset-admin-password password
But if I deploy my Stack passing the DB Password with the variable “GF_DATABASE_PASSWORD”, I can change the password as expected.
- What did you expect to happen?
In both configurations, I expected to change the Admin password with CLI.
- Can you copy/paste the configuration(s) that you are having problems with?
Stack Config with Secrets, not Working:
version: "3.9"
services:
grafana-db:
image: grafana-db
environment:
MARIADB_DATABASE: grafana
MARIADB_ROOT_PASSWORD_FILE: /run/secrets/grafanadb_root_pw
networks:
- backend
secrets:
- grafanadb_root_pw
- grafanadb_gwadmingrafana_pw
grafana:
image: grafana
depends_on:
- grafana-db
ports:
- 8080:8080
environment:
GF_DATABASE_TYPE: "mysql"
GF_DATABASE_HOST: "grafana-db:3306"
GF_DATABASE_NAME: "grafana"
GF_DATABASE_USER: "gwadmingrafana"
GF_DATABASE_PASSWORD__FILE: /run/secrets/grafanadb_gwadmingrafana_pw
GF_SERVER_HTTP_PORT: "8080"
networks:
- frontend
- backend
secrets:
- grafanadb_gwadmingrafana_pw
networks:
frontend:
backend:
secrets:
grafanadb_root_pw:
external: true
grafanadb_gwadmingrafana_pw:
external: true
Stack Config without Secrets, Working properly:
version: "3.9"
services:
grafana-db:
image: grafana-db
environment:
MARIADB_DATABASE: grafana
MARIADB_ROOT_PASSWORD_FILE: /run/secrets/grafanadb_root_pw
networks:
- backend
secrets:
- grafanadb_root_pw
- grafanadb_gwadmingrafana_pw
grafana:
image: grafana
depends_on:
- grafana-db
ports:
- 8080:8080
environment:
GF_DATABASE_TYPE: "mysql"
GF_DATABASE_HOST: "grafana-db:3306"
GF_DATABASE_NAME: "grafana"
GF_DATABASE_USER: "gwadmingrafana"
GF_DATABASE_PASSWORD: mypassword
GF_SERVER_HTTP_PORT: "8080"
networks:
- frontend
- backend
secrets:
- grafanadb_gwadmingrafana_pw
networks:
frontend:
backend:
secrets:
grafanadb_root_pw:
external: true
grafanadb_gwadmingrafana_pw:
external: true
- Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
When I try to change admin password using secrets:
When I try to change admin password without secrets:
- Did you follow any online instructions? If so, what is the URL?
Grafana Documentation:
I also tried with latest Grafana image, but dosen’t work either.