From 933e7256e338c9f08d0310544d916ec64314c976 Mon Sep 17 00:00:00 2001 From: Joey Orlando Date: Mon, 10 Jul 2023 12:09:22 +0200 Subject: [PATCH] move local developer resources to ./dev folder (#2479) # What this PR does As part of #1953, I wanted to be able to easily locally modify my Grafana instance's access control provisioning configuration. In the `grafana` container in `docker-compose-developer.yml`, we already have this: ```yml volumes: - ./provisioning:/etc/grafana/provisioning ``` The `dev` directory has a `.gitignore` setup which is better suited for what I would like to do. By default, if I add `./dev/grafana/provisioning/access-control/custom-roles.yml`, it will be git-ignored. This would've not been the case with the `./provisioning` directory *Other stuff* - create `./dev/grafana` folder. This folder contains resources that are volume mounted into the `grafana` container in `docker-compose-developer.yml`. - We already had a `./dev/grafana.dev.ini` file, relocated this here. - Relocated `./provisioning` to `./dev/grafana/provisioning`. - consolidate `./examples/terraform` into `./terraform` directory ## Checklist - [ ] Unit, integration, and e2e (if applicable) tests updated (N/A) - [ ] Documentation added (or `pr:no public docs` PR label added if not required) (N/A) - [ ] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not required) (N/A) --- dev/.gitignore | 7 +++++++ dev/README.md | 10 ++++++++-- .../grafana/provisioning}/datasources/automatic.yml | 0 docker-compose-developer.yml | 2 +- {examples/terraform => terraform/examples}/basic.tf | 0 {examples/terraform => terraform/examples}/routes.tf | 0 .../terraform => terraform/examples}/shift_schedule.tf | 0 7 files changed, 16 insertions(+), 3 deletions(-) rename {provisioning => dev/grafana/provisioning}/datasources/automatic.yml (100%) rename {examples/terraform => terraform/examples}/basic.tf (100%) rename {examples/terraform => terraform/examples}/routes.tf (100%) rename {examples/terraform => terraform/examples}/shift_schedule.tf (100%) diff --git a/dev/.gitignore b/dev/.gitignore index a6cb371e..005867ef 100644 --- a/dev/.gitignore +++ b/dev/.gitignore @@ -11,3 +11,10 @@ !README.md !scripts/ !scripts/* + +# only source control grafana/provisioning/datasources/automatic.yml +# any other files under ./grafana will be ignored +!grafana/ +!grafana/provisioning/ +!grafana/provisioning/datasources/ +!grafana/provisioning/datasources/automatic.yml diff --git a/dev/README.md b/dev/README.md index e8ae4fd2..fd33bc47 100644 --- a/dev/README.md +++ b/dev/README.md @@ -98,7 +98,7 @@ The following commands assume you run them from the root of the project: ```bash touch ./dev/grafana.dev.ini # make desired changes to ./dev/grafana.dev.ini then run -touch .env && ./dev/add_env_var.sh GRAFANA_DEV_PROVISIONING ./dev/grafana.dev.ini .env +touch .env && ./dev/add_env_var.sh GRAFANA_DEV_PROVISIONING ./dev/grafana/grafana.dev.ini .env ``` For example, if you would like to enable the `topnav` feature toggle, you can modify your `./dev/grafana.dev.ini` as @@ -109,9 +109,15 @@ such: enable = top_nav ``` -The next time you start the project via `docker-compose`, the `grafana` container will have `./dev/grafana.dev.ini` +The next time you start the project via `docker-compose`, the `grafana` container will have `./dev/grafana/grafana.dev.ini` volume mounted inside the container. +#### Modifying Provisioning Configuration + +Files under `./dev/grafana/provisioning` are volume mounted into your Grafana container and allow you to easily +modify the instance's provisioning configuration. See the Grafana docs [here](https://grafana.com/docs/grafana/latest/administration/provisioning/#:~:text=You%20can%20manage%20data%20sources,match%20the%20provisioned%20configuration%20file.) +for more information. + ### Enabling RBAC for OnCall for local development To run the project locally w/ RBAC for OnCall enabled, you will first need to run a `grafana-enterprise` container, diff --git a/provisioning/datasources/automatic.yml b/dev/grafana/provisioning/datasources/automatic.yml similarity index 100% rename from provisioning/datasources/automatic.yml rename to dev/grafana/provisioning/datasources/automatic.yml diff --git a/docker-compose-developer.yml b/docker-compose-developer.yml index a7bc8910..d985604b 100644 --- a/docker-compose-developer.yml +++ b/docker-compose-developer.yml @@ -314,7 +314,7 @@ services: volumes: - grafanadata_dev:/var/lib/grafana - ./grafana-plugin:/var/lib/grafana/plugins/grafana-plugin - - ./provisioning:/etc/grafana/provisioning + - ./dev/grafana/provisioning:/etc/grafana/provisioning - ${GRAFANA_DEV_PROVISIONING:-/dev/null}:/etc/grafana/grafana.ini depends_on: postgres: diff --git a/examples/terraform/basic.tf b/terraform/examples/basic.tf similarity index 100% rename from examples/terraform/basic.tf rename to terraform/examples/basic.tf diff --git a/examples/terraform/routes.tf b/terraform/examples/routes.tf similarity index 100% rename from examples/terraform/routes.tf rename to terraform/examples/routes.tf diff --git a/examples/terraform/shift_schedule.tf b/terraform/examples/shift_schedule.tf similarity index 100% rename from examples/terraform/shift_schedule.tf rename to terraform/examples/shift_schedule.tf