Skip to content

Deploy Grafana

This guide shows you how to use Grafana, the open source analytics & monitoring solution for every database.

To run it, follow these steps:

  1. Install the kraft CLI tool and a container runtime engine, e.g. Docker.

  2. Clone the examples repository and cd into the examples/grafana/ directory:

Terminal window
git clone https://github.com/kraftcloud/examples
cd examples/grafana/

Make sure to log into KraftCloud by setting your token and a metro close to you. We use fra0 (Frankfurt, πŸ‡©πŸ‡ͺ) in this guide:

Terminal window
# Set KraftCloud access token
export KRAFTCLOUD_TOKEN=token
# Set metro to Frankfurt, DE
export KRAFTCLOUD_METRO=fra0

When done, invoke the following command to deploy this application on KraftCloud:

Terminal window
kraft cloud deploy -p 443:3000 -M 1024 .

The output shows the instance URL and other details:

Terminal window
[●] Deployed successfully!
β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ name: grafana-sikrv
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ uuid: 1d8f0b36-39ff-45a2-8baa-664640c60885
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€ state: running
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ url: https://icy-sea-i6m5fwyk.fra0.kraft.host
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€ image: grafana@sha256:484d6f98cdc321443188b8f2900035182dffdb45069f3cd087dcb6851ddff3bc
β”œβ”€β”€β”€β”€β”€ boot time: 1024 MiB
β”œβ”€β”€β”€β”€β”€β”€β”€β”€ memory: 502.65 ms
β”œβ”€ service group: dawn-water-4jlnvgpy
β”œβ”€β”€ private fqdn: grafana-mgby4.internal
β”œβ”€β”€β”€β”€ private ip: 172.16.6.6
└────────── args: /usr/share/grafana/bin/grafana server -homepath /usr/share/grafana/

In this case, the instance name is grafana-sikrv and the URL is https://icy-sea-i6m5fwyk.fra0.kraft.host. They are different for each run.

To test, simply point your browser at the URL. The default account/password are admin/admin (you’ll be prompted to change the password).

At any point in time, you can list information about the instance:

Terminal window
kraft cloud instance list
NAME FQDN STATE CREATED AT IMAGE MEMORY ARGS BOOT TIME
memcached-arkv7 weathered-smoke-hehsdinv.fra0.... running 11 minutes ago memcached@sha256:f53cdbce4... 256 MiB /usr/bin/memcached -u root 19266us

When done, you can remove the instance:

Terminal window
kraft cloud instance remove grafana-sikrv

Customize your Application

To customize the application, update the files in the repository, listed below:

  • Kraftfile: the KraftCloud specification, including command-line arguments
  • Dockerfile: In case you need to add files to your instance’s rootfs
spec: v0.6
runtime: grafana:latest
rootfs: ./Dockerfile
cmd: ["/usr/share/grafana/bin/grafana", "server", "-homepath", "/usr/share/grafana/"]

The following options are available for customizing the application:

  • If new files are added, these have to be copied in the application filesystem, using the COPY command in the Dockerfile. See the commented out COPY command in the Dockerfile.

  • If a new executable is used, update the cmd line in the Kraftfile and replace /usr/share/grafana/bin/grafana with the path to the new executable.

  • More extensive changes may require expanding the Dockerfile with additional Dockerfile commands.

Learn More

Use the --help option for detailed information on using KraftCloud:

Terminal window
kraft cloud --help

Or visit the CLI Reference.