Grafana is up and running in a docker. When I deployed it, I used a dockercompose.yaml to specify a datasource and then setup the datasource.yaml file as well.
So far so good.
Grafana uses an external MySQL database to store all its configuration.
I now modify my datasource.yaml to point to a new MSSQL database for my dashboards. Restart the container and it shows I am still connected to the old MSSQL database as the source of data for the dashboards.
I mount the container and can see that the updated file is in the container. However, I check the external MySQL database, crack open the datasource table and find that it has the old connection.
How do you get Grafana on reload of the container to push the datasource (update) into MySQL?
wonder if you need to delete it before recreating it?
# List of data sources to delete from the database.
deleteDatasources:
- name: Graphite
orgId: 1
Yes I did see that but it does say in the documents
"
You can manage data sources in Grafana by adding YAML configuration files in the provisioning/datasources
directory. Each config file can contain a list of datasources
to add or update during startup. If the data source already exists, Grafana reconfigures it to match the provisioned configuration file.
"
so with deleteDatasources
does it work?
Didn’t actually try that yet. Will try it next week and update with if it works or not.
Solution Found.
To update a provisioned datasource, you must increase the version value in the yaml file.
version: 2
The system checks the version number in the file compared to what is in the MYSQL database and if it is <= what is in the database, it ignores the yaml file.
Note: it is a integer value so only 1,2,3,4.