0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00
ghost/.docker/grafana/dashboard.yml

15 lines
412 B
YAML
Raw Permalink Normal View History

Added prometheus and grafana services to docker compose (#21213) ref https://linear.app/tryghost/issue/ENG-1591/add-prometheus-and-grafana-services-to-docker-compose This commit adds 2 new services to the docker compose file to enable monitoring metrics from Ghost locally in real-time: 1. Prometheus - a service that scrapes Ghost's new `/metrics` endpoint introduced in this [commit](https://github.com/TryGhost/Ghost/commit/768336efad067241ca848027f4ac758148ca3e29). 2. Grafana - a service that consumes the metrics from prometheus and exposes them in a dashboard that you can view locally at `localhost:3000`. # Usage Both of these services are selectively enabled using docker compose [profiles](https://docs.docker.com/compose/how-tos/profiles/). This way, if you don't opt-in to using these monitoring tools, they won't start and consume resources on your host machine. To enable these services, enable the `monitoring` profile by either setting the `COMPOSE_PROFILES` environment variable to `monitoring`, or specifying the `--profile monitoring` CLI argument to any `docker compose ...` commands. I've found the easiest way to configure this in an 'always on' fashion is to create a `.env` file in the project's root directory and add `COMPOSE_PROFILES=monitoring` to it. As an added convenience, you can also set `COMPOSE_FILE=.github/scripts/docker-compose.yml`, which will allow you to run `docker compose ...` commands from the root directory without specifying the full path each time. # Intended for development only These services are meant for local development only, and are not configured for a production use-case. For example, the Grafana instance is configured to have _no authorization_ so you won't need a username/password to login at `localhost:3000`. Prometheus is also configured to scrape the metrics once every second, which is likely excessive for production use-cases, but may be useful for getting more granular metrics while e.g. load testing locally. # Dashboards The Grafana instance includes a default dashboard including most of the main default metrics provided by our prometheus client integration. The dashboard is defined in a JSON file at `.github/scripts/docker/grafana/dashboards/main-dashboard.json' and can be modified & committed to add new visualizations that will be available to anyone work on Ghost locally. You can also add other dashboards to the same directory for specific use-cases, which should be picked up and made available in the Grafana UI. [Read more](https://grafana.com/docs/grafana/latest/dashboards/build-dashboards/view-dashboard-json-model/) about Grafana's JSON schema for dashboards.
2024-10-03 16:43:07 -05:00
## This file is used to point to the folder where the dashboards are stored
## To edit or create a dashboard, add a .json file to the ./dashboards folder
apiVersion: 1
providers:
- name: "Dashboard provider"
orgId: 1
type: file
disableDeletion: false
updateIntervalSeconds: 10
allowUiUpdates: true
Added prometheus and grafana services to docker compose (#21213) ref https://linear.app/tryghost/issue/ENG-1591/add-prometheus-and-grafana-services-to-docker-compose This commit adds 2 new services to the docker compose file to enable monitoring metrics from Ghost locally in real-time: 1. Prometheus - a service that scrapes Ghost's new `/metrics` endpoint introduced in this [commit](https://github.com/TryGhost/Ghost/commit/768336efad067241ca848027f4ac758148ca3e29). 2. Grafana - a service that consumes the metrics from prometheus and exposes them in a dashboard that you can view locally at `localhost:3000`. # Usage Both of these services are selectively enabled using docker compose [profiles](https://docs.docker.com/compose/how-tos/profiles/). This way, if you don't opt-in to using these monitoring tools, they won't start and consume resources on your host machine. To enable these services, enable the `monitoring` profile by either setting the `COMPOSE_PROFILES` environment variable to `monitoring`, or specifying the `--profile monitoring` CLI argument to any `docker compose ...` commands. I've found the easiest way to configure this in an 'always on' fashion is to create a `.env` file in the project's root directory and add `COMPOSE_PROFILES=monitoring` to it. As an added convenience, you can also set `COMPOSE_FILE=.github/scripts/docker-compose.yml`, which will allow you to run `docker compose ...` commands from the root directory without specifying the full path each time. # Intended for development only These services are meant for local development only, and are not configured for a production use-case. For example, the Grafana instance is configured to have _no authorization_ so you won't need a username/password to login at `localhost:3000`. Prometheus is also configured to scrape the metrics once every second, which is likely excessive for production use-cases, but may be useful for getting more granular metrics while e.g. load testing locally. # Dashboards The Grafana instance includes a default dashboard including most of the main default metrics provided by our prometheus client integration. The dashboard is defined in a JSON file at `.github/scripts/docker/grafana/dashboards/main-dashboard.json' and can be modified & committed to add new visualizations that will be available to anyone work on Ghost locally. You can also add other dashboards to the same directory for specific use-cases, which should be picked up and made available in the Grafana UI. [Read more](https://grafana.com/docs/grafana/latest/dashboards/build-dashboards/view-dashboard-json-model/) about Grafana's JSON schema for dashboards.
2024-10-03 16:43:07 -05:00
options:
path: /var/lib/grafana/dashboards
foldersFromFilesStructure: true