Shared Vagrantfile with developer specific settings

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Shared Vagrantfile with developer specific settings

Mark Waddle
First off Vagrant is an awesome tool and I am very excited for HashiCorp and the more extendable future of Vagrant. I can't wait to contribute to an AWS plugin.

And now for my question:
I have a shared Vagrantfile that all members on my team are using, but some of the settings need to be specified differently for each of us, depending on our host setup. These variances are not visible to Vagrant and are mostly at the discretion of the developer.

For example, for our web box, we share the web app root directory with the guest so we can code with our preferred tools. This directory can be in different locations on our dev machines, depending on our preferences. Another example is the amount of memory or hard disk allocated to each VM instance. One dev working on his laptop might want to keep the resource allocation rather small while another dev might be using a large stationary workstation and wants to allocate significant resources that are closer to production.

Is there a recommended approach for this? Vagrantfile examples would be great!

Thanks,
Mark

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: Shared Vagrantfile with developer specific settings

Brian Lalor
On Feb 11, 2013, at 1:17 PM, Mark Waddle <[hidden email]> wrote:

Is there a recommended approach for this? Vagrantfile examples would be great!

I've been wondering the same thing.  Since the Vagrantfile is essentially just Ruby, you could use environment variables, or have some kind of overrides that could be set with a non-versioned JSON file in the project directory.

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: Shared Vagrantfile with developer specific settings

Andrew Kerr
This is similar to what our team does.  Our Vagrantfile sets up a bunch of default variables, and then does a:

load 'user.rb'

The user.rb file is a non-version-controlled file that developers can use to override certain variables.  This made it simpler for us to deal with Windows vs. Mac as host OS, etc.

Andrew



On Mon, Feb 11, 2013 at 1:41 PM, Brian Lalor <[hidden email]> wrote:
On Feb 11, 2013, at 1:17 PM, Mark Waddle <[hidden email]> wrote:

Is there a recommended approach for this? Vagrantfile examples would be great!

I've been wondering the same thing.  Since the Vagrantfile is essentially just Ruby, you could use environment variables, or have some kind of overrides that could be set with a non-versioned JSON file in the project directory.

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Andrew Kerr
Principal Software Engineer
Fluid, Inc.
www.fluid.com | www.facebook.com/FluidInc | www.twitter.com/Fluid

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: Shared Vagrantfile with developer specific settings

Matthieu Vachon
In reply to this post by Mark Waddle
We had the same problem in our team.

So, I decided to create Nugrant, a Vagrant plugin that will let you specify user-specific configuration values.

For example, you define your Vagranfile like so:

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant::Config.run do |config|
  config.user.defaults = {
    "vm" => {
      "ip" => "10.0.0.2"
    }
  }

  # Some configuration values left out

  config.vm.network :hostonly, config.user.vm.ip

  config.vm.share_folder "git", "/git", config.user.repository.git
  config.vm.share_folder "data", "/data", config.user.repository.data

  config.vm.provision :chef_solo do |chef|
    chef.cookbooks_path = [config.user.chef.cookbooks_path]
    chef.roles_path = [config.user.chef.roles_path]

    # Some chef configurations values left out
  end
end

Everything under `config.user` (expect defaults which set default values) is some user defined configuration values. You place a `.vagrantuser` at the same location of your Vagrantfile, and it looks like this:

chef:
  cookbooks_path: "C:/kitchen/cookbooks"
  roles_path: "C:/kitchen/roles"
  nodes_path: "C:/kitchen/nodes"
repository:
    git: "C:/Some/Path/To/Git"
    data: "C:/Some/Path/To/Data"

The `.vagrantuser` use file can also be placed in your home directory, so it is easy to set system-wide parameters. For example, my chef configuration are placed in `~/.vagrantuser` so I don't have to specify them each time.

Installing for current version of Vagrant should be straight foward: `vagrant gem install nugrant`.

If you need more information, you can check the github page of the plugin or ask me some questions:

https://github.com/maoueh/nugrant

Regards,
Matt

Disclaimer: I'm the author of this plugin/library

On Monday, February 11, 2013 1:17:33 PM UTC-5, Mark Waddle wrote:
First off Vagrant is an awesome tool and I am very excited for HashiCorp and the more extendable future of Vagrant. I can't wait to contribute to an AWS plugin.

And now for my question:
I have a shared Vagrantfile that all members on my team are using, but some of the settings need to be specified differently for each of us, depending on our host setup. These variances are not visible to Vagrant and are mostly at the discretion of the developer.

For example, for our web box, we share the web app root directory with the guest so we can code with our preferred tools. This directory can be in different locations on our dev machines, depending on our preferences. Another example is the amount of memory or hard disk allocated to each VM instance. One dev working on his laptop might want to keep the resource allocation rather small while another dev might be using a large stationary workstation and wants to allocate significant resources that are closer to production.

Is there a recommended approach for this? Vagrantfile examples would be great!

Thanks,
Mark

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: Shared Vagrantfile with developer specific settings

Mark Waddle
Thanks Matt, that hits the spot! I can simply provide an example .vagrantuser file (.vagrantuser.example) in version control that devs can copy and edit. The method for specifying defaults makes sense and the parameters command sounds helpful.

On Wednesday, February 13, 2013 7:17:40 AM UTC-8, Matthieu Vachon wrote:
We had the same problem in our team.

So, I decided to create Nugrant, a Vagrant plugin that will let you specify user-specific configuration values.

For example, you define your Vagranfile like so:

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant::Config.run do |config|
  config.user.defaults = {
    "vm" => {
      "ip" => "10.0.0.2"
    }
  }

  # Some configuration values left out

  config.vm.network :hostonly, config.user.vm.ip

  config.vm.share_folder "git", "/git", config.user.repository.git
  config.vm.share_folder "data", "/data", config.user.repository.data

  config.vm.provision :chef_solo do |chef|
    chef.cookbooks_path = [config.user.chef.cookbooks_path]
    chef.roles_path = [config.user.chef.roles_path]

    # Some chef configurations values left out
  end
end

Everything under `config.user` (expect defaults which set default values) is some user defined configuration values. You place a `.vagrantuser` at the same location of your Vagrantfile, and it looks like this:

chef:
  cookbooks_path: "C:/kitchen/cookbooks"
  roles_path: "C:/kitchen/roles"
  nodes_path: "C:/kitchen/nodes"
repository:
    git: "C:/Some/Path/To/Git"
    data: "C:/Some/Path/To/Data"

The `.vagrantuser` use file can also be placed in your home directory, so it is easy to set system-wide parameters. For example, my chef configuration are placed in `~/.vagrantuser` so I don't have to specify them each time.

Installing for current version of Vagrant should be straight foward: `vagrant gem install nugrant`.

If you need more information, you can check the github page of the plugin or ask me some questions:


Regards,
Matt

Disclaimer: I'm the author of this plugin/library

On Monday, February 11, 2013 1:17:33 PM UTC-5, Mark Waddle wrote:
First off Vagrant is an awesome tool and I am very excited for HashiCorp and the more extendable future of Vagrant. I can't wait to contribute to an AWS plugin.

And now for my question:
I have a shared Vagrantfile that all members on my team are using, but some of the settings need to be specified differently for each of us, depending on our host setup. These variances are not visible to Vagrant and are mostly at the discretion of the developer.

For example, for our web box, we share the web app root directory with the guest so we can code with our preferred tools. This directory can be in different locations on our dev machines, depending on our preferences. Another example is the amount of memory or hard disk allocated to each VM instance. One dev working on his laptop might want to keep the resource allocation rather small while another dev might be using a large stationary workstation and wants to allocate significant resources that are closer to production.

Is there a recommended approach for this? Vagrantfile examples would be great!

Thanks,
Mark

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: Shared Vagrantfile with developer specific settings

Matthieu Vachon
Glad it's what you were looking for. I improved the `vagrant user parameters` command recently to add some switch to see only some subset (-p|--project, -u|--user, -s|--system, -d|--defaults) but didn't take time to update the documentation about it. I will probably do it next week.

And sorry if you received a kind-of duplicate post from me, I thought at first that my post didn't make it through because I was unable to see them. Anyway, sorry for the spam :)

Regards,
Matt

On Wednesday, February 13, 2013 11:54:51 AM UTC-5, Mark Waddle wrote:
Thanks Matt, that hits the spot! I can simply provide an example .vagrantuser file (.vagrantuser.example) in version control that devs can copy and edit. The method for specifying defaults makes sense and the parameters command sounds helpful.

On Wednesday, February 13, 2013 7:17:40 AM UTC-8, Matthieu Vachon wrote:
We had the same problem in our team.

So, I decided to create Nugrant, a Vagrant plugin that will let you specify user-specific configuration values.

For example, you define your Vagranfile like so:

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant::Config.run do |config|
  config.user.defaults = {
    "vm" => {
      "ip" => "10.0.0.2"
    }
  }

  # Some configuration values left out

  config.vm.network :hostonly, config.user.vm.ip

  config.vm.share_folder "git", "/git", config.user.repository.git
  config.vm.share_folder "data", "/data", config.user.repository.data

  config.vm.provision :chef_solo do |chef|
    chef.cookbooks_path = [config.user.chef.cookbooks_path]
    chef.roles_path = [config.user.chef.roles_path]

    # Some chef configurations values left out
  end
end

Everything under `config.user` (expect defaults which set default values) is some user defined configuration values. You place a `.vagrantuser` at the same location of your Vagrantfile, and it looks like this:

chef:
  cookbooks_path: "C:/kitchen/cookbooks"
  roles_path: "C:/kitchen/roles"
  nodes_path: "C:/kitchen/nodes"
repository:
    git: "C:/Some/Path/To/Git"
    data: "C:/Some/Path/To/Data"

The `.vagrantuser` use file can also be placed in your home directory, so it is easy to set system-wide parameters. For example, my chef configuration are placed in `~/.vagrantuser` so I don't have to specify them each time.

Installing for current version of Vagrant should be straight foward: `vagrant gem install nugrant`.

If you need more information, you can check the github page of the plugin or ask me some questions:


Regards,
Matt

Disclaimer: I'm the author of this plugin/library

On Monday, February 11, 2013 1:17:33 PM UTC-5, Mark Waddle wrote:
First off Vagrant is an awesome tool and I am very excited for HashiCorp and the more extendable future of Vagrant. I can't wait to contribute to an AWS plugin.

And now for my question:
I have a shared Vagrantfile that all members on my team are using, but some of the settings need to be specified differently for each of us, depending on our host setup. These variances are not visible to Vagrant and are mostly at the discretion of the developer.

For example, for our web box, we share the web app root directory with the guest so we can code with our preferred tools. This directory can be in different locations on our dev machines, depending on our preferences. Another example is the amount of memory or hard disk allocated to each VM instance. One dev working on his laptop might want to keep the resource allocation rather small while another dev might be using a large stationary workstation and wants to allocate significant resources that are closer to production.

Is there a recommended approach for this? Vagrantfile examples would be great!

Thanks,
Mark

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: Shared Vagrantfile with developer specific settings

Matthieu Vachon
I forgot to mention that if you hit any issue or would like some improvements/new features, don't hesitate to report it in the project's Github issues tracker.

On Wednesday, February 13, 2013 12:36:33 PM UTC-5, Matthieu Vachon wrote:
Glad it's what you were looking for. I improved the `vagrant user parameters` command recently to add some switch to see only some subset (-p|--project, -u|--user, -s|--system, -d|--defaults) but didn't take time to update the documentation about it. I will probably do it next week.

And sorry if you received a kind-of duplicate post from me, I thought at first that my post didn't make it through because I was unable to see them. Anyway, sorry for the spam :)

Regards,
Matt

On Wednesday, February 13, 2013 11:54:51 AM UTC-5, Mark Waddle wrote:
Thanks Matt, that hits the spot! I can simply provide an example .vagrantuser file (.vagrantuser.example) in version control that devs can copy and edit. The method for specifying defaults makes sense and the parameters command sounds helpful.

On Wednesday, February 13, 2013 7:17:40 AM UTC-8, Matthieu Vachon wrote:
We had the same problem in our team.

So, I decided to create Nugrant, a Vagrant plugin that will let you specify user-specific configuration values.

For example, you define your Vagranfile like so:

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant::Config.run do |config|
  config.user.defaults = {
    "vm" => {
      "ip" => "10.0.0.2"
    }
  }

  # Some configuration values left out

  config.vm.network :hostonly, config.user.vm.ip

  config.vm.share_folder "git", "/git", config.user.repository.git
  config.vm.share_folder "data", "/data", config.user.repository.data

  config.vm.provision :chef_solo do |chef|
    chef.cookbooks_path = [config.user.chef.cookbooks_path]
    chef.roles_path = [config.user.chef.roles_path]

    # Some chef configurations values left out
  end
end

Everything under `config.user` (expect defaults which set default values) is some user defined configuration values. You place a `.vagrantuser` at the same location of your Vagrantfile, and it looks like this:

chef:
  cookbooks_path: "C:/kitchen/cookbooks"
  roles_path: "C:/kitchen/roles"
  nodes_path: "C:/kitchen/nodes"
repository:
    git: "C:/Some/Path/To/Git"
    data: "C:/Some/Path/To/Data"

The `.vagrantuser` use file can also be placed in your home directory, so it is easy to set system-wide parameters. For example, my chef configuration are placed in `~/.vagrantuser` so I don't have to specify them each time.

Installing for current version of Vagrant should be straight foward: `vagrant gem install nugrant`.

If you need more information, you can check the github page of the plugin or ask me some questions:


Regards,
Matt

Disclaimer: I'm the author of this plugin/library

On Monday, February 11, 2013 1:17:33 PM UTC-5, Mark Waddle wrote:
First off Vagrant is an awesome tool and I am very excited for HashiCorp and the more extendable future of Vagrant. I can't wait to contribute to an AWS plugin.

And now for my question:
I have a shared Vagrantfile that all members on my team are using, but some of the settings need to be specified differently for each of us, depending on our host setup. These variances are not visible to Vagrant and are mostly at the discretion of the developer.

For example, for our web box, we share the web app root directory with the guest so we can code with our preferred tools. This directory can be in different locations on our dev machines, depending on our preferences. Another example is the amount of memory or hard disk allocated to each VM instance. One dev working on his laptop might want to keep the resource allocation rather small while another dev might be using a large stationary workstation and wants to allocate significant resources that are closer to production.

Is there a recommended approach for this? Vagrantfile examples would be great!

Thanks,
Mark

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: Shared Vagrantfile with developer specific settings

Taciano Tres
In reply to this post by Mark Waddle
Doesn't Vagrant already cover this use case with Vagrantfile Load Order? Or I'm missing something?

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: Shared Vagrantfile with developer specific settings

Matthieu Vachon
No, the Vagrant Load Order partially solve the issue. A big problem is that it does not deep merge configuration, at least, from what I have tried. For example, if you provision with Chef Solo, you probably need to specify path to your cookbooks. If you specify them in `~/vagrant.d/Vagrantfile`, they are not seen by the Vagrantfile in the project. This could probably be fixed within Vagrant directly.

Other use cases are not covered by the Load Order mechanism. You can have user-parameters in your home Vagrantfile (`~/vagrant.d/Vagrantfile`), but they will be shared for all your box. You would not be able to specify user-parameters on a project basis. This is a limitation for some use cases, but not all. 

I think Nugrant is more suited for user-specific parameters than what Vagrant Load Order provides.

Regards,
Matt

On Thursday, February 14, 2013 7:49:21 PM UTC-5, Taciano Tres wrote:
Doesn't Vagrant already cover this use case with Vagrantfile Load Order? Or I'm missing something?

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.