Skip to content

Docker: Haven attempts to create database every time instead of recognizing it already exists #182

Description

@guidopetri

I've been running Haven via docker/docker compose for a few months now. Whenever I bring down the image with docker compose down, then back up with docker compose up -d, it appears that Haven tries to create the database in HAVEN_DB_NAME manually instead of recognizing that it already exists:

[...]
connection to server at "<redacted>", port 5432 failed: FATAL:  no pg_hba.conf entry for host "<redacted>", user "<redacted>", database "postgres", no encryption
Couldn't create '<redacted>' database. Please check your configuration.
bin/rails aborted!
ActiveRecord::ConnectionNotEstablished: connection to server at "<redacted>", port 5432 failed: FATAL:  no pg_hba.conf entry for host "<redacted>", user "<redacted>", database "postgres", no encryption (ActiveRecord::Connec
tionNotEstablished)
/app/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.5.2/lib/active_record/connection_adapters/postgresql_adapter.rb:72:in `rescue in new_client'
/app/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.5.2/lib/active_record/connection_adapters/postgresql_adapter.rb:68:in `new_client'
/app/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.5.2/lib/active_record/connection_adapters/postgresql_adapter.rb:980:in `connect'
[...]

This is somewhat confusing especially since it takes a few minutes for Haven to start up, and when examining the logs this is the first thing I see and thus try to fix. However, it seems that Haven is able to just ignore the error and carry on with startup.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions