Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for initContainers to wait for database startup #18

Closed
Sonny78 opened this issue Oct 7, 2021 · 2 comments
Closed

Support for initContainers to wait for database startup #18

Sonny78 opened this issue Oct 7, 2021 · 2 comments
Labels

Comments

@Sonny78
Copy link

Sonny78 commented Oct 7, 2021

On first installing my resources I get sometimes the following exception in my camunda pod:

06-Oct-2021 14:21:56.462 SEVERE [main] org.postgresql.Driver.connect Connection error: 
	org.postgresql.util.PSQLException: FATAL: the database system is starting up

or even:

7-Oct-2021 09:58:29.075 SEVERE [main] org.postgresql.Driver.connect Connection error: 
	org.postgresql.util.PSQLException: Connection to db-cluster:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
		at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:265)
		at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49)

To avoid this I want to use initcontainers, which wait until the service and database are started.

initContainers:
  - name: check-db-service-available
    image: busybox:1.34.0
    command: ['sh', '-c', 
      'until nslookup db-cluster; 
      do echo waiting for db-cluster; sleep 2; done; 
      echo db service found;']
  - name: check-db-ready
    image: postgres:13.4
    command: ['sh', '-c', 
    'until pg_isready -h db-cluster -d processEngine -p 5432; 
      do echo waiting for database; sleep 2; done; 
      echo database is ready']

Does this make sense for you? I tried it directly with the yaml files without using the helm chart and it worked quite well. But of cause I want rather to use your helm charts.

Perhaps it could be an option to include something like this in the development yaml:

{{- if .Values.initContainers }}
  {{- toYaml .Values.initContainers | nindent 6 }}
{{- end }}

So that I will be able to define my initContainers in the values file

@aabouzaid
Copy link
Collaborator

@Sonny78 Thanks for your suggestion 👏

In v1.3.0 it's possible to define any initContainers.

@Sonny78
Copy link
Author

Sonny78 commented Oct 11, 2021

Thanks, works fine.

@Sonny78 Sonny78 closed this as completed Oct 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants