I am using Heroku Pipelines connected to GitHub.
I have three different environments:
- Reviews (where all my pull requests are automatically deployed to once my CI tests are successful)
- Staging (where my master branch is deployed to)
- Production (my production environment)
My Review apps are created and destroyed as I pull and merge branches. My Staging and Production apps are always the same. Staging gets updated when my master branch is updated, and then I can manually decide to promote that code to Production.
This is all great! Except I am facing a issue with my app.json file.
When developing new branches, I often use new heroku addons i.e. a Redis db or new monitoring tools. I do this by updating my app.json file. Example:
"addons": [
"logentries:le_tryit",
"newrelic:wayne",
{
"plan": "mongolab:sandbox",
"as": "MONGODB_URI"
},
{
"plan": "heroku-redis:hobby-dev",
"as": "REDIS_SESSIONS_URI"
}
]
Once a create a pull request, a app is created in Reviews and I can see my new addons. Unfortunately, when I merge my branch with master, app.json doesn't seem to run again on my Staging environment (and subsequently in my Production environment.
Is there a way to re-run the app.json manifest in an existing heroku app? and can they be automated with each new deploy?
If not, are there reasons for this?
Thanks!
There is no way to do what you're asking. The app.json is only parsed when creating a new Heroku app, not when re-deploying one. The reason is that it could cause unwanted side effects to a production application.
EG: What would happen if you remove a line from the app.json file and push that to an existing Heroku app? Should Heroku delete your addon (potentially destroying lots of data?)
Instead, what you should do is this: when you cut a production release, if you need to use new addons or change them, do it via the CLI manually.
For instance:
$ heroku addons:create heroku-redis
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With