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

geoserver: wait for DB and DB user to be available #4

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 23 additions & 4 deletions charts/geonode/templates/geoserver/geoserver-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,29 @@ spec:
- name: {{ .Values.geoserver.init.container_name }}
image: "{{ .Values.geoserver.init.image.name }}:{{ .Values.geoserver.init.image.tag }}"
imagePullPolicy: {{ .Values.geoserver.init.imagePullPolicy }}
args:
- -timeout=60s
- -wait
- tcp://{{ include "database_hostname" . }}:{{ include "database_port" . }}
envFrom:
- configMapRef:
name: {{ include "geoserver_pod_name" . }}-env
env:
# read auto generated password from secret
- name: GEONODE_GEODATABASE_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "database_geodata_password_secret_key_ref" . }}
key: {{ include "database_geodata_password_key_ref" . }}
- name: GEODATABASE_URL
value: "postgres://$(GEONODE_GEODATABASE):$(GEONODE_GEODATABASE_PASSWORD)@$(DATABASE_HOST):$(DATABASE_PORT)/$(GEONODE_GEODATABASE)"
command:
- sh
- -c
- |
printf "INFO: waiting for successful connection to %s\n" "$DATABASE_HOST"
until psql "$GEODATABASE_URL" -c '\q'
do
printf "INFO: trying connecting to DB...\n"
sleep 2
done
printf "INFO: psql succeeded. exiting\n"

{{- if not (empty .Values.geoserver.imagePullSecret) }}
imagePullSecrets:
Expand Down
4 changes: 2 additions & 2 deletions charts/geonode/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -348,9 +348,9 @@ geoserver:
container_name: geoserver-wait-for-db
image:
# init container image
name: jwilder/dockerize
name: governmentpaas/psql
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we use an official image instead?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wish, but which image is an official image with just psql? I don't want a big image just for psql.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use the big image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

evantually the same used by the zalando cluster if available in the values file

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. My latest commit uses postgres:16-alpine.

# init container image tag
tag: "0.6.1"
tag: "272908a4012b68c01301d9af9270d3fdf2b1d978"
# init container image pull policy
imagePullPolicy: "IfNotPresent"

Expand Down