angristan / feedbin-docker

Self-host your own Feedbin RSS reader in Docker
MIT License
251 stars 35 forks source link

NoDatabaseError: could not translate host name "feedbin-postgres" to address #49

Closed max-schroeder closed 3 years ago

max-schroeder commented 3 years ago

Hi, I tried to follow the setup instructions. When running docker-compose run --rm feedbin-web rake db:setup --trace the following error occurs:

I, [2021-02-28T23:48:34.804083 #1]  INFO -- honeybadger: ** [Honeybadger] Initializing Honeybadger Error Tracker for Ruby. Ship it! version=4.7.2 framework=rails level=1 pid=1
** Invoke db:setup (first_time)
** Invoke db:schema:load_if_ruby (first_time)
** Invoke db:create (first_time)
** Invoke db:load_config (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:load_config
** Execute db:create
could not translate host name "feedbin-postgres" to address: Name or service not known
Couldn't create 'feedbin_production' database. Please check your configuration.
E, [2021-02-28T23:48:35.118691 #1] ERROR -- honeybadger: ** [Honeybadger] Unable to send error report: API key is missing. id=7bd6ec17-0599-46ad-ba95-4636898d30a0 level=3 pid=1
rake aborted!
ActiveRecord::NoDatabaseError: could not translate host name "feedbin-postgres" to address: Name or service not known
/usr/local/bundle/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql_adapter.rb:50:in `rescue in postgresql_connection'
/usr/local/bundle/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql_adapter.rb:33:in `postgresql_connection'
/usr/local/bundle/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:887:in `new_connection'
/usr/local/bundle/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:931:in `checkout_new_connection'
/usr/local/bundle/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:910:in `try_to_checkout_new_connection'
/usr/local/bundle/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:871:in `acquire_connection'
/usr/local/bundle/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:593:in `checkout'
/usr/local/bundle/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:437:in `connection'
/usr/local/bundle/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:1119:in `retrieve_connection'
/usr/local/bundle/gems/activerecord-6.0.3.4/lib/active_record/connection_handling.rb:221:in `retrieve_connection'
/usr/local/bundle/gems/activerecord-6.0.3.4/lib/active_record/connection_handling.rb:189:in `connection'
/usr/local/bundle/gems/activerecord-6.0.3.4/lib/active_record/tasks/postgresql_database_tasks.rb:12:in `connection'
/usr/local/bundle/gems/activerecord-6.0.3.4/lib/active_record/tasks/postgresql_database_tasks.rb:21:in `create'
/usr/local/bundle/gems/activerecord-6.0.3.4/lib/active_record/tasks/database_tasks.rb:126:in `create'
/usr/local/bundle/gems/activerecord-6.0.3.4/lib/active_record/tasks/database_tasks.rb:185:in `block in create_current'
/usr/local/bundle/gems/activerecord-6.0.3.4/lib/active_record/tasks/database_tasks.rb:479:in `block (2 levels) in each_current_configuration'
/usr/local/bundle/gems/activerecord-6.0.3.4/lib/active_record/tasks/database_tasks.rb:476:in `each'
/usr/local/bundle/gems/activerecord-6.0.3.4/lib/active_record/tasks/database_tasks.rb:476:in `block in each_current_configuration'
/usr/local/bundle/gems/activerecord-6.0.3.4/lib/active_record/tasks/database_tasks.rb:475:in `each'
/usr/local/bundle/gems/activerecord-6.0.3.4/lib/active_record/tasks/database_tasks.rb:475:in `each_current_configuration'
/usr/local/bundle/gems/activerecord-6.0.3.4/lib/active_record/tasks/database_tasks.rb:184:in `create_current'
/usr/local/bundle/gems/activerecord-6.0.3.4/lib/active_record/railties/databases.rake:39:in `block (2 levels) in <main>'
/usr/local/bundle/gems/rake-13.0.3/lib/rake/task.rb:281:in `block in execute'
/usr/local/bundle/gems/rake-13.0.3/lib/rake/task.rb:281:in `each'
/usr/local/bundle/gems/rake-13.0.3/lib/rake/task.rb:281:in `execute'
/usr/local/bundle/gems/rake-13.0.3/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
/usr/local/lib/ruby/2.6.0/monitor.rb:235:in `mon_synchronize'
/usr/local/bundle/gems/rake-13.0.3/lib/rake/task.rb:199:in `invoke_with_call_chain'
/usr/local/bundle/gems/rake-13.0.3/lib/rake/task.rb:243:in `block in invoke_prerequisites'
/usr/local/bundle/gems/rake-13.0.3/lib/rake/task.rb:241:in `each'
/usr/local/bundle/gems/rake-13.0.3/lib/rake/task.rb:241:in `invoke_prerequisites'
/usr/local/bundle/gems/rake-13.0.3/lib/rake/task.rb:218:in `block in invoke_with_call_chain'
/usr/local/lib/ruby/2.6.0/monitor.rb:235:in `mon_synchronize'
/usr/local/bundle/gems/rake-13.0.3/lib/rake/task.rb:199:in `invoke_with_call_chain'
/usr/local/bundle/gems/rake-13.0.3/lib/rake/task.rb:243:in `block in invoke_prerequisites'
/usr/local/bundle/gems/rake-13.0.3/lib/rake/task.rb:241:in `each'
/usr/local/bundle/gems/rake-13.0.3/lib/rake/task.rb:241:in `invoke_prerequisites'
/usr/local/bundle/gems/rake-13.0.3/lib/rake/task.rb:218:in `block in invoke_with_call_chain'
/usr/local/lib/ruby/2.6.0/monitor.rb:235:in `mon_synchronize'
/usr/local/bundle/gems/rake-13.0.3/lib/rake/task.rb:199:in `invoke_with_call_chain'
/usr/local/bundle/gems/rake-13.0.3/lib/rake/task.rb:188:in `invoke'
/usr/local/bundle/gems/rake-13.0.3/lib/rake/application.rb:160:in `invoke_task'
/usr/local/bundle/gems/rake-13.0.3/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/usr/local/bundle/gems/rake-13.0.3/lib/rake/application.rb:116:in `each'
/usr/local/bundle/gems/rake-13.0.3/lib/rake/application.rb:116:in `block in top_level'
/usr/local/bundle/gems/rake-13.0.3/lib/rake/application.rb:125:in `run_with_threads'
/usr/local/bundle/gems/rake-13.0.3/lib/rake/application.rb:110:in `top_level'
/usr/local/bundle/gems/rake-13.0.3/lib/rake/application.rb:83:in `block in run'
/usr/local/bundle/gems/rake-13.0.3/lib/rake/application.rb:186:in `standard_exception_handling'
/usr/local/bundle/gems/rake-13.0.3/lib/rake/application.rb:80:in `run'
/usr/local/bundle/gems/rake-13.0.3/exe/rake:27:in `<top (required)>'
/usr/local/bundle/bin/rake:23:in `load'
/usr/local/bundle/bin/rake:23:in `<main>'

Caused by:
PG::ConnectionBad: could not translate host name "feedbin-postgres" to address: Name or service not known
/usr/local/bundle/gems/pg-1.2.3/lib/pg.rb:58:in `initialize'
/usr/local/bundle/gems/pg-1.2.3/lib/pg.rb:58:in `new'
/usr/local/bundle/gems/pg-1.2.3/lib/pg.rb:58:in `connect'
/usr/local/bundle/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql_adapter.rb:46:in `postgresql_connection'
/usr/local/bundle/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:887:in `new_connection'
/usr/local/bundle/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:931:in `checkout_new_connection'
/usr/local/bundle/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:910:in `try_to_checkout_new_connection'
/usr/local/bundle/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:871:in `acquire_connection'
/usr/local/bundle/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:593:in `checkout'
/usr/local/bundle/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:437:in `connection'
/usr/local/bundle/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:1119:in `retrieve_connection'
/usr/local/bundle/gems/activerecord-6.0.3.4/lib/active_record/connection_handling.rb:221:in `retrieve_connection'
/usr/local/bundle/gems/activerecord-6.0.3.4/lib/active_record/connection_handling.rb:189:in `connection'
/usr/local/bundle/gems/activerecord-6.0.3.4/lib/active_record/tasks/postgresql_database_tasks.rb:12:in `connection'
/usr/local/bundle/gems/activerecord-6.0.3.4/lib/active_record/tasks/postgresql_database_tasks.rb:21:in `create'
/usr/local/bundle/gems/activerecord-6.0.3.4/lib/active_record/tasks/database_tasks.rb:126:in `create'
/usr/local/bundle/gems/activerecord-6.0.3.4/lib/active_record/tasks/database_tasks.rb:185:in `block in create_current'
/usr/local/bundle/gems/activerecord-6.0.3.4/lib/active_record/tasks/database_tasks.rb:479:in `block (2 levels) in each_current_configuration'
/usr/local/bundle/gems/activerecord-6.0.3.4/lib/active_record/tasks/database_tasks.rb:476:in `each'
/usr/local/bundle/gems/activerecord-6.0.3.4/lib/active_record/tasks/database_tasks.rb:476:in `block in each_current_configuration'
/usr/local/bundle/gems/activerecord-6.0.3.4/lib/active_record/tasks/database_tasks.rb:475:in `each'
/usr/local/bundle/gems/activerecord-6.0.3.4/lib/active_record/tasks/database_tasks.rb:475:in `each_current_configuration'
/usr/local/bundle/gems/activerecord-6.0.3.4/lib/active_record/tasks/database_tasks.rb:184:in `create_current'
/usr/local/bundle/gems/activerecord-6.0.3.4/lib/active_record/railties/databases.rake:39:in `block (2 levels) in <main>'
/usr/local/bundle/gems/rake-13.0.3/lib/rake/task.rb:281:in `block in execute'
/usr/local/bundle/gems/rake-13.0.3/lib/rake/task.rb:281:in `each'
/usr/local/bundle/gems/rake-13.0.3/lib/rake/task.rb:281:in `execute'
/usr/local/bundle/gems/rake-13.0.3/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
/usr/local/lib/ruby/2.6.0/monitor.rb:235:in `mon_synchronize'
/usr/local/bundle/gems/rake-13.0.3/lib/rake/task.rb:199:in `invoke_with_call_chain'
/usr/local/bundle/gems/rake-13.0.3/lib/rake/task.rb:243:in `block in invoke_prerequisites'
/usr/local/bundle/gems/rake-13.0.3/lib/rake/task.rb:241:in `each'
/usr/local/bundle/gems/rake-13.0.3/lib/rake/task.rb:241:in `invoke_prerequisites'
/usr/local/bundle/gems/rake-13.0.3/lib/rake/task.rb:218:in `block in invoke_with_call_chain'
/usr/local/lib/ruby/2.6.0/monitor.rb:235:in `mon_synchronize'
/usr/local/bundle/gems/rake-13.0.3/lib/rake/task.rb:199:in `invoke_with_call_chain'
/usr/local/bundle/gems/rake-13.0.3/lib/rake/task.rb:243:in `block in invoke_prerequisites'
/usr/local/bundle/gems/rake-13.0.3/lib/rake/task.rb:241:in `each'
/usr/local/bundle/gems/rake-13.0.3/lib/rake/task.rb:241:in `invoke_prerequisites'
/usr/local/bundle/gems/rake-13.0.3/lib/rake/task.rb:218:in `block in invoke_with_call_chain'
/usr/local/lib/ruby/2.6.0/monitor.rb:235:in `mon_synchronize'
/usr/local/bundle/gems/rake-13.0.3/lib/rake/task.rb:199:in `invoke_with_call_chain'
/usr/local/bundle/gems/rake-13.0.3/lib/rake/task.rb:188:in `invoke'
/usr/local/bundle/gems/rake-13.0.3/lib/rake/application.rb:160:in `invoke_task'
/usr/local/bundle/gems/rake-13.0.3/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/usr/local/bundle/gems/rake-13.0.3/lib/rake/application.rb:116:in `each'
/usr/local/bundle/gems/rake-13.0.3/lib/rake/application.rb:116:in `block in top_level'
/usr/local/bundle/gems/rake-13.0.3/lib/rake/application.rb:125:in `run_with_threads'
/usr/local/bundle/gems/rake-13.0.3/lib/rake/application.rb:110:in `top_level'
/usr/local/bundle/gems/rake-13.0.3/lib/rake/application.rb:83:in `block in run'
/usr/local/bundle/gems/rake-13.0.3/lib/rake/application.rb:186:in `standard_exception_handling'
/usr/local/bundle/gems/rake-13.0.3/lib/rake/application.rb:80:in `run'
/usr/local/bundle/gems/rake-13.0.3/exe/rake:27:in `<top (required)>'
/usr/local/bundle/bin/rake:23:in `load'
/usr/local/bundle/bin/rake:23:in `<main>'
Tasks: TOP => db:setup => db:schema:load_if_ruby => db:create

My .env looks like this:

# Minio
MINIO_ACCESS_KEY=password
MINIO_SECRET_KEY=password

# Caddy
CADDYPATH=/etc/ssl/caddy

# Camo
CAMO_HOST=https://camo.feedbin.domain.tld
CAMO_KEY=password

# Rails
RACK_ENV=production
RAILS_ENV=production
PORT=3000
SECRET_KEY_BASE=password
DEFAULT_URL_OPTIONS_HOST=feedbin.domain.tld
PUSH_URL=https://feedbin.domain.tld
FEEDBIN_URL=https://feedbin.domain.tld
FEEDBIN_HOST=feedbin.domain.tld
FORCE_SSL=false

# Databases
ELASTICSEARCH_URL=http://feedbin-elasticsearch:9200
MEMCACHED_HOSTS=feedbin-memcached:11211
REDIS_URL=redis://feedbin-redis:6379

POSTGRES=feedbin-postgres
POSTGRES_USERNAME=feedbin
POSTGRES_USER=feedbin
POSTGRES_PASSWORD=password
DATABASE_URL=postgres://feedbin:password@feedbin-postgres/feedbin_production

# S3
AWS_ACCESS_KEY_ID=password
AWS_SECRET_ACCESS_KEY=password
AWS_S3_BUCKET=feedbin
AWS_S3_BUCKET_FAVICONS=feedbin
AWS_S3_ENDPOINT=https://minio.feedbin.domain.tld
AWS_S3_PATH_STYLE="true"
ENTRY_IMAGE_HOST=minio.feedbin.domain.tld

# Extract service (needs to run behind HTTPS:443)
EXTRACT_HOST=extract.feedbin.domain.tld
EXTRACT_USER=username
EXTRACT_SECRET=secret

I also tried postgres and localhost instead of feedbin-postgres but that did not work either. Does anyone know how to resolve this issue?

qcasey commented 3 years ago

IIRC, I had to bring the containers up before running rake.

max-schroeder commented 3 years ago

@qcasey Thank you, that works!

angristan commented 3 years ago

Should be fixed with https://github.com/angristan/feedbin-docker/commit/d6f6c1962d0dae0d2b0b10d3142da80d01a6aede