Zudoku
Guides

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:

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

Make sure to log into Unikraft Cloud by setting your token and a metro close to you. We use fra0 (Frankfurt, ๐Ÿ‡ฉ๐Ÿ‡ช) in this guide:

TerminalCode
# Set Unikraft Cloud access token export UKC_TOKEN=token # Set metro to Frankfurt, DE export UKC_METRO=fra0

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

TerminalCode
kraft cloud deploy -p 443:3000 -M 1024 .

The output shows the instance URL and other details:

TerminalCode
[โ—] 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: 502.65 ms โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ memory: 1024 MiB โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€ service: 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:

TerminalCode
kraft cloud instance list
Code
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:

TerminalCode
kraft cloud instance remove grafana-sikrv

Customize your Application

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

  • Kraftfile: the Unikraft Cloud specification, including command-line arguments
  • Dockerfile: In case you need to add files to your instance's rootfs

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 Unikraft Cloud:

TerminalCode
kraft cloud --help

Or visit the CLI Reference.

Last modified on