
Grafana is an open-source analytics and visualization platform designed for observability and monitoring. It connects to data sources and renders interactive dashboards and graphs, while also generating alerts to help you visualize and analyze metrics, logs, and traces from your infrastructure and applications in real-time.
In this article, you will deploy Grafana using Docker Compose, configure persistent storage for dashboard and plugin data, and set up Traefik as a reverse proxy to securely access your Grafana instance.
Before you begin, you need to:
sudo privileges.grafana.example.com).In this section, you prepare the required directory structure for Grafana and define environment variables in a .env file.
Create the directory structure for Grafana.
This directory stores Grafana's database, dashboards, plugins, and configuration files.
Navigate into the grafana-monitoring directory.
Set proper ownership for the Grafana data directory. Grafana runs as the grafana user (UID 472) inside the container.
Create a .env file.
Add the following variables:
Replace:
grafana.example.com with your domain.admin@example.com with your email.changeme with a strong password.Save and close the file.
In this section, you create and deploy the Docker Compose stack that runs Grafana behind Traefik. Docker Compose manages both containers, applies the environment variables from your .env file, and automatically configures HTTPS routing through Traefik.
Create a new Docker Compose manifest.
Add the following content.
Save and close the file.
This deployment specification includes:
./grafana-data) maintains persistent storage for application databases, dashboard configurations, and installed plugins.letsencrypt named volume across service restarts./var/run/docker.sock) allows Traefik to dynamically detect running containers..env file for public-facing URL configuration and initial credentials.Create and start the services.
Verify that the services are running.
Output:
Both containers are running successfully. Grafana is ready to render dashboards while Traefik accepts connections on ports 80 and 443.
View the logs of the services.
For more information on managing a Docker Compose stack, see the How To Use Docker Compose article.
In this section, you access the Grafana web interface and verify your installation by exploring the default interface and available features.
Open the Grafana web interface in your browser.
Sign in with the default credentials:
admin.env fileThe Grafana home page displays after login. Explore the main interface sections:
Verify your Grafana version and build information. Click the question mark icon ? in the top-right corner to open the Help menu. The version and build number appear at the top of the menu (for example, Grafana v12.3.0).
You have successfully deployed Grafana for monitoring visualization with production-ready HTTPS security. The containerized deployment maintains dashboard configurations and application state through persistent volumes, while automated certificate management ensures continuous secure access. With Traefik handling SSL termination and traffic routing, Grafana stands ready to connect with observability backends including Prometheus, Loki, Tempo, and Mimir, transforming raw telemetry into actionable visual insights through customizable dashboards.
0 Comments
Be the first to comment and share your perspective with the community.