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

Add command to restart stopped containers and stop running containers #71

Merged
merged 4 commits into from
Aug 31, 2020

Conversation

likeadeckofcards
Copy link
Contributor

@likeadeckofcards likeadeckofcards commented Aug 27, 2020

Add commands for users that are not familiar with docker to start a stopped container as well as stop a running container.

issue #68

@alexmartinfr
Copy link
Contributor

alexmartinfr commented Aug 27, 2020

Good idea!

It would be worth offering all three start, stop & restart commands, in my opinion.
I was expecting them and had to resort to native Docker commands instead.

Edit: already suggested in #57

Copy link
Member

@mattstauffer mattstauffer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few questions; once answered I'll test it out and see if we can also test these behaviors. Also looking forward to @josecanhelp's thoughts.

Thanks for the PR!

app/Commands/RestartCommand.php Outdated Show resolved Hide resolved
app/Commands/StopCommand.php Show resolved Hide resolved
app/Commands/StopCommand.php Outdated Show resolved Hide resolved
@jonsugar
Copy link

jonsugar commented Aug 29, 2020

Could we change the command names? This could just be in my brain but…

…to me enable means to start or switch on and disable means to stop or switch off. Takeout thinks of them as to require or remove. Are we working more along the lines of composer?

# shows takeout UI, user selects MySQL version.
takeout require mysql 
takeout remove mysql

# takeout requires/removes specified version.
takeout require mysql:5.7
takeout remove mysql:5.7

Requiring and removing sits better in my head since now I know to start/stop the containers in my docker dashboard/command line, or as this PR introduces:

# shows UI, user selects MySQL version.
takeout start mysql
takeout stop mysql

# starts/stops specified version.
takeout start TO--mysql--<tag>
takeout stop TO--mysql--<tag>

P.S. I realize that the meaning of enable and disable are described in the README but I find them misleading.

@mattstauffer
Copy link
Member

@jonsugar You're thinking a little more like a Docker user here. We intentionally called them enable and disable to distance these commands from the idea of being like Composer, where you install it but it can be running or not running, because we couldn't think of a single compelling use case for why someone would need to stop a container, rather than just removing it.

However.. in the comments a case has been made! Removing a container is just fine, but booting the same container with the exact same settings later is harder if you have to remove it instead of potentially stopping it... at which point it now makes sense again to consider differentiating starting and stopping vs adding and removing.

So, now that we're doing that, there's a bit more a Composer-like-ness, but we're also starting it when we add it and stopping when we remove it.

This was what I was thinking about last week:

takeout add
takeout stop
takeout start
takeout remove

The biggest issue with those is that running them with no parameters feels a bit off--takeout stop sort of feels like it should stop takeout, but it's not going to. But I think I'm OK with that.

@mattstauffer
Copy link
Member

All this said, if we limit this PR to start and stop, we can hopefully just merge it in and then consider renaming the other commands.

The biggest question here is, what's the most appropriate syntax to use for passing a command into start or stop? This PR shows container ID; Jon's suggest is the volume name.

I personally think the volume name is pretty clumsy so I'm inclined to go for container ID.

Any thoughts?

@likeadeckofcards
Copy link
Contributor Author

I would use the container ID since that is displayed in the takeout list command. Optionally, leaving the container ID off of the command provides you with a list of takeout containers that are running or stopped for the user to chose from.

Copy link
Member

@mattstauffer mattstauffer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few notes on the code--thanks!

app/Commands/HelpCommand.php Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
app/Commands/StartCommand.php Outdated Show resolved Hide resolved
app/Commands/StartCommand.php Outdated Show resolved Hide resolved
app/Commands/StopCommand.php Outdated Show resolved Hide resolved
app/Commands/StopCommand.php Outdated Show resolved Hide resolved
app/Commands/StopCommand.php Outdated Show resolved Hide resolved
app/Commands/StartCommand.php Outdated Show resolved Hide resolved
@alexmartinfr
Copy link
Contributor

alexmartinfr commented Aug 31, 2020

I'm all for this new command set 👍

takeout add
takeout remove
takeout start
takeout stop

It makes much more sense than the actual, whether or not one is familiar with Docker.
That was the main pain point encountered during testing with a developer friend.

Thanks!

@mattstauffer mattstauffer merged commit a1fba95 into tighten:main Aug 31, 2020
@mattstauffer
Copy link
Member

Thanks!
I'm going to add a separate issue about writing tests for this; I want to merge it but I also want to get test coverage.

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

Successfully merging this pull request may close these issues.

4 participants