Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,558,746
Community Members
 
Community Events
184
Community Groups

Unale to setup bitbucket server with Postgres

Edited

Hi,

I am trying to setup Bitbucket with PostGres.

Unfortunately, I have a connection error at the beginning

"""

The configuration entered is not valid. A database connection could not be established. Please check your configuration and try again.
	com.atlassian.stash.internal.db.DefaultDatabaseManager.validateConfiguration(DefaultDatabaseManager.java:217)
	com.atlassian.stash.internal.db.DefaultDatabaseManager.prepareDatabase(DefaultDatabaseManager.java:183)
	com.atlassian.stash.internal.maintenance.SpringMaintenanceTaskFactory.setupTask(SpringMaintenanceTaskFactory.java:151)
	...
Failed to obtain JDBC Connection; nested exception is org.postgresql.util.PSQLException: Connection to 192.168.1.29:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
	org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:82)
	com.atlassian.stash.internal.db.DefaultDatabaseValidator.validate(DefaultDatabaseValidator.java:43)
	com.atlassian.stash.internal.db.DefaultDatabaseManager.validateConfiguration(DefaultDatabaseManager.java:214)
	...
Connection to 192.168.1.29:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
	org.postgresql.Driver$ConnectThread.getResult(Driver.java:405)
	org.postgresql.Driver.connect(Driver.java:263)
	java.sql.DriverManager.getConnection(DriverManager.java:664)
"""

I am installing Bitbucket Server (7.3) (via Docker) under MacOs.
I have followed the step for PostGres installation. PostGres is fine (I can manage it with pgAdmin)
I am new to PostGres and Docker.
Thanks for your help

1 answer

1 accepted

2 votes
Answer accepted
Alexis Robert
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Jun 09, 2020

Hi @MARTIN Régis , 

 

the error is because of connectivity issues to your database : 

Connection to 192.168.1.29:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.

There is probably a setting to change in pg_hba.conf as explained here in the paragraph Create the Bitbucket Server database : https://confluence.atlassian.com/bitbucketserver/connecting-bitbucket-server-to-postgresql-776640389.html

This specific KB explains what to do : https://confluence.atlassian.com/bitbucketserverkb/bitbucket-is-unable-to-connect-to-postgresql-due-to-unconfigured-pg_hba-conf-file-969533185.html

 

Let me know if this helps, 

 

--Alexis

Thanks for your help.

It is indeed, a connectivity issue, which is solved by using host.docker.internal a hostname.

See https://stackoverflow.com/questions/24319662/from-inside-of-a-docker-container-how-do-i-connect-to-the-localhost-of-the-mach 

To setup connection to database n my case the pg_hba.conf file contained this row:

host    all         all         127.0.0.1/32          ident

which I had to change to:

host    all         all         127.0.0.1/32          md5

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
AUG Leaders

Atlassian Community Events