Unleash / helm-charts

Contains helm-charts for Unleash
Apache License 2.0
41 stars 56 forks source link

Database environment variables are not picked up by unleash #61

Closed bobevenup closed 1 year ago

bobevenup commented 1 year ago

Describe the bug

I tried to get Unleash working with an external database, but unleash can not pick up the database config that i specified in the values file.

Steps to reproduce the bug

  1. my values.yaml file
    postgresql:
    enabled: false
    dbConfig:
    host: <my database IP address>
    pass: <my password>
    useExistingSecret:
      name: unleash-postgresql
      key: postgresql-password
  2. deploy the helm chart
  3. chart deploy successfully
  4. i check the unleash deployment YAML in kubernetes, it contains all the env vars that i specified
    spec:
    containers:
    - env:
    - name: POSTGRESQL_PASSWORD
      valueFrom:
        secretKeyRef:
          key: postgresql-password
          name: unleash-postgresql
    - name: DATABASE
      value: unleash
    - name: DATABASE_HOST
      value: <my database IP address>
    - name: DATABASE_PASS
      value: $(POSTGRESQL_PASSWORD)
    - name: DATABASE_PORT
      value: "5432"
    - name: DATABASE_USER
      value: unleash
    - name: DATABASE_SSL
      value: "false"
  5. but the pod failed to start, it keep throwing this error in the log
    
    [2023-01-06T07:39:19.911] [DEBUG] server-impl.js - DB migration: start
    [2023-01-06T07:39:20.008] [ERROR] server-impl.js - Failed to migrate db OperationalError: connect ECONNREFUSED 127.0.0.1:5432
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1159:16) {
    cause: Error: connect ECONNREFUSED 127.0.0.1:5432
      at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1159:16) {
    errno: -111,
    code: 'ECONNREFUSED',
    syscall: 'connect',
    address: '127.0.0.1',
    port: 5432
    },
    isOperational: true,
    errno: -111,
    code: 'ECONNREFUSED',
    syscall: 'connect',
    address: '127.0.0.1',
    port: 5432
    }
    [ERROR] Error: connect ECONNREFUSED 127.0.0.1:5432
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1159:16)
    Stream closed EOF for unleash/unleash-stage-6cb446fbc6-g4qh8 (unleash)


### Expected behavior

Unleash should pick up the database config from the specified environment variables

### Logs, error output, etc.

_No response_

### Screenshots

_No response_

### Additional context

_No response_

### Unleash version

4.19.1

### Subscription type

Open source

### Hosting type

Self-hosted

### SDK information (language and version)

_No response_
thomasheartman commented 1 year ago

Hey, @bobevenup 🙋🏼 Thanks for reporting this. It seems strange that it doesn't work.

That second code snippet you posted, is that copied (and scrubbed) from your actual config? I notice that it says DATABASE_PASS instead of DATABASE_PASSWORD. Could that be the issue at hand here?

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.