Skip to content

Homestead PostgreSQL cant connect out the box from remote/host machine #11339

@JFossey

Description

@JFossey

Problem

On a new setup of Homestead you get an error connecting remotely to VM via GUi Tools like pgAdmin3 and the Latest HeidiSQL (experimental).

Connecting VIA localhost in a Shell works.

Error:

homestead@postgres FATAL: no pg_hba.conf entry for host "192.168.10.1", user "homestead", database "postgres", SSL on
homestead@postgres FATAL: no pg_hba.conf entry for host "192.168.10.1", user "homestead", database "postgres", SSL off

Workaround:

Add the following to after.sh, based on code found in settler.

if [ ! -f ~/.homestead_post_install_customisations ]; then
    # Add one time setup customisation    
    echo "installing setup customisations"

    echo "host    all             all             0.0.0.0/0                md5" | tee -a /etc/postgresql/9.4/main/pg_hba.conf
    sudo /etc/init.d/postgresql reload
    # service postgresql restart

    touch ~/.homestead_post_install_customisations
else    
    # Add setup constomisation that should run with each reload/provision
    echo "installing reload/provisioning customisations"    
fi

Suggested Fix

Add "host all all 0.0.0.0/0 md5" to pg_hba.conf out the box on new setups providing remote access to PostgreSQL databases.

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