Six Tips for Mastering your Procfile
At it simplest, the Procfile is where you declare the one or more processes to be run for your app to function. Heroku’s docs do a great job of explaining the Procfile format, so this post will focus on a bit more advanced usage.
These tips are a compilation from my Twitter feed, where I post 🔥 tips on Heroku, Rails, and other dev-related topics.
Let’s start with how you use your Procfile in your local dev environment. One of the benefits of a Procfile is dev/prod parity, so it makes sense to run your app locally using a tool like heroku local that integrates with a Procfile.
If you’re a tmux user and want to take this to the next level, overmind is an awesome alternative.
Dev/prod parity is a worthy goal, but there are often processes you only want to run in development. I’ll throw those into my Procfile as well and simply ignore them in production.
Config vars (a.k.a. environment variables) are generally shared amongst all process for your Heroku app, but in your Procfile you can specify per-process configs with shell variable substitution.
You can also use config vars to skip a process altogether.
Remember that you’re not limited to just one web and worker process. You can add as many distinct processes to your Procfile as you want!