Heroku CI In-Dyno Databases
Last updated December 03, 2024
Table of Contents
In-Dyno databases are a feature of Heroku CI. In-Dyno databases are temporary and non-persistent, but require less network bandwidth and are more flexible than than their production add-on counterparts, resulting in improved flexibility and performance.
Heroku CI is currently unavailable for Fir-generation pipelines. Subscribe to our changelog to stay informed of when we add this feature to Fir.
In-Dyno Databases
In-Dyno databases are databases that run inside your test-run’s dyno. These databases differ from the more traditional Heroku add-ons like Heroku Postgres and Heroku Key-Value Store (KVS) in a few notable ways:
- Database queries do not pass over the network, and, as a result, finish in a more consistent and fast speed.
- Many of the restrictions that apply to external addons (like row limits, connection limits, feature enablement, and the ability to create more database) do not apply.
- The data is ephemeral, meaning it is not persisted, backed up, or available outside of the dyno in any way.
The primary drawback to this type of database is its ephemerality; as such, this type of database would not be appropriate for production use. However, because test runs are ephemeral themselves, the advantages of greater flexibility and speed make it a great improvement for your CI workflow.
Usage
Before you can use In-Dyno databases, you need to specify a buildpack in your app.json that reflects the language you’re testing. For example:
{
"buildpacks": [
{ "url": "heroku/ruby" }
]
}
You can use In-Dyno databases for your Heroku CI test runs by using an in-dyno
plan. You may specify this in your app.json. For example:
{
"environments": {
"test": {
"addons": ["heroku-postgresql:in-dyno", "heroku-redis:in-dyno"]
}
}
}
When a test run begins, you can use the database as normal via DATABASE_URL
or REDIS_URL
as appropriate. These urls will point to your locally installed database.
Release Policy
The In-Dyno databases will not always align with the traditional addon release. In-Dyno databases will generally target the latest major version and release point versions as needed.
Set Version
In the event you need a specific version of Postgres for your test runs, specify a value for POSTGRESQL_VERSION
in your app.json
file. Note that not all releases will be available in Heroku CI. We currently support major versions of 14
, 15
, and 16
.
{
"environments": {
"test": {
"env": { "POSTGRESQL_VERSION": "16" },
"addons": ["heroku-postgresql:in-dyno"]
}
}
}
Similarly, to select a specific version of KVS for your test runs, specify a value for REDIS_VERSION
in your app.json
file. This should either be set to a KVS major version (eg 6.2
or 7.0
) or the full version string such as 6.2.10
. For example:
{
"environments": {
"test": {
"env": { "REDIS_VERSION": "7.0" },
"addons": ["heroku-redis:in-dyno"]
}
}
}
Restrictions
- In-Dyno databases only work in Heroku CI. They will not be provisioned for any other type of app (such as Review Apps or Heroku Button Apps).
- Currently,
in-dyno
plans are only supported for theheroku-redis
andheroku-postgresql
addons. - In-Dyno Postgres instances do not support SSL connections.
- In-Dyno Postgres support is limited to the following extensions:
uuid
libxslt
libxml
openssl
gssapi
krb5