Best practices for running elixir apps

How do monitor you app when it it’s live? How do you do your debugging? How do you know when something is going wrong (besides user complaints)?

There it’s as ok amount of info about building your app, but not so much about running it and monitoring it, so was wondering how you all do it? Feels like building an app and Yolo-deploying it is not how things are done in the real world :smiley:

I’ve seen mentions of using an remote iex shell, but why use it in the first place? What problem does it solve?

1 Like

There are many ways:

  1. Observer
  2. Remote iex - See below.
  3. You can connect a LiveBook to the remote. - You can build a set of LiveBooks and run administrative commands remotely on a live production server.
  4. PromEx - For using Prometheus & Grafana
  5. Phoenix Dashboard - Comes by default in a new Phoenix project, and is like a web version of Observer.
  6. Sentry.io - To track frontend performance.
  7. eFlambe / Flameon - For flame graphs to monitor performance.

Elixir and the underlying Beam are the most observable system, than any I have come across.

So just try out all of the above.


As for iex, it’s powerful because you can:

  1. Use tools like dbg, pry, observer directly on the server.
  2. Inspect the running processes.
  3. Kill running processes.
  4. Run any ecto / db queries.
  5. Talk to any part of the code.
7 Likes

In a system where you can have potential errors, and you want to monitor that the system/subsystems are running in a stable manner (for example error/success rate doesn’t exceed some threshold) I would employ usually a time-series database like influxDB, then plot the graphs for analysts in a tool like grafana.

Generally speaking you should use tools that your organization operates better with, as different products have different needs of monitoring. A simple example would be when we had to create a tool that would connect to sftp servers every n minutes and return metrics if the server is alive to track possible outages due to high data flow, I don’t think you can find something already done for this.

1 Like