Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zitadel not connecting to the Postgres DB. #71

Closed
siddharthgaur2590 opened this issue Mar 2, 2023 · 3 comments
Closed

Zitadel not connecting to the Postgres DB. #71

siddharthgaur2590 opened this issue Mar 2, 2023 · 3 comments

Comments

@siddharthgaur2590
Copy link

siddharthgaur2590 commented Mar 2, 2023

Hi Team, cc: @mheers , @fforootd, @ansarhun @mffap

I'm self-hosting Zitadel on K8s cluster using yamls like deployment, pv, pvc, service, ingress etc but its giving error when I'm connecting it to the self-hosted postgres DB in same cluster.

Error: cannot start client for projection: ID=DATAB-0pIWD Message=Errors.Database.Connection.Failed Parent=(failed to connect to host=localhost user=zitadel database=zitadel: dial error (dial tcp [::1]:26257: connect: connection refused))

It seems due to some issue in connecting it with postgres, it's trying to connect to the default CockroachDB which I don't want.

Please help to give the resolution asap.

So far I've tried below options:

  • Using configmap and referring it to the deployment.yaml
    apiVersion: v1
    kind: ConfigMap
    metadata:
    name: zitadel-config
    namespace: default
    data:
    ZITADEL_DB_TYPE: "postgresql"
    ZITADEL_DB_HOST: "lkjfkjsfkljskldfjs"
    ZITADEL_DB_PORT: "9897"
    ZITADEL_DB_NAME: "ffwefewfwef"
    ZITADEL_DB_USERNAME: "dsfdsf"
    ZITADEL_DB_PASSWORD: "r32re3"
    ZITADEL_DB_SSL_MODE: "disable"

  • using the env variable in deployment.yaml
    env:
    - name: ZITADEL_DB_CONNECTION_URI
    value: postgresql://:@hostname:/

Also, another thing:
I've used args like below in deployment.yaml, so anything else required to make the Zitadel instance up and running:
args:
- start
- "--masterkey"
- "custommasterkey"

@mffap
Copy link
Member

mffap commented Mar 2, 2023

Please help to give the resolution asap.

Someone will get to it as soon as possible. I recommend also asking in our discord chat where many self-hosters help each other. If you need timely response we also offer a support program for self-hosting, for a quote please get in touch with us.

Since you tagged me personally, I don't know how to help you with the issue since this is not my domain. Apologies.

@eliobischof
Copy link
Member

eliobischof commented Mar 2, 2023

You can see the supported configuration options in the defaults.yaml: https://github.com/zitadel/zitadel/blob/main/cmd/defaults.yaml#L82-L106
So the environment variable ZITADEL_DB_CONNECTION_URI does not have an effect.

According to https://zitadel.com/docs/self-hosting/manage/configure#environment-variables, you should rather configure ZITADEL_DATABASE_POSTGRES_HOST, ZITADEL_DATABASE_POSTGRES_PORT etc.

Please reopen the issue if that doesn't work for you.

@siddharthgaur2590
Copy link
Author

Hi,
now following error comes, what other configs are required?

Error: cannot start client for projection: ID=DATAB-0pIWD Message=Errors.Database.Connection.Failed Parent=(cannot parse host=xxxxxx.xxxxxx.svc.cluster.local port=5432 user= application_name=zitadel sslmode= dbname= sslrootcert=: failed to configure TLS (sslmode is invalid))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants