deploying sinatra project with postgres backend can't find postgres
thekeyunlocks
PROOP

3 months ago

Running rake db:create and migrate (within setup) during the build phase doesn't work for the internal DATABASE_URL provided by the hosted postgres service.

bundle install && bundle exec rake db:setup Don't run Bundler as root. Installing your bundle as root will break this application for all non-root users on this machine. Bundle complete! 12 Gemfile dependencies, 34 gems now installed. Use bundle info [gemname] to see where a bundled gem is installed. 2 installed gems you directly depend on are looking for funding. Run bundle fund for details rake aborted! Sequel::DatabaseConnectionError: PG::ConnectionBad: could not translate host name "postgres.railway.internal" to address: Name or service not known (Sequel::DatabaseConnectionError) /usr/local/bundle/gems/pg-1.6.2-x86_64-linux/lib/pg/connection.rb:944:in 'PG::Connection.connect_start' /usr/local/bundle/gems/pg-1.6.2-x86_64-linux/lib/pg/connection.rb:944:in 'PG::Connection.connect_to_hosts' /usr/local/bundle/gems/pg-1.6.2-x86_64-linux/lib/pg/connection.rb:871:in 'PG::Connection.new' /usr/local/bundle/gems/sequel-5.99.0/lib/sequel/adapters/postgres.rb:231:in 'Sequel::Postgres::Database#connect' /usr/local/bundle/gems/sequel-5.99.0/lib/sequel/database/connecting.rb:245:in 'Sequel::Database#new_connection' /usr/local/bundle/gems/sequel-5.99.0/lib/sequel/connection_pool.rb:163:in 'Sequel::ConnectionPool#make_new' /usr/local/bundle/gems/sequel-5.99.0/lib/sequel/connection_pool/timed_queue.rb:134:in...

Solved$10 Bounty

Pinned Solution

IIRC access to other services aren’t available during build time. You can add a custom predeploy command that does your db migration in service settings.

2 Replies

thekeyunlocks
PROOP

3 months ago

moving the db create/migrate to the start command seems to work, but not sure if this is the right way to do it.


3 months ago

This thread has been marked as public for community involvement, as it does not contain any sensitive or personal information. Any further activity in this thread will be visible to everyone.

Status changed to Open brody 3 months ago


IIRC access to other services aren’t available during build time. You can add a custom predeploy command that does your db migration in service settings.


Status changed to Solved brody 3 months ago


Loading...