Setting Heroku apps URL in Review App
Heroku launched the review apps beta earlier in May 2015, which completes the continuous delivery experience when deploying on Heroku, along with the Heroku flow. To try out this new flow, I spinned up a rails review app, everything else looks good except that all the assets were broken on the review app server.
It turns out that the assets was depending on an ENV variable, WWW_HOST
which is url of the Heroku app and I’ve to fix this manually by doing heroku config:set WWW_HOST=blablabla.com
for each review app. But isn’t it too tedious? I think so.
Then I was prying around in the Heroku server and found this HEROKU_APP_NAME
which allows me to update the WWW_HOST
env via the postdeploy
script. I’ve configured the app.json
as following:
It should run bin/rake dev:bootstrap
after the deployment, and I’ve added a rake task to update the environment variable with Heroku Platform API.