Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(docker-compose): add a way to change default datasource #8127

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions docker-compose-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,11 @@ services:
environment:
GF_SERVER_ROOT_URL: "http://localhost:4000/grafana"
GF_USERS_DEFAULT_THEME: "light"
MYSQL_URL: mysql:3306
MYSQL_DATABASE: lake
MYSQL_USER: merico
MYSQL_PASSWORD: merico
DB_TYPE: mysql
DB_HOST: mysql:3306
DB_DATABASE: lake
DB_USER: merico
DB_PASSWORD: merico
TZ: UTC
restart: always
depends_on:
Expand Down
12 changes: 7 additions & 5 deletions grafana/provisioning/datasources/datasource.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ apiVersion: 1

datasources:
- name: mysql
type: mysql
url: $MYSQL_URL
database: $MYSQL_DATABASE
user: $MYSQL_USER
type: $DB_TYPE # can be "postgres" or "mysql"
url: $DB_HOST
jsonData: # as stated in https://github.com/grafana/grafana/issues/11407#issuecomment-376862604
sslmode: disable
database: $DB_DATABASE
user: $DB_USER
secureJsonData:
password: $MYSQL_PASSWORD
password: $DB_PASSWORD
editable: false