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, for example Docker.

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

Code(bash)
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. This guide uses fra (Frankfurt, ๐Ÿ‡ฉ๐Ÿ‡ช):

Code(bash)
# Set Unikraft Cloud access token export UKC_TOKEN=token # Set metro to Frankfurt, DE export UKC_METRO=fra

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

Code(bash)
kraft cloud deploy -p 443:3000 -M 1024 .

The output shows the instance address and other details:

Code(ansi)
[โ—] Deployed successfully! โ”‚ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ name: grafana-sikrv โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ uuid: 1d8f0b36-39ff-45a2-8baa-664640c60885 โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ state: running โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ url: https://icy-sea-i6m5fwyk.fra.unikraft.app โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ 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 address is https://icy-sea-i6m5fwyk.fra.unikraft.app. They're different for each run.

To test, point your browser at the address. The default account/password are admin/admin (the system will prompt you to change the password).

You can list information about the instance by running:

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

When done, you can remove the instance:

Code(bash)
kraft cloud instance remove grafana-sikrv

Customize your app

To customize the app, 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 app:

  • If you create any new source files, copy them into the app filesystem by using the COPY command in the Dockerfile. See the commented out COPY command in the Dockerfile.

  • If you use a new executable, 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 extending the Dockerfile (see Dockerfile syntax reference).

Learn more

Use the --help option for detailed information on using Unikraft Cloud:

Code(bash)
kraft cloud --help

Or visit the CLI Reference.

Last modified on