Skip to content

How to install hume

Arturo Busleiman aka Buanzo edited this page Jun 25, 2020 · 1 revision

This article will focus on how to install hume on modern systems that support python >= v3.6 and systemd, I will assume you are using a variant of Debian such as Ubuntu. That's what I have at hand for testing, so if you can provide instructions for other systems, that'd be great.

First, let's make sure we have python3-pip installed:

sudo apt update && apt install python3-pip -y

Now, having pip3 installed, let's upgrade it to the latest available version:

sudo pip3 install --upgrade pip

I planned humed and hume to be installed in the same system, because I don't want hume commands in scripts to introduce execution delays into the scripts that use it. So, to get hume, we install humed:

sudo pip3 install humed

Once installed, we need to create a configuration. The humeconfig command helps with this. Let's take a look at its help:

usage: humeconfig [-h] [--digitalocean] [--from-url URL]
                  [--endpoint ZMQ_ENDPOINT] [--syslog]
                  [--rsyslog PROTO://SERVER:PORT] [--slack WEBHOOK_URL]
                  [--quiet] [--dry] [--install-systemd]

optional arguments:
  -h, --help            show this help message and exit
  --digitalocean        Enables gathering droplet metadata using. Requires
                        --from-url.
  --from-url URL        Create config from url. It sends a POST request to the
                        specified url including various metadata. Useful for
                        provisioning.
  --endpoint ZMQ_ENDPOINT
                        ZMQ Endpoint hume client will send messages to. A
                        local address is recommended.
  --syslog              Enable local syslog transfer_method in humed.
  --rsyslog PROTO://SERVER:PORT
                        Humed will use remote syslog transfer_method. Example:
                        udp://rsyslog.example.net:514. Proto may be tcp or
                        udp. All components must be specified, including port.
  --slack WEBHOOK_URL   Enable Slack using a webhook url.
  --quiet               Make no output, stderr included.
  --dry                 Disable file writes.
  --install-systemd     If /etc/humed/config.yaml exists, attempts to install
                        and enable humed systemd service unit.

Today humeconfig supports all of those options, except for --from-url and --digitalocean, which will be used to provision hume configurations via cloud-init or similar. Also, as I am still developing the more advanced message routing features of hume, it doesn't make too much sense.

The simplest setup is the least useful one. In the next article (Slack integration) we will see something a bit more interesting.

Let's run these commands:

sudo humeconfig --syslog  # This enables a syslog configuration for hume/humed.
sudo humeconfig --install-systemd   # This creates a service unit in /lib/systemd/system
                                    # or /usr/lib/systemd/system depending on which location
                                    # exists and has *.service files in it.
sudo systemctl enable humed         # enable the humed service unit
sudo systemctl start humed          # ... and start it.

Now, if you run a hume command, you should find the corresponding message in /var/log/syslog.