Skip to content

dbdeployer init doesn't support PostgreSQL (hardcoded to MySQL) #85

@renecannao

Description

@renecannao

Problem

`dbdeployer init` is hardcoded to download and install a MySQL tarball. There is no way to initialize a PostgreSQL environment, even though dbdeployer v2.x supports PostgreSQL as a first-class provider for `deploy single`, `deploy replication`, etc.

Current behavior

```
$ dbdeployer init --help
Initializes dbdeployer environment:

  • creates $SANDBOX_HOME and $SANDBOX_BINARY directories
  • downloads and expands the latest MySQL tarball <-- no choice of provider
  • installs shell completion file

Flags:
--dry-run Show operations but don't run them
--skip-all-downloads Do not download any file
--skip-shell-completion Do not download shell completion file
--skip-tarball-download Do not download MySQL tarball
```

Code:

```go
// ops/init.go:198
tarball, err := downloads.FindOrGuessTarballByVersionFlavorOS(version, common.MySQLFlavor,
OS, arch, minimal, true, false)
```

The flavor is hardcoded to `common.MySQLFlavor`.

Expected behavior

```
$ dbdeployer init --provider=postgresql

... downloads and installs latest PostgreSQL

```

Proposed fix

  1. Add `--provider` flag to `dbdeployer init` (values: `mysql`, `postgresql`, default `mysql`).
  2. For `postgresql`, install PostgreSQL via the existing provider path (deb extraction on Linux, similar on macOS).
  3. Update help text: "downloads and installs the latest MySQL or PostgreSQL tarball".
  4. Add a CI test that exercises `dbdeployer init --provider=postgresql`.

Related

PostgreSQL provider was added in the v2.x rewrite (see PRs on master). `deploy single`, `deploy replication`, and `downloads` all support `--provider=postgresql`. `init` is the remaining hole.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions