Skip to content

Hume configuration with cloud init

Arturo Busleiman aka Buanzo edited this page Jun 29, 2020 · 2 revisions

You might be interested in installing hume/humed automatically during virtual machine creation using the wonderful cloud-init. The easier way to do it is by using the runcmd cloud-init command. This is just an example, very simple to adapt to your needs (make sure you read the rest of the wiki pages here, for example the Slack integration page).

I am assuming you will be running a Debian flavor such as Ubuntu that ships python3-pip package. You might need to rename that appropriately: we want pip3 to become available for the runcmd stage. Of course, https://slackwebhook.example.com/webhook_id as used in the below example is just an example.

In short, this cloud-init user-data payload installs pip3, then humed. It configures humed for Slack integration with a default channel, plus error and critical-level specific channels. Then it enables humed using systemctl, starts it and finally issues three hume commands to report correct configuration to the default/fallback, error and critical channels.

Hope it helps you!

NOTE: Once --from-url works in humeconfig I will extend this article.

#cloud-config:
packages:
  - python3-pip
runcmd:
  - pip3 install humed
  - humeconfig --slack https://slackwebhook.example.com/webhook_id --slack-error https://slackwebhook.example.com/errorchannel --slack-critical https://slackwebhook.example.com/criticalchannel
  - humeconfig --install-systemd
  - systemctl enable humed
  - systemctl start humed
  - hume -t CLOUD_INIT -T firstboot,cloudinit,digitalocean -L info "HUME default channel working"
  - hume -t CLOUD_INIT -T firstboot,cloudinit,digitalocean -L error "HUME error channel working"
  - hume -t CLOUD_INIT -T firstboot,cloudinit,digitalocean -L critical "HUME critical channel working"

Remember, it might take an extra minute or two for cloud-init to process it all. But let me tell you: the first time I tested the cloud-init code above, IT JUST WORKED: I got a nice Slack notification that my new digitalocean droplet was up and running and that hume was 100% ready.