Git Product home page Git Product logo

Comments (10)

talios avatar talios commented on May 10, 2024

You could just comment out chef from the Vagrantfile. However - I suspect ( from discussion ) what you really want is a "vagrant shutdown" command, that first shuts the box down rather than just suspends the vm.

When doing 'vagrant reload' which re runs chef, chef isn't as slow as the initial run, and it's more likely its individual recipes that you're running which are slow, which could be made optional, or 'run once' somehow.

from vagrant.

mitchellh avatar mitchellh commented on May 10, 2024

Chef running on every "up" is what it was designed to do. Chef doesn't do anything if there is nothing to do (i.e. it doesn't reinstall packages, it doesn't restart servers, etc.), so the latter runs typically only take a few seconds.

Of course, and this will be much easier in the Vagrant 0.3.x series (currently in master), you can create a custom script/rake task to do this by extending Vagrant =]

Mitchell

from vagrant.

astubbs avatar astubbs commented on May 10, 2024

that would make sense I suppose, because the vm gets deleted every time - which I don't want :/
my chef seems to take quite a long time to decide that the packages don't need re-installing. I'm guessing it looks out over the net for updates or something :/ takes way too long, whatever it's doing. - oh - but hold on, if you're vm is deleted when you vagrant down, then f course it's going to re=install. I haven't tried halt yet. maybe vangrant down should be renamed vagrant delete or something.

from vagrant.

mitchellh avatar mitchellh commented on May 10, 2024

astubbs,

I've thought this one through and I simply don't see a need for this sort of command. Chef will run and do nothing if it is re-run (even if it takes some time to realize this). If there are more compelling reasons to add an option to not run chef (if it is somehow configured to run) when vm is reloaded, please bring it back up.

Thanks,
Mitchell

from vagrant.

astubbs avatar astubbs commented on May 10, 2024

Well I just don't see why chef needs to be so tightly tied to the boot process. Why would you ever want to re-run chef, unless you change your script or stuff up your system? I see running chef as the exception to the boot process, not the norm..

Is creating such a command too much of a PITA? If so, I might take a look at it, to help out with the load that is. Or is there another reason to not implement it, other than also that you don't see a need?

from vagrant.

mitchellh avatar mitchellh commented on May 10, 2024

astubbs,

Chef isn't tightly tied to the boot process. Its only run if its explicitly enabled by the Vagrantfile. =] And I'd typically pose your question the other way: "Why wouldn't you want to re-run chef?" It does no harm to re-run it (it simply does nothing if everything is setup properly already).

If you really don't want to re-run chef on restarting the machine, just comment out the config.vm.provisioner line. I have multiple projects that use chef server to provision quite a few recipes (about 15 or so) and restarting only takes about 10 seconds for chef to realize everything is up to date. Plus I don't restart that often so its not that big of a deal.

What is causing you to restart so often that the small delay for chef to check that everything is up to date is causing this grief?

Mitchell

from vagrant.

talios avatar talios commented on May 10, 2024

From what I understand of Tony's request, I suspect the root cause of the problem is there isn't a "vagrant shutdown" command, that does what "vagrant down" does, but doesn't physically destroy the vm.

Whilst there is a suspend/resume command set, there isn't one that also cleanly shuts down the server first.

Personally I think suspend/resume is all you need, and chef running on startupp is fine, I wonder if part of it just part of the pain process of shifting to a managed environment - it seems common with people just shifting to puppet/chef managed systems.

from vagrant.

mitchellh avatar mitchellh commented on May 10, 2024

talios,

I see what you are saying. There is actually a vagrant halt command. This is equivalent of pulling the power plug of a machine. There is no "graceful shutdown" command since this is pretty OS-specific and Vagrant is OS-agnostic. You can create a rake task to gracefully shut down the machine: http://vagrantup.com/docs/rake.html

But to stop a machine there are three things available:

  • vagrant down - Completely destroy the environment. This is meant as a generally "I'm done working for the day and don't want to waste disk space with my virtual disk" type of thing. Note: This command is actually now vagrant destroy in master.
  • vagrant suspend - Saves the CPU state (registers, program counter, etc.) and can be resumed exactly where it left off with a vagrant resume or vagrant up again.
  • vagrant halt - Forcefully shut down. The machine can be started up again with a vagrant up (it won't reimport).

Mitchell

from vagrant.

talios avatar talios commented on May 10, 2024

Mitchel - the rake integration looks like it would do the trick nicely.

I had a thought that Tony's problem might also not be that Chef runs on every run, but that certain chef recipes always run/rerun, which given Tony's started with some recipes I wrote after about 3 days of using chef, I probably missed things like checksum/creates flags.

from vagrant.

mitchellh avatar mitchellh commented on May 10, 2024

Talios,

This is definitely a possibility. Tony, you may want to look into the "not_if" and so on methods that can be within recipes. These allow chef to do simple tests to determine whether or not to run each task.

Mitchell

from vagrant.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.