Files
ubicloud/rhizome/host/bin/setup-grafana
mohi-kalantari 4958f596e2 Add grafana installation strand
We are planning to improve the monitoring collecting the node_exporter
metrics helping us in the kubernetes CSI logic and maintenance. At this
stage we plan to provision a Grafana on a Vm to view the dashboards.

It can be provisioned anywhere as long as it can reach the VictoriaMetrics
server. It can also be provisioned on the same Vm.

In order to keep the strand self contained, it uses certbot for cert
generation and won't provision Ubicloud lbs and use its certs. Most of
the time Grafana is deployed with a single instance and LBs are not needed.

Also the process is not fully automated because it will be run few times and
we don't need full automation. Because of that some actions like the DNS needs
to be done manually.

This strand will try to install grafana on the provided subject id.
The strand won't create the vm or add the DNS records but takes care
of all the remaining logics which must be run inside the vm like
installing the nginx, certbot, getting the certificate and installing
the grafana.

The API looks like this:

vm = Prog::Vm::Nexus.assemble_with_sshable(project_id,
  sshable_unix_user: "ubi", name: "grafana-0", enable_ip4: true).subject

At this step create an A record, resolving your domain to the vm ip.

st = Prog::SetupGrafana.assemble(vm.id, grafana_domain: "grafana.domain.com",
  certificate_owner_email: "youremail@gmail.com")

You can then read the password of the grafana using this command:
vm.sshable.cmd("sudo cat /etc/grafana/grafana.ini | grep admin_password")
2025-06-25 10:59:23 +02:00

2.0 KiB
Executable File