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

Global database commands cannot open a database when the project is stopped #5949

Closed
1 task done
stasadev opened this issue Mar 8, 2024 · 2 comments
Closed
1 task done

Comments

@stasadev
Copy link
Member

stasadev commented Mar 8, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Output of ddev debug test

Expand `ddev debug test` diagnostic information
[COPY-PASTE HERE THE OUTPUT OF `ddev debug test`]

Expected Behavior

It should open the database (or ask the user to start the project).

Actual Behavior

When I tested ddev dbeaver with a stopped project, it started the project and tried to open the database with 3306 port (which is not the correct host port), and on the second run the db was opened with the actual working port.

Steps To Reproduce

  1. ddev stop
  2. ddev dbeaver (or any other db command)
  3. see the database connection with the wrong port

Anything else?

I assume that this is because the DDEV env variables in the dbeaver script (and any other script for opening a database) are not updated after ddev start, so it only works when the project is started.

Is it possible to update env in Bash after ddev start? Or maybe we need to change the logic for db commands from:

if [ "${DDEV_PROJECT_STATUS}" != "running" ]; then
  echo "Project ${DDEV_PROJECT} is not running, starting it"
  ddev start
fi

to

if [ "${DDEV_PROJECT_STATUS}" != "running" ]; then
  echo >&2 "Project ${DDEV_PROJECT} is not running, please start it"
  exit 1
fi
@rfay
Copy link
Member

rfay commented Mar 8, 2024

The actual port is an ephemeral port and isn't known until after we start.

Related:

@rpkoller
Copy link
Collaborator

I've installed sequelace today and noticed the exact same behavior. found this issue when searching if there is an already existing issue.

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