Skip to content
Please note that GitHub no longer supports your web browser.

We recommend upgrading to the latest Google Chrome or Firefox.

Learn more
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

Controlling services in bulk or better/flexible --all behavior #151

Closed
ihorvorotnov opened this issue Mar 1, 2018 · 8 comments

Comments

Projects
None yet
4 participants
@ihorvorotnov
Copy link

commented Mar 1, 2018

The discussion started here.

Currently, you can only start|stop|reload services one by one or all of them at once with --all flag. However, in some cases, you need finer control.

For example, now PHP migrated to homebrew/core and comes with Apache as a dependency. I'm using Nginx instead of Apache, and have a lot of other related services. Here's the list:

  • dnsmasq
  • mailhog
  • nginx
  • memcached
  • redis
  • mariadb
  • blackfire-agent
  • php
  • httpd (the Apache service I don't need)

Basically, it's a local web development environment. Prior to this PHP migration, I could brew services start --all to bring it up, and brew services stop --all when done. Now I can't – it starts Apache as well.

Also, redis/memcached substitute each other in many cases, it makes sense to run only one of them at a time. Same applies to a different database engine, for example, MySQL and PostgreSQL, MongoDB etc. Also, Nginx, H2O. In most cases, you don't need them all to be running at the same time and running them one by one is annoying.

Of course, you can write a simple shell command to run required services in bulk, but wouldn't it be convenient to have a built-in command to handle some kind of "presets"?

@claui

This comment has been minimized.

Copy link
Member

commented Mar 1, 2018

This may not be helpful at all but inspired by this discussion, I’ve hacked together a really crude one-off prototype for a lightweight implementation of presets.

It uses one custom formula per preset, runs with homebrew-services as-is, and requires nothing else. Because it’s just a formula, it also auto-detects the dependencies.

Usage:

brew tap claui/services-bulk

brew install myservers

[sudo] brew services list

[sudo] brew services [start | restart | stop] myservers

To customize, just change this array:

  DEPENDENT_SERVICES = [
    "mariadb",
    "nginx",
    "php",
  ]

I’m surprised to see this actually works for me. Feel free to use it as a stop-gap until someone builds something more maintainable. (Or maybe in case the presets feature turns out too narrow to be added to homebrew-services proper.)

@ihorvorotnov

This comment has been minimized.

Copy link
Author

commented Mar 2, 2018

Thank you @claui, I'll give it a shot soon. Looks promising!

@MikeMcQuaid

This comment has been minimized.

Copy link
Member

commented Mar 5, 2018

This is a good idea, thanks for the detailed write up @ihorvorotnov!

@MikeMcQuaid

This comment has been minimized.

Copy link
Member

commented Mar 5, 2018

@steinmb Your comment was completely unrelated to this repository. The other thread was locked for a reason.

@Homebrew Homebrew deleted a comment from steinmb Mar 5, 2018

@steinmb

This comment has been minimized.

Copy link

commented Mar 5, 2018

@MikeMcQuaid Thank you for getting back to me, though deleting comments is to me a unusual way of treating other developers. Ended up there because other issues got closed and linked in here. Should I create a separate issue regarding the dependency issue?

@MikeMcQuaid

This comment has been minimized.

Copy link
Member

commented Mar 5, 2018

@steinmb No, we are not interested in more discussion of that issue or of Homebrew's moderation policy with non-maintainers or non-contributors (particularly when Homebrew's maintainers are currently being barraged with personal abuse).

nikolas added a commit to nikolas/github-drama that referenced this issue Mar 5, 2018

@steinmb

This comment has been minimized.

Copy link

commented Mar 6, 2018

@MikeMcQuaid Sorry to hear that. Take care and thank you for all your hard work.

@MikeMcQuaid

This comment has been minimized.

Copy link
Member

commented Mar 6, 2018

httpd will not be installed any more if you use the bottle: Homebrew/homebrew-core#24907

@MikeMcQuaid MikeMcQuaid closed this Mar 6, 2018

@lock lock bot added the outdated label Jan 2, 2019

@lock lock bot locked as resolved and limited conversation to collaborators Jan 2, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.