heroku / heroku/heroku-buildpack-python

Skip the default heroku-postgresql addon if DATABASE_URL is set

Open
#1,068 4 comments 2 reactions 0 assignees View on GitHub
enhancement
Dominant language
Ruby
Stars
993
Forks
1.8k
Avg merge
10h 50m
Merged PRs (30d)
10

Description

Currently the Python buildpack's `bin/release` step sets a default `heroku-postgresql` addon if the app has a `manage.py` script.

However for use-cases where the app wishes to use a different Heroku addon, or a non-Heroku DB, this default addon at best is unused and at worst causes confusion.

To resolve this the buildpack could skip the default addon if `DATABASE_URL` were already set at the time of the first build.

This would cause the default addon to be skipped if either:
1. the app had another addon attached prior to the first build (that provided the `DATABASE_URL` env var)
2. `DATABASE_URL` was manually set (eg via review app apps.json `env` list) then the default DB would be skipped

For more background see the discussion in:
https://github.com/heroku/heroku-buildpack-python/pull/1056

Note: The buildpack API does not provide the env dir location during release. As such the env var would need to be checked during `bin/compile` and either stored until `bin/release`, or else the release step refactored such that the payload is generated during `bin/compile` and saved to disk, and then `bin/release` simply returns the already-generated payload. The latter is what the Ruby buildpack does.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.