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

Development domains don't work #2

Open
waldoj opened this issue Jun 20, 2013 · 11 comments
Open

Development domains don't work #2

waldoj opened this issue Jun 20, 2013 · 11 comments
Labels

Comments

@waldoj
Copy link
Member

waldoj commented Jun 20, 2013

PuPHPet insists on setting up a VirtualHost, but that necessitates editing /etc/hosts in order to map that virtual host properly. @markjaquith has some localdev Vagrant code that will resolve that. This may, as a result, resolve #1, too.

@markjaquith
Copy link

I wasn't happy with the state of my code — very much hardcoded junk that I've just been manually changing. Here is a much better solution!

https://github.com/cogitatio/vagrant-hostsupdater

@waldoj
Copy link
Member Author

waldoj commented Jun 29, 2013

That looks perfect—thanks so much, Mark!

@markjaquith
Copy link

Also, it looks like Vagrant plugins are installed globally, and there is no canonical way to install them from within a Vagrantfile. So this is what I rigged up:

# Install the required plugins
def require_plugin plugin
  puts `cd ~/ >/dev/null && vagrant plugin install #{plugin}` unless `cd ~/ && vagrant plugin list`.chomp.split("\n").select{|x| x.include? plugin}.length > 0
end

require_plugin 'vagrant-hostsupdater'

Why the cd? Because if the vagrant command is run from within a Vagrantfile-containing directory, you get an infinite loop. 😄

@markjaquith
Copy link

This works a charm!

config.vm.hostname = "example.com"
config.vm.network :private_network, :ip => "192.168.50.4"
config.hostsupdater.aliases = %w{www.example.com foo.example.com}
config.hostsupdater.remove_on_suspend = true

Don't forget the remove_on_suspend part. Not sure why that isn't the default.

waldoj added a commit that referenced this issue Jul 8, 2013
Per #2. This still doesn't work (it fails with `Unknown configuration
section 'hostsupdater'.`), but it's a step in the right direction.
@gregelin
Copy link

gregelin commented Oct 9, 2013

@markjaquith I could not get the hostupdater plugin to work with Vagrant 1.3.4. Did it definitely work for you? What OS are you using?

@markjaquith
Copy link

Definitely works. OS X.

@gregelin
Copy link

gregelin commented Oct 9, 2013

@markjaquith I just re-downloaded statedecoded-vagrant and ran vagrant-up. I get an error.

Vagrant:                                                                                                                                                                      
* Unknown configuration section 'hostsupdater'. 

Here is asciinema of it: http://asciinema.org/a/5834

@gregelin
Copy link

gregelin commented Oct 9, 2013

Seems to work if I install the plugin from the host command line before running vagrant up.

bash-3.2$ vagrant plugin install vagrant-hostsupdater
Installing the 'vagrant-hostsupdater' plugin. This can take a few minutes...
Installed the plugin 'vagrant-hostsupdater (0.0.10)'!
bash-3.2$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
[default] Importing base box 'precise64'...
[default] Matching MAC address for NAT networking...
[default] Setting the name of the VM...
...

@markjaquith
Copy link

Huh. Odd. That code snippet I provided should have auto-installed it if it wasn't present.

@gregelin
Copy link

I previously tried a variety of ways to have vagrant install the plugin from within running the file but with no luck either so far. Have you tried uninstalling the plugin on you system and then running vagrant up to see if you can replicate what I am encountering?

The plugins would be awesome if Vagrant installed them while running the Vagrantfile. (And a bit odd vagrant does not considering how much automated magic it does.

@waldoj
Copy link
Member Author

waldoj commented Oct 10, 2013

@gregelin, this might call for opening a ticket on @Cogitatio's repository for Vagrant::Hostsupdater. Getting a development domain working isn't crucial for The State Decoded, but it's surely going to be important for y'all to be able to get working reliably!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants