How to get into the Rails console, or other tasks in a buildpack-based deploy

I’m using pretty standard buildpacks:

  builder = "heroku/buildpacks:20"
  buildpacks = ["heroku/nodejs", "heroku/ruby"]

So I was able to get this working by:

fly ssh console
cd /app
cat profile.d/ # executing is denied

Exporting the variables found there manually sets up what we need. Then we can do bin/rails c and the console loads.

Update: My solution no longer works as now /app/profile.d no longer exists. For a few minutes on one deploy (currently working through another issue) /cnb/process existed but then disappeared when deploying again.