Issue with External Postgresql DB


We are trying to setup gitlab on a redhat vm but due to some reasons we can’t keep the metadata and files on that vm. We have successfully mounted a windows filesystem and have all the repository files directed there but for some reason we can’t get the postgresql DB to work. We have setup the postgresql DB on another windows machine, remote connections are allowed and I can connect to it from my laptop. Despite that gitlab can’t connect to it, our gitlab.rb for the db section is:

gitlab_rails['db_adapter'] = 'postgresql'
gitlab_rails['db_encoding'] = 'unicode'
gitlab_rails['db_database'] = 'gitlabhq_production'
gitlab_rails['db_pool'] = 10
gitlab_rails['db_username'] = 'postgres'
gitlab_rails['db_password'] = '<password>'
gitlab_rails['db_host'] = '<ip>'
gitlab_rails['db_port'] = 5432

When I run:

sudo gitlab-rake gitlab:setup

I get an error:

Could not connect to server: Connection timed out

If I do an nmap to the ip and port I am trying to connect to from the redhat vm I can see that postgresql is listening on that port. Why Can’t it connect, there is no issue with ping or anything else, what could be causing this?

Thank you.