From 8a5c3b0fa11671d67fbaafa8edcd29931b08d716 Mon Sep 17 00:00:00 2001 From: Silvan Date: Mon, 5 Sep 2022 11:24:31 +0200 Subject: [PATCH] fix: postgreSQL version spec (#4301) * fix(cli): log error in `init zitadel` * docs: specify postgres version Co-authored-by: Livio Spring --- README.md | 2 +- cmd/initialise/verify_database.go | 2 +- cmd/initialise/verify_grant.go | 2 +- cmd/initialise/verify_user.go | 2 +- cmd/initialise/verify_zitadel.go | 18 +++++------------- docs/docs/concepts/architecture/software.md | 2 +- .../manage/self-hosted/database/_postgres.mdx | 4 +++- 7 files changed, 13 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 8be0824d4..2e88f3f06 100644 --- a/README.md +++ b/README.md @@ -81,7 +81,7 @@ It's free for up to 25'000 authenticated requests. Learn more about the [pay-as- - [Service Accounts](https://docs.zitadel.com/docs/guides/integrate/serviceusers) - [OpenID Connect certified](https://openid.net/certification/#OPs) - 🚧 [SAML 2.0](https://github.com/zitadel/zitadel/pull/3618) -- [Postgres](https://docs.zitadel.com/docs/guides/manage/self-hosted/database#postgres) or [CockroachDB](https://docs.zitadel.com/docs/guides/manage/self-hosted/database#cockroach) +- [Postgres](https://docs.zitadel.com/docs/guides/manage/self-hosted/database#postgres) (version >= 14) or [CockroachDB](https://docs.zitadel.com/docs/guides/manage/self-hosted/database#cockroach) (version >= 22.0) Track upcoming features on our [roadmap](https://zitadel.com/roadmap). diff --git a/cmd/initialise/verify_database.go b/cmd/initialise/verify_database.go index 3abbfb710..08133472c 100644 --- a/cmd/initialise/verify_database.go +++ b/cmd/initialise/verify_database.go @@ -17,7 +17,7 @@ func newDatabase() *cobra.Command { Long: `Sets up the ZITADEL database. Prereqesits: -- cockroachdb +- cockroachDB or postgreSQL The user provided by flags needs priviledge to - create the database if it does not exist diff --git a/cmd/initialise/verify_grant.go b/cmd/initialise/verify_grant.go index 3e421a263..24915c7ca 100644 --- a/cmd/initialise/verify_grant.go +++ b/cmd/initialise/verify_grant.go @@ -17,7 +17,7 @@ func newGrant() *cobra.Command { Long: `Sets ALL grant to the database user. Prereqesits: -- cockroachdb +- cockroachDB or postgreSQL `, Run: func(cmd *cobra.Command, args []string) { config := MustNewConfig(viper.New()) diff --git a/cmd/initialise/verify_user.go b/cmd/initialise/verify_user.go index cc375ce49..0dddb50f7 100644 --- a/cmd/initialise/verify_user.go +++ b/cmd/initialise/verify_user.go @@ -17,7 +17,7 @@ func newUser() *cobra.Command { Long: `Sets up the ZITADEL database user. Prereqesits: -- cockroachdb +- cockroachDB or postreSQL The user provided by flags needs priviledge to - create the database if it does not exist diff --git a/cmd/initialise/verify_zitadel.go b/cmd/initialise/verify_zitadel.go index a9422550d..cc8db6543 100644 --- a/cmd/initialise/verify_zitadel.go +++ b/cmd/initialise/verify_zitadel.go @@ -12,15 +12,6 @@ import ( "github.com/zitadel/zitadel/internal/database" ) -const ( - eventstoreSchema = "eventstore" - eventsTable = "events" - uniqueConstraintsTable = "unique_constraints" - projectionsSchema = "projections" - systemSchema = "system" - encryptionKeysTable = "encryption_keys" -) - func newZitadel() *cobra.Command { return &cobra.Command{ Use: "zitadel", @@ -28,11 +19,12 @@ func newZitadel() *cobra.Command { Long: `initialize ZITADEL internals. Prereqesits: -- cockroachdb with user and database +- cockroachDB or postgreSQL with user and database `, - RunE: func(cmd *cobra.Command, args []string) error { + Run: func(cmd *cobra.Command, args []string) { config := MustNewConfig(viper.GetViper()) - return verifyZitadel(config.Database) + err := verifyZitadel(config.Database) + logging.OnError(err).Fatal("unable to init zitadel") }, } } @@ -82,7 +74,7 @@ func verifyZitadel(config database.Config) error { } if err := VerifyZitadel(db, config); err != nil { - return nil + return err } return db.Close() diff --git a/docs/docs/concepts/architecture/software.md b/docs/docs/concepts/architecture/software.md index a110a7e26..85a762e0f 100644 --- a/docs/docs/concepts/architecture/software.md +++ b/docs/docs/concepts/architecture/software.md @@ -144,4 +144,4 @@ The storage layer of ZITADEL is responsible for multiple things. For example: - Backup and restore operation for disaster recovery purpose ZITADEL currently supports CockroachDB as first choice of storage due to its perfect match for ZITADELs needs. -Postgresql support is currently in beta. +PostgreSQL support is currently in beta. diff --git a/docs/docs/guides/manage/self-hosted/database/_postgres.mdx b/docs/docs/guides/manage/self-hosted/database/_postgres.mdx index ca6427cc7..693783081 100644 --- a/docs/docs/guides/manage/self-hosted/database/_postgres.mdx +++ b/docs/docs/guides/manage/self-hosted/database/_postgres.mdx @@ -4,7 +4,9 @@ Postgres extension is currently in beta. ::: -If you want to use a Postgres database instead of CockroachDB you can [overwrite the default configuration](../configure/configure.mdx). +If you want to use a PostgreSQL database instead of CockroachDB you can [overwrite the default configuration](../configure/configure.mdx). + +Currently versions >= 14 are supported. Postgres can be configured as follows: ```yaml