Skip to content

Deployment Overview of Grafana on Server

Prerequisites and Basic Requirements

To ensure a successful deployment, the following requirements must be met:

  • Operating System: Compatible with Debian/Ubuntu or RHEL-based distributions (CentOS, Rocky Linux, AlmaLinux).

  • Privileges: Root or sudo access is required for package installation and Docker management.

  • Ports: The following network ports must be open to allow traffic:

  • 22/tcp (SSH)

  • 80/tcp (HTTP)

  • 443/tcp (HTTPS)

  • 3000/tcp (Internal Grafana access)

FQDN of the final panel on the hostkey.in domain

The application is accessible via a specific subdomain based on the server ID.

Parameter Value
Prefix grafana
Domain hostkey.in
Full template grafana{Server_ID_from_Invapi}.hostkey.in

File and Directory Structure

The deployment utilizes the following directory structure for configuration and data persistence:

  • /root/grafana: Contains the application's orchestration files (compose.yml).

  • /data/nginx/user_conf.d/: Stores Nginx proxy configurations.

  • /data/nginx/nginx-certbot.env: Configuration environment file for the SSL proxy.

  • /data/grafana/datasources: Directory used for provisioning Grafana data sources.

Application installation process

The application is deployed using a combination of system configuration and Docker Compose:

  1. System Preparation: The installer identifies the operating system to configure the firewall (using ufw on Debian/Ubuntu or firewalld on RHEL-based systems) and ensures necessary dependencies are present.

  2. Docker Environment Setup: Docker is installed, and a dedicated Docker volume named grafana-data is created for persistent storage.

  3. Configuration Generation: A compose.yml file is generated in /root/grafana/ to define the service orchestration.

  4. Container Orchestration: The application is launched using Docker Compose.

  5. Security Initialization: Upon startup, a command is executed within the container to reset the default administrator password for security.

The installed Grafana version is 8.2.6.

Access Rights and Security

  • Firewall Configuration:

  • On Debian/Ubuntu systems, ufw is used to allow traffic on ports 22, 80, and 443.

  • On RHEL-based systems, firewalld is configured to permit public access on ports 80 and 443.

  • Container Security: The Grafana container runs with a restart policy of unless-stopped.

Databases

The application uses Docker volumes for data persistence rather than an external database connection in this specific configuration. Data is stored within the grafana-data volume.

Docker Containers and Their Deployment

The deployment consists of two primary containers managed via Docker Compose:

nginx

  • Image: jonasal/nginx-certbot:latest

  • Ports:

  • 80:80

  • 443:443

  • Volumes:

  • nginx_secrets:/etc/letsencrypt (External volume for SSL certificates)

  • /data/nginx/user_conf.d:/etc/nginx/user_conf.d

  • Environment Variables:

  • [email protected]

  • Restart Policy: unless-stopped

grafana

  • Image: grafana/grafana-oss:8.2.6

  • Ports: 3000:3000

  • Volumes:

  • /data/grafana/datasources:/etc/grafana/provisioning/datasources

  • grafana-data:/var/lib/grafana (External volume)

  • Restart Policy: unless-stopped

Application Update Instructions

To update the Grafana application, navigate to the deployment directory and pull the latest images defined in your configuration:

cd /root/grafana
docker compose pull && docker compose up -d

Location of configuration files and data

Component Path
Docker Compose File /root/grafana/compose.yml
Grafana Data Volume grafana-data (Docker managed)
Nginx Configuration /data/nginx/user_conf.d/
Datasource Provisioning /data/grafana/datasources

Available ports for connection

  • HTTPS: 443 (via Nginx proxy)

  • HTTP: 80 (for SSL certificate challenges)

  • Internal Grafana: 3000

Starting and Stopping the application

The application is managed using Docker Compose commands from the /root/grafana directory:

To start the application:

docker compose up -d

To stop the application:

docker compose down

Proxy Servers

The deployment includes an Nginx proxy container (nginx-certbot) that handles SSL termination via Let's Encrypt. It serves as a reverse proxy, forwarding HTTPS traffic from port 443 to the Grafana service running on port 3000.

question_mark
Is there anything I can help you with?
question_mark
AI Assistant ×