ddev / vscode-ddev-manager

DDEV Manager offers a centralized and user-friendly interface to control every aspect of your DDEV projects.
https://marketplace.visualstudio.com/items?itemName=biati.ddev-manager
Apache License 2.0
13 stars 3 forks source link

[BUG] Different services displayed depending if the project is running or stopped #9

Closed biati-digital closed 1 year ago

biati-digital commented 1 year ago

Describe the bug Doing ddev describe -j on a running project outputs the services (included by default or installed by the user), but when the project is not running ddev describe -j returns the services empty "services": {},"

What's a reliable way to get all the services even if the project is not running?

To Reproduce Install a custom service, it will only be displayed in the sidebar when the project is running.

Expected behavior It would be great to be able to display the installed services even if the project is not running, I do not need url's or ports (because it's not running), just the service name/short_name

Screenshots

When running CleanShot 2023-09-12 at 21 55 08

When stopped CleanShot 2023-09-12 at 21 55 46

System (please complete the following information):

tyler36 commented 1 year ago

For things like PHP, Node, and databases, versions and types are usually stored in .ddev/config.yml (Should the database be one level higher?)

You could also use (or compare) the output from .ddev/add-metadata/name/manifest.yaml with the ddev describe -j's services. This would only work with addons installed via ddev get, and not manually added files.

biati-digital commented 1 year ago

PHP, Node and db is returned correctly, it's just for services/addons installed with ddev get. I think I can use the manifest.yaml inside addon-metadata when the project is not running. Just one doubt.

Can I assume that the service short name is just the addon name without ddev-? for example:

This is the content of .ddev/addon-metadata/ddev-buggregator/manifest.yaml

name: ddev-buggregator
repository: iljapolanskis/ddev-buggregator
version: 1.0.0
install_date: "2023-09-10T14:50:15-06:00"
project_files:
    - docker-compose.buggregator.yaml
global_files: []
removal_actions: []

and this is the content of docker-compose.buggregator.yaml

#ddev-generated
# Buggregator Server
services:
  buggregator:
    container_name: ddev-${DDEV_SITENAME}-buggregator
    hostname: ${DDEV_SITENAME}-buggregator
    image: ghcr.io/buggregator/server:latest
    expose:
      - "8000"
      - "1025"
      - "9912"
      - "9913"
    environment:
      - VIRTUAL_HOST=$DDEV_HOSTNAME
      - HTTPS_EXPOSE=8000:8000,1025:1025,9912:9912,9913:9913
    labels:
      com.ddev.site-name: ${DDEV_SITENAME}
      com.ddev.approot: $DDEV_APPROOT
    volumes:
      - ".:/mnt/ddev_config"

There is no place where the add-on defines just buggregator. Doing ddev describe -j on a running project outputs this:

CleanShot 2023-09-12 at 22 27 08

I'm currently using the shortname so I need to know if I can simply remove ddev- from the name defined in manifest.yaml so I get the same shortname that ddev returns when the project is running.

tyler36 commented 1 year ago

Not entirely sure, but the "name" you highlighted seems to be the name of the docker service container.

This is different from the addon name which is declared in the addons install.yaml, which is used to populate the .ddev/addon-metadata/[addon]/manifest.yaml. This is meant to be the "human-friendly" name.

Most of the time, they will be similar if not the same. But addons can declare multiple services (XHGUI has a xhgui and mongo service). DDEV itself uses db as a generic name for the 3 databases it currenty supports.

I think the "human-friendly" name is better; parse out the ddev if you want to keep things shorter.

biati-digital commented 1 year ago

Ohh, so even if I get the data from manifest.yaml it's still possible that I get a different output from ddev describe -j when the project is running.

Not sure if there's a point in getting the add-ons data from manifest.yaml, what I wanted to accomplish was that no matter if the project was running or not, the same services/add-ons were displayed in the sidebar for each project, but depending on the add-on ddev describe -j will return different "services":{... data and there's no way to get that if the project is not running (without the urls, ports, etc.).

If that's the case I'll just refresh the sidebar services when the project is started. The user will only be able to see the installed add-ons when the project is running but I think that for now it's better than nothing.

rfay commented 1 year ago

There isn't a way to get services (or anything else) when the project isn't running. A rework of app.Describe might be worth it, but I don't think it could even work.

biati-digital commented 1 year ago

@rfay Understood. For now I think we can leave it like it is, once the user starts the project the rest of services will be displayed. It's definitely not ideal (I thought it was a bug), it will be confusing for the users at first but still the number of extension installs is low to even consider a rework.

I think we should keep this in mind in case we can think of a solution. The UI it's intended to display all the information related to a project without depending on if it's running or not. If at the end it's not possible maybe we can consider removing the services from the sidebar and move the db below server in the general information? I'll have to think about this.

rfay commented 1 year ago

Services aren't even necessarily add-ons...

biati-digital commented 1 year ago

Ok, I’ll think I’ll better just remove the services completely from the sidebar and move the db with the general information.

I’ll try to think a different way to show installed add-ons/services.