- Fork this repository.
- Create a Node.js application. It will download and run Grafana using the root
package.jsonfile. The install scriptbuild.shwill download grafana and its plugins and the start onerun.shwill start the grafana-server binary. - In your application environment variables add
GF_SERVER_HTTP_PORT=8080. - Add
GRAFANA_VERSIONandGRAFANA_SHA_256environment variables. You can find these values on the Grafana download page. - Check Node.js version used in
package.json, for instance Grafana 7.5.5 expects Node.js 14 (see Grafana's package.json). - To install custom Grafana plugin, you can set them directly in
GRAFANA_PLUGINSenvironnement variable split by a,, for example with the value:plugin,other_one:0.0.2,https://github.com/ovh/ovh-warp10-datasource.git. It will install the latest version ofplugin, the version0.0.2ofsecond_oneusing the grafana-cli commands. And for theovh-warp10-datasourceplugin,git cloneis used instead, as it's done for any plugin starting byhttp. - Add
GF_PLUGIN_DIRenvironnement variable with./data/pluginsto use local cloned plugins. - You can now build and start the Clever Cloud application, be aware however that if you restart it your data will not be persisted (see next section to learn how to persist data).
- To configure Grafana through environment variables please check grafana configuration page.
For this example we will use mysql however the procedure shouldn't be too different with any other type of database as PostgreSQL.
- Create your database add-on on Clever Cloud and link it to the application, you can check our documentation.
- In your application environment variables you should now see the information you need to connect to your database.
- Link your add-on to your Grafana application. To do this you need to create a few environment variables (replace what's in '<>' with the actual value):
GF_DATABASE_NAME=<MYSQL_ADDON_DB>GF_DATABASE_HOST=<MYSQL_ADDON_HOST>GF_DATABASE_PASSWORD=<MYSQL_ADDON_PASSWORD>GF_DATABASE_URL=<MYSQL_ADDON_URI>GF_DATABASE_USER=<MYSQL_ADDON_USER>GF_DATABASE_TYPE=mysql