flipt icon indicating copy to clipboard operation
flipt copied to clipboard

Configuration with postgress not working

Open ognif opened this issue 3 years ago • 6 comments

I try to install Flipt with your helm charts. I put everything from your config site to the config.yaml.

apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "flipt.fullname" . }}
  labels:
    {{- include "flipt.labels" . | nindent 4 }}
data:
  config.yml: |
    cors:
      enabled: true

    log:
      level: ALL

    server:
      protocol: http
      host: 0.0.0.0
      http_port: 8080
      grpc_port: 18029

    meta:
      telemetry_enabled: false
      check_for_updates: false

    cache:
      memory:
        enabled: false

    db:
      url: 
      host: xxx.postgres.database.azure.com
      protocol: postgres
      name: flipt
      port: 5432
      user: xxx
      password: xxx

Flipt will not connect to the postgress database. Also inside the POD log there is not one line about the database used or connections issues or whatever. It looks like the settings get ignored.

If I start a flipt container on Azure and set Environmebt variables:

        environmentVariables:
          - name: FLIPT_DB_HOST
            value: xxx.postgres.database.azure.com
          - name: FLIPT_DB_PROTOCOL
            value: postgres
          - name: FLIPT_DB_NAME
            value: flipt
          - name: FLIPT_DB_PORT
            value: 5432
          - name: FLIPT_DB_USER
            value: xxx
          - name: FLIPT_DB_PASSWORD
            value: xxx
          - name: FLIPT_SERVER_GRPC_PORT
            value: 18029  

It works like a charme. What is the trick with an helm installation and config map?

Version Info

Run flipt --version and paste the output here:

To Reproduce

Expected Behavior

I expect that flipt use the config map that is installed and do not ignore it. I expect further, that a software will log anything about database

Examples:

  • OS: Linux
  • Config file: See above
  • Database used Postgress

ognif avatar Sep 19 '22 16:09 ognif

@ognif try removing url from the config .yaml

db:
      url: <--- remove this
      host: xxx.postgres.database.azure.com
      protocol: postgres
      name: flipt
      port: 5432
      user: xxx
      password: xxx

It should look like this:

      host: xxx.postgres.database.azure.com
      protocol: postgres
      name: flipt
      port: 5432
      user: xxx
      password: xxx

url takes precedence over host and port for the DB config: https://flipt.io/docs/configuration#database

Also ALL is not a valid log level, the valid log levels are trace, debug, info, warn, error, fatal, panic. https://flipt.io/docs/configuration#general

Try setting the log level to debug

markphelps avatar Sep 19 '22 17:09 markphelps

Also it seems you are using an out of date version. I would recommend upgrading to the latest release v1.11.0 if possible. I had to change the Docker repository namespace after 1.9.0 so you may need to update your helm chart to point to flipt/flipt:latest instead of markphelps/flipt:latest for it to find the newer versions.

markphelps avatar Sep 19 '22 17:09 markphelps

Thank you for your fast answer. I tried with removing url from config.yaml but no difference. The output of debug ist:


 _____ _ _       _
|  ___| (_)_ __ | |_
| |_  | | | '_ \| __|
|  _| | | | |_) | |_
|_|   |_|_| .__/ \__|
          |_|

Version: 1.11.0
Commit: 87330f68583f5a07110ffb63ac6144b8a39d042a
Build Date: 2022-09-12T14:02:49Z
Go Version: go1.18.6

You are currently running the latest version of Flipt [1.11.0]!

API: http://0.0.0.0:8080/api/v1
UI: http://0.0.0.0:8080

2022-09-19T17:36:39Z	[34mINFO[0m	finished unary call with code OK	{"server": "grpc", "grpc.start_time": "2022-09-19T17:36:39Z", "system": "grpc", "span.kind": "server", "grpc.service": "flipt.Flipt", "grpc.method": "ListFlags", "peer.address": "127.0.0.1:56076", "grpc.code": "OK", "grpc.time_ms": 0.391}

With successfull connected DB also no info about the database

 _____ _ _       _
|  ___| (_)_ __ | |_
| |_  | | | '_ \| __|
|  _| | | | |_) | |_
|_|   |_|_| .__/ \__|
          |_|

Version: 1.11.0
Commit: 87330f68583f5a07110ffb63ac6144b8a39d042a
Build Date: 2022-09-12T14:02:49Z
Go Version: go1.18.6

You are currently running the latest version of Flipt [1.11.0]!

API: http://0.0.0.0:8080/api/v1
UI: http://0.0.0.0:8080

2022-09-19T17:39:51Z	[34mINFO[0m	finished unary call with code OK	{"server": "grpc", "grpc.start_time": "2022-09-19T17:39:51Z", "system": "grpc", "span.kind": "server", "grpc.service": "flipt.Flipt", "grpc.method": "ListFlags", "peer.address": "127.0.0.1:35726", "grpc.code": "OK", "grpc.time_ms": 280.682}

next one I have set the FLIPT_LOG_LEVEL Environmentvar:


 _____ _ _       _
|  ___| (_)_ __ | |_
| |_  | | | '_ \| __|
|  _| | | | |_) | |_
|_|   |_|_| .__/ \__|
          |_|

Version: 1.11.0
Commit: 87330f68583f5a07110ffb63ac6144b8a39d042a
Build Date: 2022-09-12T14:02:49Z
Go Version: go1.18.6

2022-09-19T17:42:36Z	[35mDEBUG[0m	checking for updates
2022-09-19T17:42:36Z	[35mDEBUG[0m	version info	{"current_version": "1.11.0", "latest_version": "1.11.0"}
You are currently running the latest version of Flipt [1.11.0]!
2022-09-19T17:42:36Z	[35mDEBUG[0m	local state directory exists	{"path": "/home/flipt/.config/flipt"}
2022-09-19T17:42:36Z	[35mDEBUG[0m	starting telemetry reporter	{"component": "telemetry"}
2022-09-19T17:42:36Z	[35mDEBUG[0m	initialized new state	{"component": "telemetry"}
2022-09-19T17:42:37Z	[35mDEBUG[0m	migrations up to date	{"server": "grpc"}
2022-09-19T17:42:37Z	[35mDEBUG[0m	store enabled	{"server": "grpc", "driver": "postgres"}
2022-09-19T17:42:37Z	[35mDEBUG[0m	starting grpc server	{"server": "grpc"}
2022-09-19T17:42:37Z	[35mDEBUG[0m	starting http server	{"server": "http"}

API: http://0.0.0.0:8080/api/v1
UI: http://0.0.0.0:8080

2022-09-19T17:42:48Z	[35mDEBUG[0m	list flags	{"server": "grpc", "request": ""}
2022-09-19T17:42:48Z	[35mDEBUG[0m	list flags	{"server": "grpc", "response": "flags:{key:\"ingo-test\" name:\"Ingo Test\" description:\"Ist die Postgres Persistent?\" enabled:true created_at:{seconds:1661843591 nanos:351497000} updated_at:{seconds:1661843591 nanos:351497000}}"}
2022-09-19T17:42:48Z	[34mINFO[0m	finished unary call with code OK	{"server": "grpc", "grpc.start_time": "2022-09-19T17:42:48Z", "system": "grpc", "span.kind": "server", "grpc.service": "flipt.Flipt", "grpc.method": "ListFlags", "peer.address": "127.0.0.1:38176", "grpc.code": "OK", "grpc.time_ms": 247.485}

so finaly I think it is the prove that the config.yaml is ignore, but why?

ognif avatar Sep 19 '22 17:09 ognif

Because I have a Postgres managed server and a config.yaml in the configmap of the cluster, I have disabled the pvc option.

ognif avatar Sep 19 '22 17:09 ognif

Thanks @ognif for the detailed response. Will try to reproduce on my end and will get back to you ASAP

markphelps avatar Sep 19 '22 17:09 markphelps

@ognif I was able to verify it is an issue with the helm chart not mounting the configmap to the correct volume mountpoint on the pod.

I think I have a fix here: https://github.com/flipt-io/helm-charts/pull/9

Apologies for the issue, im working on better testing helm/k8s deploys of Flipt (i'm still a helm noob at the moment)

markphelps avatar Sep 19 '22 18:09 markphelps

Marking as closed as I reproduced and confirmed the fix with the lastest helm chart version. Feel free to re-open if still an issue

markphelps avatar Sep 27 '22 17:09 markphelps