Skip to content

Reorganize start/stop/rm commands #484

Closed

Description

@rfay

What happened (or feature request):

Our start/stop/remove commands have kind of morphed and they may be confusing to the end user.

The way things are set up at this point (with the db mounted), there's never a reason to stop and keep the docker containers around, since new ones are identical. And the different modes of "remove" could be confusing.

I propose:

  • Remove the current "stop" command implementation
  • Change the basic "remove" command to "stop"
  • Remove the "restart" command, as "start" does all the work it would do.
  • Change the "remove --remove-data" command to "remove" and add a confirmation step.

I think these semantics would be more likely for users to relate to clearly, and it might give the GUI a bit more of a handhold as well.

What you expected to happen:

How to reproduce this:

Version: Please include the output of ddev version, docker version and the project's .ddev/config.yaml.

Anything else do we need to know:

Related source links or issues:

Activity

  1. rfay commented on Nov 1, 2017

    @rfay
    MemberAuthor

    A related comment on this: We've often talked about managing our own metadata for sites instead of having docker do it for us. Currently, docker stop only has the value of retaining containers, so that ddev list can remember that the sites exist.

    The overarching problem is that we use docker to maintain our state about sites, and we don't have any ourselves.

  2. added this to the v1.0.0 milestone on Dec 11, 2017
  3. rickmanelius commented on Dec 11, 2017

    @rickmanelius
    Contributor

    Another issue that could potentially cause BC's. Noting the milestone change given this will be something we'd need to support prior to 2.0.0 if we accept in 1.0.0.

  4. rickmanelius commented on Jan 8, 2018

    @rickmanelius
    Contributor

    This requires a bit of thought and something that needs to be worked out given the potential BC's. Here is a stream-of-consciousness list of items that could be affected:

    • GUI: If we remove the concept of a "stop" state then the UI (which relies on ddev list, which itself relies on containers existing in a running/stopped) will no longer see the site when the stack is removed.
    • Question: While the containers should contain NO persistent data (that should be either mounted or accessed through Docker volumes), is there any additional benefit of keeping a container around?
    • Hooks: Currently we support pre/post hooks for start, import-db, and import-files. ddev restart is essentially just doing a sequential ddev stop and then a ddev start. When I run ddev start with a site that is already active, the output is not the same as if I did a stop followed by a start. To that end, I'm not sure it's an exact replacement. Additionally, if we ever did add a hook for ddev stop or remove, wouldn't running ddev start instead of restart bypass that?

    More to think about because I very much understand how we're having "remove" do double duty and there is most likely confusion around the two use cases.

  5. self-assigned this
    on Jan 16, 2018
  6. rfay commented on Jan 17, 2018

    @rfay
    MemberAuthor

    So:

    • I don't think there's intrinsic value in keeping containers around when we can have the same behavior destroying them. The only value we get is tracking projects that we once had running, and that's not a very robust way of tracking them.
    • ddev start when a site is running is not exactly the same as a stop and a start, but it's close. When you do a ddev start on a running site, containers that need to be rebuilt are rebuilt. But this is just useless talk. ddev restart could be implemented just fine as a ddev rm followed by ddev start
    • I think we could just remove ddev restart. I haven't found it useful, and it just adds to information overload and code maintenance.
  7. rickmanelius commented on Jan 17, 2018

    @rickmanelius
    Contributor

    Trying to get this to a decision point, but wanting to step back and take our time on this because it will require a bit of rework at a code and documentation level.

    Ultimately, ddev is a wrapper for docker compose that is managing 1) managing the creation of a valid and properly configured/optimized docker compose file and 2) performing any additional business logic to help stand up and maintain the application layer for supported app types. There are other features as well (provider plugins, etc) but for the purpose of addressing the start/stop/rm functionality, I think that scopes what is being managed.

    So from the perspective of DDEV, here's a list of what's occurring. I've also tried to not constrain myself to ddev terminology and looked more closely at Docker compose to see if there are related terms we could use.

    What is actually occurring:

    • ddev (container stack) up
    • ddev (container stack) pause
    • ddev (container stack) down
    • ddev (project db) delete
    • ddev (project configuration) remove

    If we removed what is in parenthesis, we would be left with:

    • ddev up (previously start)
    • ddev pause (previously stop)
    • ddev down (previously remove)
    • ddev delete (previously remove --remove-data)
    • ddev remove (doesn't exist, but would effectively remove ddev configurations and managed files)

    I know that the "pause" state doesn't seem valueable to those working consistently on the CLI. I would disagree in some aspects. You can still target these projects using certain global commands. Additionally, there may be situations (strange as it may be) where someone tests modifications to the container and needs to keep them around. Finally, until ddev list can operate off of a ddev project database apart from docker containers, ddev-ui will not be able to be aware of these projects without jumping through the steps of re-adding each and every time.

    I agree that restart might not be worth keeping if ddev start (or potentially "up") effectively does the same thing. However, I see that as kindof a hard reset on the offchance that changes within the container were added/introduced.

  8. cweagans commented on Jan 17, 2018

    @cweagans
    Contributor

    I would really like to not make a distinction between delete and remove. [whatever] rm is pretty standard across devops tools (vagrant, docker-compose, etc). I'd lean toward having one place where destructive actions can occur and put sufficient guard rails around it to make sure that people don't use it accidentally.

    IMO, ddev rm + ddev rm --keep-data would be a really simple/standard way to handle this.

  9. rfay commented on Jan 17, 2018

    @rfay
    MemberAuthor

    I'd just like to have "stop", which doesn't delete (and does destroy containers) and "rm" which deletes everything. Simple, expected behavior. And of course, it works for my own web dev workflow where I have many inactive dev sites at any given time.

  10. rfay commented on Jan 31, 2018

    @rfay
    MemberAuthor

    Added this to current sprint. I think it's critical for us to make this move before 1.0. And it's so simple. ddev stop deletes containers but not the db. ddev rm deletes containers and db. Nothing deletes the settings files.

  11. rickmanelius commented on Feb 6, 2018

    @rickmanelius
    Contributor

    Not ignoring this, but a few responses:

    • DDEV wraps Docker's CLI and a stop state is very much a valid state in both docker and vagrant (suspend or halt).
    • DDEV-UI would require a lot more hoop jumping if projects couldn't exist in a stopped state given a user would have to re-add each time versus toggle.
    • Even on the CLI, having them in a stopped state can be helpful to know where they are and to still target them or check their existence.
    • I agree that biasing users towards removing containers makes sense given how quick and easy it is to pull them back up.
    • I'm not opposed to splitting the commands out further so as to not rely on the --remove-data flag so remove does double duty. To that end, a simpler approach while keeping MOST of the same expected behavior would be the following 3:
      • stop (stop containers).
      • remove (remove containers).
      • delete (deletes data).

    I really feel strongly about keeping the stopped state. I hear @cweagans wanting to NOT make a distinction between delete/remove but there are two use cases. It's completely valid to want to remove the infra/stack while retaining the database/codebase/files. And defaulting to requiring --keep-data means that a person moving somewhat quickly would be more likely to make that mistake versus having to consciously specify the removal of data. Splitting into two commands also makes it more deliberate.

    I understand that I may be outnumbered here, but I'm trying to balance various experience levels and workflows.

  12. rfay commented on Feb 7, 2018

    @rfay
    MemberAuthor

    My reactions are based around helping the user of both ddev and ddev-ui to have maximum info and capability:

    DDEV wraps Docker's CLI and a stop state is very much a valid state in both docker and vagrant (suspend or halt).

    Yes, but our users probably don't actually care about what docker or vagrant do, they just want to get their job done, so it's more important to make it obvious to them.

    DDEV-UI would require a lot more hoop jumping if projects couldn't exist in a stopped state given a user would have to re-add each time versus toggle

    Yes, but continuing a potentially obscure approach in order to accommodate another tool is the road to hell. Instead, let's add a sqlite database of existing projects and report that on ddev list for ddev-ui.

    Even on the CLI, having them in a stopped state can be helpful to know where they are and to still target them or check their existence.

    Again, rework ddev list to know about all projects (not just ones that are in docker) and this is completely solved.

    Essentially, a long time ago it was technically convenient to track docker's state with ddev. It doesn't really work out now, so let's stop doing it. Let's keep a sqlite database of existing projects, and not use docker for stopped projects. This isn't very hard, and resolves all of the issue.

  13. rickmanelius commented on Feb 7, 2018

    @rickmanelius
    Contributor

    Hi @rfay. I know that training and education is near and dear to your heart, so my comments were not meant to imply that you're not understanding of not advocating for their best interests. However, until the sqlite database upgrade was surfaced as a means to address my concern about ddev-ui's reliance on ddev list which itself relied on a stop state, I couldn't in good conscious proceed. And given that you made a comment that this ticket by itself "it's so simple" made me cringe a little because I don't fully understand the scope of changes necessary to maek the sqlite solution work. To that end, if we can get a separate ticket provisioned and note all changes required to make that happen, it would give me more confidence in proceeding forward.

    As for whether to mirror the command names for docker or not, this may be where we simply agree to disagree on its importance. You're right from the perspective of an end-user that never realizes docker is under the hood, they won't care in the least. I just prefer those that can/do live between the worlds not have to think too hard about translating docker rm to ddev stop versus a direct 1:1 relationship and understanding. That said, if we solve the global metadata item I'm willing to bend and not fight on this one.

  14. rfay commented on Feb 7, 2018

    @rfay
    MemberAuthor

    We've talked a number of times about using a technique other than docker state to track project statuses, mostly we've suggested a yaml file. Recently Brad got on a tear about using sqlite instead for jobs like this, and it would be totally reasonable. But either way, keeping track of project status in ~/.ddev completely independently of docker would solve all the problems that we have with docker state and this issue. I'm sorry that we haven't surfaced this approach as an issue; I'll fix that right now (#642)

    The reality is that we already have a number of problems that can't be solved by docker status tracking and argue strongly for ddev actually tracking projects that have been set up:

    • We are unable to prevent collisions of the unique name of a project unless one of them is alive.
    • That inability to prevent collisions can cause one project to take over (and most likely corrupt) another project's saved database (because the database is keyed by name, and we don't have a way to prevent name collisions)
    • We don't have a way to tell people about all the projects they have set up at all, which would logically be presented somehow by ddev list.
  15. 12 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Prioritized

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions