I am trying to use Heroku review apps for testing and demonstrating my site to my colleagues. The site has a large database that will not function with Heroku’s free hobby-dev
databases.
I am trying to use the app.json
manifest file to specify the platform of my app, as per the guide. The code I’m using is below:
app.json
{
"name": "SiteName",
"description": "The website for SiteName",
"keywords": [
"mezzanine",
"django"
],
"image": "heroku/python",
"env": {
"EMAIL_SYSTEM": {
"description": "The email system to use, either console or mailgun",
"value": "mailgun"
},
"ENVIRONMENT": {
"description": "The dev environment, either production or test",
"value": "production"
},
"ALLOWED_HOSTS": {
"description": "Comma-separated list of hosts",
"value": ".herokuapp.com"
},
"DEFAULT_FROM_EMAIL": "[email protected]",
"SECRET_KEY": {
"description": "A secret key for verifying the integrity of signed cookies.",
"generator": "secret"
},
"WEB_CONCURRENCY": {
"description": "The number of processes to run.",
"value": "5"
},
"NODE_ENV": "production",
"DEBUG": "False",
"NPM_CONFIG_PRODUCTION": "false",
"CELERY_REDIS_MAX_CONNECTIONS": 3,
"S3_BUCKET": "my-s3-bucket",
"USE_CELERY_TASKS": "True"
},
"formation": {
"web": {
"quantity": 1,
"size": "Standard-1X"
},
"worker": {
"quantity": 1,
"size": "Standard-1X"
}
},
"addons": [
"heroku-redis",
{
"plan": "heroku-postgresql:standard-0",
"as": "DATABASE"
}
],
"buildpacks": [
{
"url": "https://github.com/heroku/heroku-buildpack-python.git"
}
],
"scripts": {
"postdeploy": "python manage.py migrate && python manage.py populate_db"
},
"environments": {
"test": {
"addons": [
"heroku-postgresql:in-dyno",
"heroku-redis:in-dyno"
],
"env": {
"APP_SKIP_DB_TEARDOWN": "True",
"DB_REQUIRE_SSL": "False",
"DEBUG": "True",
"S3_BUCKET": "my-s3-bucket",
"USE_CELERY_TASKS": "False"
},
"scripts": {
"test-setup": "python manage.py collectstatic --noinput",
"test": "python manage.py test"
}
}
}
}
This will build OK, but how can I explicitly specify the database plan I wish to use?
3
Answers
In case anyone else runs into this.
According to heroku support they have changed how they provision addons for review and CI apps to mean that by default they'll only provision the free / cheapest plan, regardless of what is in your app.json Here are some details and explanation of their reasoning
They can override this at an account level if you open a ticket (at time of writing this doesn't seem to be built into their admin area)
You just need to specify the plan using the sintax:
heroku-postgresql:<plan_you_select>
For a list of the available plans, checkout this link:
https://devcenter.heroku.com/articles/heroku-postgres-plans#hobby-tier
You can also use this link: https://elements.heroku.com/addons/heroku-postgresql
Select a plan on it, and you’ll see the plan name on the CLI
If you don’t/can’t open a ticket like Pete’s answer suggests, here’s some bash code I just wrote to upgrade my Postgres DB. It’s complicated since:
app.json
and other settingsheroku pg:upgrade
only works on non-hobby dbs