A Rails 7 compatible bin/dev for heroku local
Rails 7 introduced a new bin/dev
wrapper to launch and manage your Rails server, CSS watcher, and JS bundler into a single process, managed by foreman
.
This is quite handy for running everything with a single command.
But what if you’re deploying to Heroku and using the Heroku CLI’s heroku local
to run things locally?
Or if you’re a fan of one of the other tools that manage processes based on your Procfile
?
I’ve got you covered!
bin/dev
for heroku local
The biggest, and most obvious change is swapping out the executable.
Mostly this is to do with heroku local
using the :<subcommand>
style CLI interface.
Let’s compare foreman
, heroku local
, and bin/dev
doing similar things to see how their CLIs differ.
# start the web and css processes
$ foreman start web,css
$ heroku local:start web,css
$ bin/dev web,css
It turns out bin/dev
explicitly calls the foreman start
command.
So a quick heroku local
version of the same would be: