Skip to content
This repository has been archived by the owner on Dec 20, 2023. It is now read-only.

Allow multiple hypernode vagrants at the same time #30

Merged
merged 3 commits into from
Feb 12, 2016
Merged

Allow multiple hypernode vagrants at the same time #30

merged 3 commits into from
Feb 12, 2016

Conversation

vdloo
Copy link
Member

@vdloo vdloo commented Feb 12, 2016

Previously there would be collision issues like ports, aliases and the hardcoded private IP.

  • use dhcp for private networking
  • get assigned IP address from the node with machine.communicate for updating hosts
  • keep the hypernode.local alias.

If you only have one hypernode-vagrant running you can still access it
at hypernode.local for backwards compatibility with previous versions of this box.

  • add alias for box name
  • box name is directory if dir is not named hypernode-kamikaze

This is for when you use the Vagrantfile in the repository for a different project. If you put the Vagrantfile in a directory named 'mywebshop' the hypernode-vagrant will be available at http://mywebshop.hypernode.local

  • box name is parent if dir named hypernode-kamikaze

This is for when you create a complete hypernode-vagrant checkout in your project's directory. If you have a project directory named 'mywebshop' and you git clone this repository in that directory, the box will be named 'mywebshop' as well and is also accessible on http://mywebshop.hypernode.local

  • box name is specified environment variable

If you don't want to name the hypernode-vagrant box after the directory it is in, you can specify an env var to override the name.

HYPERNODE_VAGRANT_NAME="mywebshop" vagrant up

it will then be accessible at http://mywebshop.hypernode.local as well.

  • add alias for hash of Vagrantfile path

Because you can run two hypernode-vagrant boxes with the same name at the same time (for example if you want to test two different branches for a shop) an alias is also added that is unique for the path of the Vagrantfile (because you won't be able to access both shops on http://webshop.hypernode.local. The path hash alias is guaranteed to be unique because you can only have one Vagrantfile per directory.

This will create aliases like:

http://b033d-mywebshop-magweb-vgr.nodes.hypernode.local
http://eb7b8-mywebshop-magweb-vgr.nodes.hypernode.local
  • link the compiled varnish config to the right directory for the box's
    hostname during provisioning
  • the default index.php shows you the name of the box it's running on

looks like:
screen1

@allardhoeve
Copy link
Contributor

Can you put that textblob in a README? ;)

@@ -24,11 +25,48 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.hostmanager.manage_host = true
config.hostmanager.ignore_private_ip = false
config.hostmanager.include_offline = true

# Get the dynamic hostname from the running box so we know what to put in
# /etc/hosts even though we don't specify a static private ip address
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume you found this somewhere on StackOverflow or the like. Can you link it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@allardhoeve
Copy link
Contributor

Looks awesome!

@vdloo vdloo mentioned this pull request Feb 12, 2016
- use dhcp for private networking
- get assigned IP address from the node with machine.communicate
- keep the hypernode.local alias.
- add alias for box name
- box name is directory if dir is not named hypernode-kamikaze
- box name is parent if dir named hypernode-kamikaze
- box name is specified environment variable
- add alias for hash of Vagrantfile path
- link the compiled varnish config to the right directory for the box's
  hostname during provisioning
- the default index.php shows you the name of the box it's running on
- update README
vdloo added a commit that referenced this pull request Feb 12, 2016
…t-the-same-time

Allow multiple hypernode vagrants at the same time
@vdloo vdloo merged commit 6a995c2 into ByteInternet:master Feb 12, 2016
@vdloo vdloo deleted the allow-multiple-hypernode-vagrants-at-the-same-time branch February 12, 2016 11:42
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants