craftcms / nitro

Speedy local dev environment for @craftcms.
https://getnitro.sh
MIT License
178 stars 24 forks source link

Don't start all sites when adding a new site #378

Closed johnwbaxter closed 2 years ago

johnwbaxter commented 3 years ago

When I add a new site using nitro add, it goes through the add site process and then starts up all the sites.

The command and output is here:

nitro add Adding site… Enter the hostname [deploy.nitro]: example.loc ✓ setting hostname to example.loc ✓ adding site ~/sites/example/deploy Enter the web root for the site [public_html]: ✓ using web root public_html Choose a PHP version:

  1. 8.0
  2. 7.4
  3. 7.3
  4. 7.2
  5. 7.1
  6. 7.0 Enter your selection: 2 ✓ setting PHP version 7.4 Add a database for the site [Y/n] y Enter the new database name: example_dev … creating database example_dev ✓ Database added 💪 Should we update the env file? [y/N] y .env updated! New site added! 🎉 Apply changes now [Y/n]? y Checking network… ✓ network ready Checking proxy… ✓ proxy ready Checking databases… … checking mysql-5.7-3306.database.nitro ✓ Checking services… … checking dynamodb service ✓ … checking mailhog service ✓ … checking redis service ✓ Checking sites… … checking blah.loc ✓ … checking blah1.loc ✓ … checking blah2.loc ✓ … checking blah3.loc ✓ … checking blah4.loc ✓ … checking blah5.loc ✓ … checking blah6.loc ✓ … checking blah7.loc ✓ … checking blah8.loc ✓ … checking blah9.loc ✓ … checking blah10.loc ✓ … checking blah11.loc ✓ Checking proxy… … updating proxy ✓ Updating hosts file (you might be prompted for your password) [sudo] password for johnbaxter: Cleaning up... Nitro is up and running 😃

I'd really like it to not start all my sites when i add a new one!!

jamiematrix commented 3 years ago

I was about to ask if there was a way to pause (or stop) individual sites. I have several sites setup and they're always running. I'm not likely to work on all the sites all the time, but don't want to remove a site once finished with only to go through re-creating it if I need to come back to it.

I guess manually stopping them in Docker is a temporary solution?

johnwbaxter commented 3 years ago

@jamiematrix You can start and stop individual sites using NItro!

nitro start blah.loc

nitro stop blah.loc

jamiematrix commented 3 years ago

@johnwbaxter yeh, I know.

I was, erm, just, er ... causing trouble? Oh look! Sunshine! quick, shall I delete or hide my first comment!?

lindseydiloreto commented 3 years ago

Agreed! I like to keep only one project running at a time. Rarely do I want to start up two dozen existing sites, just because I've added a (completely unrelated) new one.

This mentality aligns with #284, which I would also love to see implemented.

MattWilcox commented 3 years ago

100% - my system is out of resources and spinning up 28 containers when I only need 4 or 5 is a surefire way to watch my MySQL container just suddenly STOP being there. I have an M1... I can not add more RAM.

jasonmccallister commented 3 years ago

Hi all, we are adding support for this in 3.0 with the nitro ensite and nitro dissite commands. This will add a new option on the site for us to determine if we should start the site or not.

jasonmccallister commented 2 years ago

Hi, we are closing this issue as we have decided to retire Nitro, so no additional work will occur on this project. You can read the official blog post here https://craftcms.com/blog/retiring-craft-nitro. We appreciate everyones feedback and involvement and we look forward to refocusing our efforts on Cloud!

If you're looking for a new local development environment, we recommend DDEV and have a knowledge base article to help you with the transition: https://craftcms.com/knowledge-base/migrating-from-craft-nitro-to-ddev.