Avoid waiting for a postgresql which won't exist when this container is deployed
This commit is contained in:
parent
55e79bd9bf
commit
a544668b53
|
@ -12,11 +12,12 @@ services:
|
|||
image: jenkinsciinfra/evergreen-backend
|
||||
build: ./services
|
||||
environment:
|
||||
- 'POSTGRES_PASSWORD=grassisevergreener'
|
||||
- 'PGPASSWORD=grassisevergreener'
|
||||
ports:
|
||||
- '3030:3030'
|
||||
depends_on:
|
||||
- db
|
||||
command: ['wait-for-postgres.sh', "db", "5432", "/usr/local/bin/npm", "run", "start"]
|
||||
|
||||
instance:
|
||||
image: jenkins/evergreen
|
||||
|
|
|
@ -27,4 +27,4 @@ COPY wait-for-postgres.sh /wait-for-postgres.sh
|
|||
RUN chmod a+x /wait-for-postgres.sh
|
||||
|
||||
RUN apk add --update-cache postgresql-client
|
||||
CMD ["/wait-for-postgres.sh", "db", "5432", "/usr/local/bin/npm", "run", "start"]
|
||||
CMD npm run start
|
||||
|
|
|
@ -15,7 +15,7 @@ cmd="$@"
|
|||
|
||||
maxAttempts=10
|
||||
|
||||
until PGPASSWORD=$POSTGRES_PASSWORD psql -h "$host" -p "$port" -U "postgres" -c '\q'; do
|
||||
until psql -h "$host" -p "$port" -U "postgres" -c '\q'; do
|
||||
maxAttempts=$(( $maxAttempts - 1 ))
|
||||
if [[ $maxAttempts <= 0 ]]; then
|
||||
>&2 echo "Maximum number of attempts reached: exitting"
|
||||
|
|
Loading…
Reference in New Issue