You want your app to connect to its private-tier Heroku Postgres or Heroku Redis during deploy and build but the app reports errors like
ETIMEDOUT and can not connect to the private datastore.
Builds for private space apps are run on build dynos that are provisioned outside of Private spaces. This makes it impossible to reach the Private datastore protected inside the Private Space while the app is being built and deployed.
If possible, eliminate the dependency on your private datastore during build time or use a datastore in Common Runtime. It maybe possible to make use of Release Phase to run tasks like database migrations on a one-off dyno in the Private Space after the build but before the deploy.
Otherwise, Pipelines maybe of your help:
- Create a pipeline and create a Common Runtime app in staging with public datastores
- Add the Private Space app in production
- Deploy to staging
- Promote the staging app to production
When using pipelines, as we are promoting the application from staging to production, the build process doesn't trigger again for the production app and only the slug gets promoted and released.
A customer using ActiveAdmin for Ruby on Rails reported that dependency to the database in the build phase could be eliminated with preventing to load the routes while being build:
ActiveAdmin.routes(self) unless ARGV.grep(/assets:precompile|assets:clean/).any?