It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Recover from missing database connection at startup

I just realized recovering from a lost database connection does not work when there was no database connection during startup at all. It will stuck in the Confluence had problems starting up page forever.

Is there a Confluence way to self heal this situation? Or at least an option such that Confluence will restart in that situation? That would already fix the problem.

FYI: I am running Confluence on a QNAP NAS through Container Station using the official latest docker image (which works great btw). Each time I boot my NAS, postgres will be available about 3 minutes after Confluence already started and therefore fails to start. Postgres runs through a different platform, so there is no elegant way to bound their lifecycles together. Anyway, a Confluence solution would be the robust way, anyway. 

2 answers

1 accepted

0 votes
Answer accepted

Hi Daniel,

thank you for your help. I did a bit of a research especially for the delay approach and found a life hack more than enough for my home deployment. It's quite robust and based on delays, restarts and checking the database TCP port to respond until Confluence will be started.

In a linux environment tools like netcat and the so-called wait-for-it script (on github) are really helpful. The latter one is also recommended by docker. I've just placed that script into the confluence home folder to survive container updates, together with a start script and created a docker-compose yaml file.

For those few (or many?) people that run Confluence on a QNAP through Container-Station like me: you can create the yaml files through ContainerStation > Create > Create Application.

docker compose yaml:

version: '3'

image: atlassian/confluence-server:latest
- 32769:8090
- /share/Container/container-station-data/application/confluence-server/:/var/atlassian/application-data/confluence/
command: ["/var/atlassian/application-data/confluence/", "nas:5432", "-s", "--timeout=0", "--", "/var/atlassian/application-data/confluence/"]
condition: always
delay: 5s

sleep 30



Hi Christian,

welcome to Atlassian Community!

During startup Confluence expects the database to be there and ready. Your setup is valid (thanks for explaining!) but, I assume, when the application was designed such a scenario was not considered.

Two possibilities which come to mind are:

  1. check if Confluence is in the state of an error presenting the page "had problems starting up" and restart it if it is the case. To my knowledge there is no ready-made solution - you would have to code this yourself.
  2. delay the Confluence startup for the time you know the database is needing to come up.

Please keep in mind there are only two theories of somewhat 'lifehack fixes' - in a data center-like scenario such workarounds are rarely needed :) Maybe you could put the database on a host where it comes alive faster.


Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Confluence

Lessons and Learnings: Six Months of Working Remote [Discussion]

Hey there, folks! For most of us, the past six months- yes, you read that right- have been a journey. More people than ever before have pivoted to working remotely, and navigating being on-scre...

8,368 views 6 6
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you