Heroku postdeploy script crashes: "Don't know how to build task 'bootstrap'"
Hello all,
I am deploying a branch on a Review App in Heroku. FYI, this is almost the bare Jumpstart Pro template at the moment, just adding Overmind .env file (which I almost shouldn't) + updating
The build succeeds, but the scripts, which I presume based on the
I am deploying a branch on a Review App in Heroku. FYI, this is almost the bare Jumpstart Pro template at the moment, just adding Overmind .env file (which I almost shouldn't) + updating
rails
from 6.1 to 6.1.3.1 to remove rails
' mimemagic
dependency.The build succeeds, but the scripts, which I presume based on the
app.json
file, fail with this error:rake aborted!
Don't know how to build task 'bootstrap'
I bugged on "bootstrap", which is supposed to be nowhere on the project. It actually appears in the
app.json
file:{ "name": "Jumpstart Pro", "description": "A Ruby on Rails template for SaaS apps and more", "website": "https://jumpstartrails.com", "scripts": { "postdeploy": "bundle exec rake bootstrap" }, "env": { ... }, ... }
I don't understand why this is here, what's its purpose and why it did not fail before but does now.
Any idea?
Thanks :-)
After some investigations, here is what I understand so far.
- This
app.json
file is just Heroku's example, and thebundle exec rake bootstrap
is just an example as well. For Review Apps, it seems that a better command would bebundle exec rake db:schema:load
to initialize the database for the first time (since it creates a new PostGres instance every time you create a new Review App). - Heroku recommend to always set
RAILS_ENV
toproduction
, because maintaining multiple config files can be a hassle. - In Rails, credentials are looked for based on the
RAILS_ENV
, which would mean that if you follow Heroku's recommendations, every Heroku environment isproduction
and will look forconfig/credentials/production.yml.enc
.
Then how could you have a
RAILS_ENV=production
and use the staging
credentials?I found part of the solution in this StackOverflow thread. The idea is to create a new environment variable that matches the step of your Heroku's pipeline and looks for the proper credentials in Rails, by overriding the behaviour of
config.credentials.content_path
.I find this solution a bit sketchy, I will try it out and post the results here.
But if anyone here has a better experience than me in deploying Jumpstart Pro to Heroku using their Pipeline feature, I'm really interested.
Also, you definitely want to change the
web[size]
in the app.json
to free
:"formation": { "web": { "quantity": 1, "size": "free" } }
If you leave this at Standard-X1, every Review App created will be charged with the Standard pricing of $25/month, which can lead to surprises (already $2 💸 for me)
free
by default, and let the users decide whether they want to upgrade this.Notifications
You’re not receiving notifications from this thread.