Day 2 operations
How to start and keep Butler running varies depending on whether you are using Docker or a native Node.js approach.
Running under Docker
Starting Butler is easy.
First configure the
docker-compose.yml file as needed, then start the Docker container in interactive mode (with output sent to the screen). This is useful to ensure everything works as intended when first setting up Butler.
Once Butler has been verified to work as intended, hit
ctrl-c to stop it.
Then start Butler in deameon (background) mode:
docker-compose up -d
From here on the Docker enviromment will make sure Butler is always running, including restarting it if it for some reason stops.
Running as native Node.js app
Starting Butler as a Node.js task is easy too:
d: cd \node\butler\src node butler.js
It is of course also possible to put those commands in a command file (.bat on Windows, .sh etc on other platforms) file and execute that file instead.
Windows services & process monitors
As Butler is the kind of service that (probably) should always be running on a server, it makes sense using a Node.js process monitor to keep it alive (if running Butler as a Docker container you get this for free).
On Windows you can use the excellent Nssm tool to make Butler run as a Windows Service, with all the benefits that follow (can be monitored using operations tools, automatic restarts etc).
One caveat with these is that it can be hard to start them (and thus Butler) when a Windows server is rebooted. PM2 can be used to solve this challenge in a nice way, more info in this blog post. On the other hand - just using Nssm is probably the easiest option for Windows.
Once Butler is running it’s a good idea to also monitor it. Otherwise you stand the risk of not getting notified if Butler for some reason misbehaves.
Butler will log data on its memory usage to InfluxDB if
- The config file’s
Butler.uptimeMonitor.storeInInfluxdb.enableproperties are both set to
- The remaining InfluxDB properties of the config file are correctly configured.
Assuming everything is correctly set up, you can then create a Grafana dashboard showing Butler’s memory use over time. You can also set up alerts in Grafana if so desired, with notifications going to most IM tools and email.
A Grafana dashboard can look like this. Note that one of the available metrics (
external) is not used in this particular dashboard. It’s still logged to InfluxDB though.
There is a sample Grafana dashboard in Butler’s GitHub repo.
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.