Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
moqui
/
k8s-moqui
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
2503bedb
authored
2022-10-21 13:02:24 -0500
by
Adam Heath
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Add user authentication checking to pg_isready.
1 parent
1f59c12f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
5 deletions
charts/postgresql/pg_isready
helmfile.yaml
charts/postgresql/pg_isready
View file @
2503bed
#!/bin/sh
set
-ex
# POSTGRES_HOST
# POSTGRES_USER
# POSTGRES_DATABASE
# PGPASSWORD
check_pg
()
{
pg_isready -h
"
${
POSTGRES_HOST
}
"
-U
"
${
POSTGRES_USER
}
"
-p 5432
pg_isready -h
"
${
POSTGRES_HOST
}
"
-U
"
${
POSTGRES_USER
}
"
}
check_auth
()
{
psql -h
"
${
POSTGRES_HOST
}
"
-U
"
${
POSTGRES_USER
}
"
"
${
POSTGRES_DATABASE
}
"
}
while
! check_pg;
do
echo
"Waiting for database"
1>&2
loop
()
{
checker
=
"
$1
"
message
=
"
$2
"
while
!
$checker
;
do
echo
"
$message
"
1>&2
sleep 1
count
=
5
while
[
$count
-gt 0
]
&&
! check_pg
;
do
while
[
$count
-gt 0
]
&&
!
$checker
;
do
count
=
$((
$count
-
1
))
sleep 1
done
done
done
}
loop check_pg
"Waiting for database to be up"
loop check_auth
"Waiting for user+password to be active"
...
...
helmfile.yaml
View file @
2503bed
...
...
@@ -113,6 +113,8 @@ releases:
-
name
:
postgresql-scripts
mountPath
:
/postgresql-scripts
env
:
-
name
:
POSTGRES_DATABASE
value
:
moqui
-
name
:
POSTGRES_HOST
value
:
{{
.Values.name
}}
-moqui-postgresql
-
name
:
POSTGRES_USER
...
...
@@ -120,6 +122,11 @@ releases:
secretKeyRef
:
name
:
moqui.{{ .Values.name }}-moqui-postgresql.credentials.postgresql.acid.zalan.do
key
:
username
-
name
:
PGPASSWORD
valueFrom
:
secretKeyRef
:
name
:
moqui.{{ .Values.name }}-moqui-postgresql.credentials.postgresql.acid.zalan.do
key
:
password
{{
- end
}}
{{
- if .Values.elasticsearch.enabled
}}
-
op
:
add
...
...
Please
register
or
sign in
to post a comment