Skip to content

Commit

Permalink
[MM-61280] disable init data if providing external database (#870)
Browse files Browse the repository at this point in the history
* fix: disable init data if providing external database

* Update cmd/ltctl/main.go

Co-authored-by: Alejandro García Montoro <[email protected]>

* validate configuration and update docs

* typo

---------

Co-authored-by: Alejandro García Montoro <[email protected]>
  • Loading branch information
fmartingr and agarciamontoro authored Dec 16, 2024
1 parent 3e4b5fa commit a20d94b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/ltctl/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func RunCreateCmdF(cmd *cobra.Command, args []string) error {
return fmt.Errorf("failed to create SSH agent: %w", err)
}

initData := config.DBDumpURI == ""
initData := config.DBDumpURI == "" && config.ExternalDBSettings.DataSource == ""
if err = t.Create(extAgent, initData); err != nil {
return fmt.Errorf("failed to create terraform env: %w", err)
}
Expand Down
4 changes: 4 additions & 0 deletions deployment/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,10 @@ func (c *Config) IsValid() error {
return fmt.Errorf("load-test download url is not in correct format: %q", c.LoadTestDownloadURL)
}

if c.ExternalDBSettings.DataSource != "" && c.DBDumpURI != "" {
return fmt.Errorf("both ExternalDBSettings.DataSource and DBDumpURI are set, only one can be set")
}

if err := c.validateElasticSearchConfig(); err != nil {
return err
}
Expand Down
4 changes: 4 additions & 0 deletions docs/config/deployer.md
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,10 @@ The file is expected to be gzip compressed.
This can also point to a local file if prefixed with "file://".
In such case, the dump file will be uploaded to the app servers.

Loading a dump into a database only work for terraform created databases.
If you are using an existing database by relying on [`ExternalDBSettings`](#ExternalDBSettings)
you need to load the dump manually.

## SiteURL

*string*
Expand Down

0 comments on commit a20d94b

Please sign in to comment.