This add-on is operated by Crunchy Data Inc.
Crunchy Bridge is a fully managed Postgres service from the Postgres Experts.
Last updated December 22, 2021
Table of Contents
Crunchy Bridge is an add-on for fully managed Postgres provided by Crunchy Data.
Crunchy Bridge provides fully managed Postgres that you can easily connect to your Heroku app. Crunchy Bridge includes:
- Simple provisioning
- Disaster recovery and point in time recovery
- Simple scaling
- Built-in connection pooling
These features are provided by an expert team of Postgres contributors.
You can connect your app to Crunchy Bridge with any of your standard language drivers in:
Provisioning the Add-on
crunchy-postgres to a Heroku application via the CLI:
Reference the Crunchy Postgres for a list of available plans.
$ heroku addons:create crunchy-postgres Creating CRUNCHY on freely-falling-7394... free Your add-on has been provisioned successfully
After provisioning crunchy-postgres, the
CRUNCHY_DATABASE_URL config var is available in the attached app’s configuration. It contains the full connection string to your newly provisioned Postgres database. You can see the config var via the
heroku config:get command:
$ heroku config:get CRUNCHY_DATABASE_URL postgres://postgres:sDcaz24izdKgsLv328cKabclqb2v7lcdT3zCQd47hhKTWlehu13ICKmhRMJwP2XN@p.ldzx3sqmwdzsbimyfmlrdpoxpq.db.postgresbridge.com:5432/postgres
After installing CRUNCHY-POSTGRES, the application can be integrated with the add-on.
You can install Postgres for use in a local development environment. Typically, this process entails installing Postgres on your local machine and pointing the app to your local DB.
Ruby on Rails
To use PostgreSQL as your database in Ruby applications, include the pg gem in your Gemfile.
bundle install to download and resolve all dependencies.
If you’re using the pg gem to connect to your Postgres database from a Heroku dyno, and haven’t specified an
sslmode in your configuration or code, the gem defaults to
sslmode: prefer. In this mode, your connections work if SSL use is enforced on your Postgres database.
Install the dj-database-url package using pip.
pip install dj-database-url
Then add the following to the bottom of settings.py:
import dj_database_url DATABASES['default'] = dj_database_url.config(conn_max_age=600, ssl_require=True)
This parses and converts the values of the
DATABASE_URL environment variable to something Django can understand.
Migrating Between Plans
heroku addons:upgrade command to migrate to a new plan.
$ heroku addons:upgrade CRUNCHY-POSTGRES:hobby-4 -----> Upgrading CRUNCHY-POSTGRES:hobby-4 to sharp-mountain-4005... done, v18 ($100/mo) Your plan has been updated to: CRUNCHY-POSTGRES:hobby-4
Removing the Add-on
Before removing CRUNCHY-POSTGRES, export its data by running
pg_dump against your database.
To remove CRUNCHY-POSTGRES, use the CLI:
This action destroys all associated data and you can’t undo it!
$ heroku addons:destroy CRUNCHY-POSTGRES -----> Removing CRUNCHY-POSTGRES from sharp-mountain-4005... done, v20 (free)
Submit all CRUNCHY-POSTGRES support and runtime issues via one of the Heroku Support channels. Any non-support-related issues or product feedback is welcome at email@example.com.