wait-for-db init container waits for local postgres database, even when postgres: enabled: false
Closed this issue · 3 comments
fredsmith commented
My API container is in a CrashLoopBackOff when I use this chart to deploy with an external postgres DB.
The values in my helm config include:
postgresql:
enabled: false
databaseExternal:
enabled: true
type: postgres
host: redacted.us-east-1.rds.amazonaws.com
port: "5432"
database: flagsmith
username: postgres
password: REDACTED
$ k get pods
NAME READY STATUS RESTARTS AGE
flagsmith-7cf74cb7cf-ccv4x 1/1 Running 0 2m
flagsmith-api-6c9959c65c-4n49k 0/1 Init:CrashLoopBackOff 2 2m
flagsmith-influxdb-0 1/1 Running 0 2m
$ k logs flagsmith-api-6c9959c65c-4n49k -c wait-for-db
wait-for-it.sh: waiting 30 seconds for flagsmith-flagsmith-postgresql.flagsmith.svc.cluster.local:5432
wait-for-it.sh: timeout occurred after waiting 30 seconds for flagsmith-flagsmith-postgresql.flagsmith.svc.cluster.local:5432
When I set postgresql: enabled: true
the api launches and properly connects to my configured DB.
dabeeeenster commented
Hi @fredsmith - thanks for this report - we'll get someone to take a look.
fredsmith commented
Some details on the app as it's running ( postgresql: enabled: true)
$ k -n flagsmith exec --stdin --tty flagsmith-api-58d89b4b56-gw2kl -- /bin/bash
Defaulted container "flagsmith-api" out of: flagsmith-api, wait-for-db (init), migrate-db (init)
root@flagsmith-api-58d89b4b56-gw2kl:/app# python src/manage.py shell
/app/src/app/settings/common.py:46: UserWarning: GOOGLE_SERVICE_ACCOUNT not configured, getting organisation usage will not work
warnings.warn(
/app/src/app/settings/common.py:51: UserWarning: GA_TABLE_ID not configured, getting organisation usage will not work
warnings.warn(
/app/src/app/settings/common.py:291: UserWarning: `SENDGRID_API_KEY` has not been configured. You will not receive emails.
warnings.warn(
Python 3.8.9 (default, Apr 2 2021, 21:49:23)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from django.conf import settings
>>> settings.DATABASES
{'default': {'NAME': 'flagsmith', 'USER': 'postgres', 'PASSWORD': 'REDACTED', 'HOST': 'REDACTED.us-east-1.rds.amazonaws.com', 'PORT': 5432, 'CONN_MAX_AGE': 60, 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'ATOMIC_REQUESTS': False, 'AUTOCOMMIT': True, 'OPTIONS': {}, 'TIME_ZONE': None, 'TEST': {'CHARSET': None, 'COLLATION': None, 'NAME': None, 'MIRROR': None}}}
So the api container is able to connect to the database, but at the moment the deployment config still looks like this:
$ k get deployment -n flagsmith flagsmith-api -oyaml | grep -A 4 wait-for-it
- /wait-for-it.sh
- --host=flagsmith-flagsmith-postgresql.flagsmith.svc.cluster.local
- --port=5432
- --timeout=30
image: willwill/wait-for-it:latest
imagePullPolicy: IfNotPresent
name: wait-for-db
resources: {}
terminationMessagePath: /dev/termination-log
dabeeeenster commented
This should be fixed in #35 - @fredsmith are you able to confirm this solves the issue?