Elixir, Phoenix and Default Logging

If you are using the default Logger in your Elixir/Phoenix web app with no further configuration then your logs will rotate rather quickly. If you are using Distillery then, by default, your log files will be in var/log and they’ll be named like:

Read More

Elixir, Phoenix and Using Agent for State

One of the real joys of Elixir is how easy it makes solving problems that are relatively difficult or tedious in other languages. A lot of this comes via wrapping the facilities in the underlying Erlang language and OTP. One of the areas that I’ve just had an opportunity to explore are GenServer and Agent.

Read More

Elixir, Atom, Fira Code Font

If you are developing in Elixir and use the github Atom code editor you might want to take a look at the Firacode Font. It has support for programming ligatures. Font changes can be fairly easily managed in Atom by installing the fonts package. That package provides dozens of possibilities for monospaced programmer fonts.

Read More

Elixir, Ecto, embeds_many

I built an internal project using Elixir and the Phoenix web framework. We use AWS and I wanted to build our own site that could quickly display EC2 instance information along with additional information that we’d gather from our deployment process. We wanted to add some initial simple functionality as well like searching within the attributes on an instance instead of just across all attributes that AWS Console provides and some various quick “copy to clipboard” type functionality that were deemed important for operations. I named the app - aws_detective.

Read More

Elixir, Ecto, Tables without "id" in Relationships

Always, always, always use an “id” as the primary key for your relational database tables where that “id” is a database sequence generated value. And if that table has a relationship with another table then make sure your column name is : “tablename_id”. This is the common wisdom in using Ecto (or really any modern relational library that attempts to help you with talking to your relational database). But although there may be many people who tell you it can’t be done any other way that information is not true and the facts are laid out in the Ecto documentation (which is really good as is the case with most of the Elixir library doc that I’ve had to read).

Read More