diff --git a/cmd/admin/admin.go b/cmd/admin/admin.go index c74550191a..785ed1abf0 100644 --- a/cmd/admin/admin.go +++ b/cmd/admin/admin.go @@ -6,17 +6,18 @@ import ( "github.com/spf13/cobra" - "github.com/zitadel/zitadel/cmd/admin/initialise" - "github.com/zitadel/zitadel/cmd/admin/key" - "github.com/zitadel/zitadel/cmd/admin/setup" - "github.com/zitadel/zitadel/cmd/admin/start" + "github.com/zitadel/zitadel/cmd/initialise" + "github.com/zitadel/zitadel/cmd/key" + "github.com/zitadel/zitadel/cmd/setup" + "github.com/zitadel/zitadel/cmd/start" ) func New() *cobra.Command { adminCMD := &cobra.Command{ - Use: "admin", - Short: "The ZITADEL admin CLI lets you interact with your instance", - Long: `The ZITADEL admin CLI lets you interact with your instance`, + Use: "admin", + Short: "The ZITADEL admin CLI lets you interact with your instance", + Long: `The ZITADEL admin CLI lets you interact with your instance`, + Deprecated: "please use subcommands directly, e.g. `zitadel start`", RunE: func(cmd *cobra.Command, args []string) error { return errors.New("no additional command provided") }, diff --git a/cmd/admin/initialise/config.go b/cmd/initialise/config.go similarity index 99% rename from cmd/admin/initialise/config.go rename to cmd/initialise/config.go index 18e843c410..dbbd7b5e53 100644 --- a/cmd/admin/initialise/config.go +++ b/cmd/initialise/config.go @@ -3,6 +3,7 @@ package initialise import ( "github.com/spf13/viper" "github.com/zitadel/logging" + "github.com/zitadel/zitadel/internal/database" "github.com/zitadel/zitadel/internal/id" ) diff --git a/cmd/admin/initialise/helper.go b/cmd/initialise/helper.go similarity index 100% rename from cmd/admin/initialise/helper.go rename to cmd/initialise/helper.go diff --git a/cmd/admin/initialise/init.go b/cmd/initialise/init.go similarity index 100% rename from cmd/admin/initialise/init.go rename to cmd/initialise/init.go diff --git a/cmd/admin/initialise/init_test.go b/cmd/initialise/init_test.go similarity index 100% rename from cmd/admin/initialise/init_test.go rename to cmd/initialise/init_test.go diff --git a/cmd/admin/initialise/sql/01_user.sql b/cmd/initialise/sql/01_user.sql similarity index 100% rename from cmd/admin/initialise/sql/01_user.sql rename to cmd/initialise/sql/01_user.sql diff --git a/cmd/admin/initialise/sql/02_database.sql b/cmd/initialise/sql/02_database.sql similarity index 100% rename from cmd/admin/initialise/sql/02_database.sql rename to cmd/initialise/sql/02_database.sql diff --git a/cmd/admin/initialise/sql/03_grant_user.sql b/cmd/initialise/sql/03_grant_user.sql similarity index 100% rename from cmd/admin/initialise/sql/03_grant_user.sql rename to cmd/initialise/sql/03_grant_user.sql diff --git a/cmd/admin/initialise/sql/04_eventstore.sql b/cmd/initialise/sql/04_eventstore.sql similarity index 100% rename from cmd/admin/initialise/sql/04_eventstore.sql rename to cmd/initialise/sql/04_eventstore.sql diff --git a/cmd/admin/initialise/sql/05_projections.sql b/cmd/initialise/sql/05_projections.sql similarity index 100% rename from cmd/admin/initialise/sql/05_projections.sql rename to cmd/initialise/sql/05_projections.sql diff --git a/cmd/admin/initialise/sql/06_system.sql b/cmd/initialise/sql/06_system.sql similarity index 100% rename from cmd/admin/initialise/sql/06_system.sql rename to cmd/initialise/sql/06_system.sql diff --git a/cmd/admin/initialise/sql/07_encryption_keys_table.sql b/cmd/initialise/sql/07_encryption_keys_table.sql similarity index 100% rename from cmd/admin/initialise/sql/07_encryption_keys_table.sql rename to cmd/initialise/sql/07_encryption_keys_table.sql diff --git a/cmd/admin/initialise/sql/08_enable_hash_sharded_indexes.sql b/cmd/initialise/sql/08_enable_hash_sharded_indexes.sql similarity index 100% rename from cmd/admin/initialise/sql/08_enable_hash_sharded_indexes.sql rename to cmd/initialise/sql/08_enable_hash_sharded_indexes.sql diff --git a/cmd/admin/initialise/sql/09_events_table.sql b/cmd/initialise/sql/09_events_table.sql similarity index 100% rename from cmd/admin/initialise/sql/09_events_table.sql rename to cmd/initialise/sql/09_events_table.sql diff --git a/cmd/admin/initialise/sql/10_system_sequence.sql b/cmd/initialise/sql/10_system_sequence.sql similarity index 100% rename from cmd/admin/initialise/sql/10_system_sequence.sql rename to cmd/initialise/sql/10_system_sequence.sql diff --git a/cmd/admin/initialise/sql/11_unique_constraints_table.sql b/cmd/initialise/sql/11_unique_constraints_table.sql similarity index 100% rename from cmd/admin/initialise/sql/11_unique_constraints_table.sql rename to cmd/initialise/sql/11_unique_constraints_table.sql diff --git a/cmd/admin/initialise/sql/README.md b/cmd/initialise/sql/README.md similarity index 100% rename from cmd/admin/initialise/sql/README.md rename to cmd/initialise/sql/README.md diff --git a/cmd/admin/initialise/verify_database.go b/cmd/initialise/verify_database.go similarity index 100% rename from cmd/admin/initialise/verify_database.go rename to cmd/initialise/verify_database.go diff --git a/cmd/admin/initialise/verify_database_test.go b/cmd/initialise/verify_database_test.go similarity index 100% rename from cmd/admin/initialise/verify_database_test.go rename to cmd/initialise/verify_database_test.go diff --git a/cmd/admin/initialise/verify_grant.go b/cmd/initialise/verify_grant.go similarity index 100% rename from cmd/admin/initialise/verify_grant.go rename to cmd/initialise/verify_grant.go diff --git a/cmd/admin/initialise/verify_grant_test.go b/cmd/initialise/verify_grant_test.go similarity index 100% rename from cmd/admin/initialise/verify_grant_test.go rename to cmd/initialise/verify_grant_test.go diff --git a/cmd/admin/initialise/verify_user.go b/cmd/initialise/verify_user.go similarity index 100% rename from cmd/admin/initialise/verify_user.go rename to cmd/initialise/verify_user.go diff --git a/cmd/admin/initialise/verify_user_test.go b/cmd/initialise/verify_user_test.go similarity index 100% rename from cmd/admin/initialise/verify_user_test.go rename to cmd/initialise/verify_user_test.go diff --git a/cmd/admin/initialise/verify_zitadel.go b/cmd/initialise/verify_zitadel.go similarity index 100% rename from cmd/admin/initialise/verify_zitadel.go rename to cmd/initialise/verify_zitadel.go diff --git a/cmd/admin/initialise/verify_zitadel_test.go b/cmd/initialise/verify_zitadel_test.go similarity index 100% rename from cmd/admin/initialise/verify_zitadel_test.go rename to cmd/initialise/verify_zitadel_test.go diff --git a/cmd/admin/key/key.go b/cmd/key/key.go similarity index 100% rename from cmd/admin/key/key.go rename to cmd/key/key.go diff --git a/cmd/admin/key/key_test.go b/cmd/key/key_test.go similarity index 100% rename from cmd/admin/key/key_test.go rename to cmd/key/key_test.go diff --git a/cmd/admin/key/masterkey.go b/cmd/key/masterkey.go similarity index 100% rename from cmd/admin/key/masterkey.go rename to cmd/key/masterkey.go diff --git a/cmd/admin/key/masterkey_test.go b/cmd/key/masterkey_test.go similarity index 100% rename from cmd/admin/key/masterkey_test.go rename to cmd/key/masterkey_test.go diff --git a/cmd/admin/setup/01.go b/cmd/setup/01.go similarity index 100% rename from cmd/admin/setup/01.go rename to cmd/setup/01.go diff --git a/cmd/admin/setup/01_sql/adminapi.sql b/cmd/setup/01_sql/adminapi.sql similarity index 100% rename from cmd/admin/setup/01_sql/adminapi.sql rename to cmd/setup/01_sql/adminapi.sql diff --git a/cmd/admin/setup/01_sql/auth.sql b/cmd/setup/01_sql/auth.sql similarity index 100% rename from cmd/admin/setup/01_sql/auth.sql rename to cmd/setup/01_sql/auth.sql diff --git a/cmd/admin/setup/01_sql/notification.sql b/cmd/setup/01_sql/notification.sql similarity index 100% rename from cmd/admin/setup/01_sql/notification.sql rename to cmd/setup/01_sql/notification.sql diff --git a/cmd/admin/setup/01_sql/projections.sql b/cmd/setup/01_sql/projections.sql similarity index 100% rename from cmd/admin/setup/01_sql/projections.sql rename to cmd/setup/01_sql/projections.sql diff --git a/cmd/admin/setup/02.go b/cmd/setup/02.go similarity index 100% rename from cmd/admin/setup/02.go rename to cmd/setup/02.go diff --git a/cmd/admin/setup/03.go b/cmd/setup/03.go similarity index 100% rename from cmd/admin/setup/03.go rename to cmd/setup/03.go diff --git a/cmd/admin/setup/config.go b/cmd/setup/config.go similarity index 95% rename from cmd/admin/setup/config.go rename to cmd/setup/config.go index 9256a03192..fe42311343 100644 --- a/cmd/admin/setup/config.go +++ b/cmd/setup/config.go @@ -58,9 +58,9 @@ type encryptionKeyConfig struct { } func MustNewSteps(v *viper.Viper) *Steps { - viper.AutomaticEnv() - viper.SetEnvPrefix("ZITADEL") - viper.SetEnvKeyReplacer(strings.NewReplacer(".", "_")) + v.AutomaticEnv() + v.SetEnvPrefix("ZITADEL") + v.SetEnvKeyReplacer(strings.NewReplacer(".", "_")) v.SetConfigType("yaml") err := v.ReadConfig(bytes.NewBuffer(defaultSteps)) logging.OnError(err).Fatal("unable to read setup steps") diff --git a/cmd/admin/setup/setup.go b/cmd/setup/setup.go similarity index 97% rename from cmd/admin/setup/setup.go rename to cmd/setup/setup.go index 578127fe81..5a92329230 100644 --- a/cmd/admin/setup/setup.go +++ b/cmd/setup/setup.go @@ -8,8 +8,8 @@ import ( "github.com/spf13/viper" "github.com/zitadel/logging" - "github.com/zitadel/zitadel/cmd/admin/key" - "github.com/zitadel/zitadel/cmd/admin/tls" + "github.com/zitadel/zitadel/cmd/key" + "github.com/zitadel/zitadel/cmd/tls" "github.com/zitadel/zitadel/internal/database" "github.com/zitadel/zitadel/internal/eventstore" "github.com/zitadel/zitadel/internal/migration" diff --git a/cmd/admin/setup/steps.yaml b/cmd/setup/steps.yaml similarity index 100% rename from cmd/admin/setup/steps.yaml rename to cmd/setup/steps.yaml diff --git a/cmd/admin/start/config.go b/cmd/start/config.go similarity index 100% rename from cmd/admin/start/config.go rename to cmd/start/config.go diff --git a/cmd/admin/start/encryption_keys.go b/cmd/start/encryption_keys.go similarity index 100% rename from cmd/admin/start/encryption_keys.go rename to cmd/start/encryption_keys.go diff --git a/cmd/admin/start/flags.go b/cmd/start/flags.go similarity index 91% rename from cmd/admin/start/flags.go rename to cmd/start/flags.go index f3ca8afe36..9ef6a0f425 100644 --- a/cmd/admin/start/flags.go +++ b/cmd/start/flags.go @@ -4,8 +4,8 @@ import ( "github.com/spf13/cobra" "github.com/spf13/viper" - "github.com/zitadel/zitadel/cmd/admin/key" - "github.com/zitadel/zitadel/cmd/admin/tls" + "github.com/zitadel/zitadel/cmd/key" + "github.com/zitadel/zitadel/cmd/tls" ) var tlsMode *string diff --git a/cmd/admin/start/start.go b/cmd/start/start.go similarity index 99% rename from cmd/admin/start/start.go rename to cmd/start/start.go index db86780084..1c2e2fdb4f 100644 --- a/cmd/admin/start/start.go +++ b/cmd/start/start.go @@ -21,8 +21,8 @@ import ( "golang.org/x/net/http2" "golang.org/x/net/http2/h2c" - "github.com/zitadel/zitadel/cmd/admin/key" - cmd_tls "github.com/zitadel/zitadel/cmd/admin/tls" + "github.com/zitadel/zitadel/cmd/key" + cmd_tls "github.com/zitadel/zitadel/cmd/tls" admin_es "github.com/zitadel/zitadel/internal/admin/repository/eventsourcing" "github.com/zitadel/zitadel/internal/api" "github.com/zitadel/zitadel/internal/api/assets" diff --git a/cmd/admin/start/start_from_init.go b/cmd/start/start_from_init.go similarity index 85% rename from cmd/admin/start/start_from_init.go rename to cmd/start/start_from_init.go index f6057551c1..89c74d5592 100644 --- a/cmd/admin/start/start_from_init.go +++ b/cmd/start/start_from_init.go @@ -5,10 +5,10 @@ import ( "github.com/spf13/viper" "github.com/zitadel/logging" - "github.com/zitadel/zitadel/cmd/admin/initialise" - "github.com/zitadel/zitadel/cmd/admin/key" - "github.com/zitadel/zitadel/cmd/admin/setup" - "github.com/zitadel/zitadel/cmd/admin/tls" + "github.com/zitadel/zitadel/cmd/initialise" + "github.com/zitadel/zitadel/cmd/key" + "github.com/zitadel/zitadel/cmd/setup" + "github.com/zitadel/zitadel/cmd/tls" ) func NewStartFromInit() *cobra.Command { diff --git a/cmd/admin/tls/tls.go b/cmd/tls/tls.go similarity index 100% rename from cmd/admin/tls/tls.go rename to cmd/tls/tls.go diff --git a/cmd/zitadel.go b/cmd/zitadel.go index e2e5462c1b..0077b62885 100644 --- a/cmd/zitadel.go +++ b/cmd/zitadel.go @@ -12,6 +12,10 @@ import ( "github.com/zitadel/logging" "github.com/zitadel/zitadel/cmd/admin" + "github.com/zitadel/zitadel/cmd/initialise" + "github.com/zitadel/zitadel/cmd/key" + "github.com/zitadel/zitadel/cmd/setup" + "github.com/zitadel/zitadel/cmd/start" ) var ( @@ -41,7 +45,14 @@ func New(out io.Writer, in io.Reader, args []string) *cobra.Command { cobra.OnInitialize(initConfig) cmd.PersistentFlags().StringArrayVar(&configFiles, "config", nil, "path to config file to overwrite system defaults") - cmd.AddCommand(admin.New()) + cmd.AddCommand( + admin.New(), //is now deprecated, remove later on + initialise.New(), + setup.New(), + start.New(), + start.NewStartFromInit(), + key.New(), + ) return cmd } diff --git a/deploy/compose/docker-compose.yml b/deploy/compose/docker-compose.yml index 4cf468b476..a24f70f4b7 100644 --- a/deploy/compose/docker-compose.yml +++ b/deploy/compose/docker-compose.yml @@ -5,8 +5,8 @@ services: restart: always networks: - zitadel - image: ghcr.io/zitadel/zitadel:v2.0.0-v2-alpha.32-amd64 - command: admin start-from-init --masterkey "MasterkeyNeedsToHave32Characters" --tlsMode disabled + image: ghcr.io/zitadel/zitadel:v2.0.0-v2-alpha.33-amd64 + command: start-from-init --masterkey "MasterkeyNeedsToHave32Characters" --tlsMode disabled environment: - ZITADEL_DATABASE_HOST=db - ZITADEL_DEFAULTINSTANCE_CUSTOMDOMAIN=localhost diff --git a/docs/docs/guides/installation/configuration.mdx b/docs/docs/guides/installation/configuration.mdx index 40e7028646..811370db29 100644 --- a/docs/docs/guides/installation/configuration.mdx +++ b/docs/docs/guides/installation/configuration.mdx @@ -36,5 +36,5 @@ DefaultInstance: EOF # Pass multiple config files using the --config argument -zitadel admin start-from-init --config ./zitadel-config.yaml --config ./zitadel-secrets.yaml --masterkey "MasterkeyNeedsToHave32Characters" +zitadel start-from-init --config ./zitadel-config.yaml --config ./zitadel-secrets.yaml --masterkey "MasterkeyNeedsToHave32Characters" ``` diff --git a/docs/docs/guides/installation/linux.mdx b/docs/docs/guides/installation/linux.mdx index 62594bad82..c315eeea66 100644 --- a/docs/docs/guides/installation/linux.mdx +++ b/docs/docs/guides/installation/linux.mdx @@ -21,11 +21,11 @@ export ZITADEL_DEFAULTINSTANCE_CUSTOMDOMAIN=localhost Download the zitadel binary ```bash -curl -s https://api.github.com/repos/zitadel/zitadel/releases/tags/v2.0.0-v2-alpha.17 | grep "browser_download_url.*zitadel_.*_linux_$(dpkg --print-architecture)" | cut -d '"' -f 4 | sudo wget -i - -O /usr/local/bin/zitadel && sudo chmod +x /usr/local/bin/zitadel && sudo chown $(id -u):$(id -g) /usr/local/bin/zitadel +curl -s https://api.github.com/repos/zitadel/zitadel/releases/tags/v2.0.0-v2-alpha.33 | grep "browser_download_url.*zitadel_.*_linux_$(dpkg --print-architecture)" | cut -d '"' -f 4 | sudo wget -i - -O /usr/local/bin/zitadel && sudo chmod +x /usr/local/bin/zitadel && sudo chown $(id -u):$(id -g) /usr/local/bin/zitadel ``` Run the database and application containers ```bash -zitadel admin start-from-init --tlsMode disabled --masterkey "MasterkeyNeedsToHave32Characters" +zitadel start-from-init --tlsMode disabled --masterkey "MasterkeyNeedsToHave32Characters" ``` diff --git a/docs/docs/guides/installation/macos.mdx b/docs/docs/guides/installation/macos.mdx index 800e4c2891..db4e197ab4 100644 --- a/docs/docs/guides/installation/macos.mdx +++ b/docs/docs/guides/installation/macos.mdx @@ -30,11 +30,11 @@ brew install zitadel/tap/zitadel ... or download the binary from GitHub ```bash -curl -s https://api.github.com/repos/zitadel/zitadel/releases/tags/v2.0.0-v2-alpha.17 | grep "browser_download_url.*zitadel_.*_darwin_${MY_ARCHITECTURE}" | cut -d '"' -f 4 | sudo wget -i - -O /usr/local/bin/zitadel && sudo chmod +x /usr/local/bin/zitadel && sudo chown $(id -u):$(id -g) /usr/local/bin/zitadel +curl -s https://api.github.com/repos/zitadel/zitadel/releases/tags/v2.0.0-v2-alpha.33 | grep "browser_download_url.*zitadel_.*_darwin_${MY_ARCHITECTURE}" | cut -d '"' -f 4 | sudo wget -i - -O /usr/local/bin/zitadel && sudo chmod +x /usr/local/bin/zitadel && sudo chown $(id -u):$(id -g) /usr/local/bin/zitadel ``` Run ZITADEL ```bash -zitadel admin start-from-init --tlsMode disabled --masterkey "MasterkeyNeedsToHave32Characters" +zitadel start-from-init --tlsMode disabled --masterkey "MasterkeyNeedsToHave32Characters" ``` diff --git a/internal/config/network/config.go b/internal/config/network/config.go index 79a374f7d7..8a16ec44da 100644 --- a/internal/config/network/config.go +++ b/internal/config/network/config.go @@ -7,7 +7,7 @@ import ( ) var ( - ErrMissingConfig = errors.New("") + ErrMissingConfig = errors.New("TLS is enabled: please specify a key (path) and a cert (path) or disable TLS if needed (e.g. by setting flag `--tlsMode external` or `--tlsMode disabled") ) type TLS struct { diff --git a/internal/eventstore/local_crdb_test.go b/internal/eventstore/local_crdb_test.go index 01c6ae19f8..aea9e57bda 100644 --- a/internal/eventstore/local_crdb_test.go +++ b/internal/eventstore/local_crdb_test.go @@ -8,7 +8,7 @@ import ( "github.com/cockroachdb/cockroach-go/v2/testserver" "github.com/zitadel/logging" - "github.com/zitadel/zitadel/cmd/admin/initialise" + "github.com/zitadel/zitadel/cmd/initialise" ) var ( diff --git a/internal/eventstore/repository/sql/local_crdb_test.go b/internal/eventstore/repository/sql/local_crdb_test.go index 7b790d1b56..ded13a49a5 100644 --- a/internal/eventstore/repository/sql/local_crdb_test.go +++ b/internal/eventstore/repository/sql/local_crdb_test.go @@ -8,7 +8,7 @@ import ( "github.com/cockroachdb/cockroach-go/v2/testserver" "github.com/zitadel/logging" - "github.com/zitadel/zitadel/cmd/admin/initialise" + "github.com/zitadel/zitadel/cmd/initialise" ) var (