The Crystal Programming Language Forum

Nox: Procfile process manager written in Crystal

If you’re familiar with Heroku, you might be familiar with the concept of Procfiles. I have written a manager for them in Crystal called Nox.

You might ask yourself, “Why write something that has already working solutions out there?”

Well, out of the box, Lucky provides a CLI command for running a “Procfile.dev” file for the project that starts the frontend, backend, and Browsersync for reloading the browser on changes. It checked the user’s system for a couple different process managers (overmind, foreman, heroku CLI) and used the first one it found. While it worked for most, when it didn’t work, the only choice the user was left with was to either figure it out on their own or ask us in the Lucky discord. We became support for a program we didn’t write, and while we usually figured it out, it was definitely a bad first experience for those users that we wanted to solve. By switching to a process manager written in Crystal, we no longer have to depend on the user to install a dependency and that we give more users a great first experience with Lucky :heart:!

If you’re interested in contributing to Crystal, one area that I’ve found missing while working on this library is that we don’t have any shard allowing access to pseudoterminals (pty). I’m not an expert on what they are, but my understanding is with pty I could make the Procfile processes think they’re outputting to a terminal instead of a file which changes how some applications output text. Overmind is an example of a Procfile manager that uses pty and they have an article explaining it a bit more. Introducing Overmind and Hivemind — Martian Chronicles, Evil Martians’ team blog

11 Likes

Wow, this is cool. Nice work!

1 Like