Question

Does App Platform build live in trusted sources?

I’m setting up a ruby on rails application and the build step is timing out trying to get a DB connection even though I’ve setup the app as a trusted source:

[2023-01-20 16:27:24] │        ####################################################
[2023-01-20 16:27:25] │        Bundle completed (21.69s)
[2023-01-20 16:27:25] │        Cleaning up the bundler cache.
[2023-01-20 16:27:25] │        Removing bundler (2.3.10)
[2023-01-20 16:27:25] │ -----> Detecting rake tasks
[2023-01-20 16:27:28] │ -----> Preparing app for Rails asset pipeline
[2023-01-20 16:27:28] │        Running: rake assets:precompile
[2023-01-20 16:29:41] │        rake aborted!
[2023-01-20 16:29:41] │        ActiveRecord::ConnectionNotEstablished: connection to server at "165.***.***.***", port ***** failed: Connection timed out
[2023-01-20 16:29:41] │         Is the server running on that host and accepting TCP/IP connections?
[2023-01-20 16:29:41] │        /layers/heroku_ruby/gems/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/connection_adapters/postgresql_adapter.rb:87:in `rescue in new_client'
<SNIP>
[2023-01-20 16:29:41] │        Tasks: TOP => environment
[2023-01-20 16:29:41] │        (See full trace by running task with --trace)
[2023-01-20 16:29:41] │        I, [2023-01-20T16:29:41.407944 #1503]  INFO -- sentry: [Transport] Sending envelope with items [event] 5df24248a8074781a96fae3a9ff43178 to Sentry
[2023-01-20 16:29:41] │ 
[2023-01-20 16:29:41] │  !
[2023-01-20 16:29:41] │  !     Precompiling assets failed.
[2023-01-20 16:29:41] │  !
[2023-01-20 16:29:41] │ ERROR: failed to build: exit status 1
[2023-01-20 16:29:41] │ 
[2023-01-20 16:29:41] │ 
[2023-01-20 16:29:41] │ For documentation on the buildpacks used to build your app, please see:
[2023-01-20 16:29:41] │ 
[2023-01-20 16:29:41] │    Ruby  v1.244.3  https://do.co/apps-buildpack-ruby
[2023-01-20 16:29:41] │ 
[2023-01-20 16:29:41] │  ✘ build failed

I have verified I can connect to the database from my home when adding my home IP to the trusted sources:

DB Trusted Sources
db trusted sources

Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
January 21, 2023

Hi there,

Indeed you are correct. During the build process your app would not have access to the Managed Database cluster in case that you have the trusted sources enabled. What I would suggest is that if you have a migrations step, you could move that step from the build process to the deploy process.

The benefit of doing this is that, if your build is successful and the changes to the database are executed, but the deployment fails, then you might end up with the new database schema but with your old codebase which might not be backwards compatible.

Let me know how it goes!

Best,

Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

card icon
Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Sign up
card icon
Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We’d like to help.

Learn more
card icon
Become a contributor

You get paid; we donate to tech nonprofits.

Learn more
Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow – whether you’re running one virtual machine or ten thousand.

Learn more ->
DigitalOcean Cloud Control Panel