localwiki / localwiki-backend-server

Primary LocalWiki backend server environment
GNU General Public License v2.0
48 stars 16 forks source link

Vagrant brings up two machines with port collisions #79

Closed pm5 closed 8 years ago

pm5 commented 8 years ago

I just started setting up a dev environment. Following the instructions in INSTALL, the vagrant up step brings up some error messages:

==> master: Clearing any previously set forwarded ports...
Vagrant cannot forward the specified ports on this VM, since they
would collide with some other application that is already listening
on these ports. The forwarded port to 8081 is already in use
on the host machine.

To fix this, modify your current project's Vagrantfile to use another
port. Example, where '1234' would be replaced by a unique host port:

  config.vm.network :forwarded_port, guest: 80, host: 1234

Sometimes, Vagrant will attempt to auto-correct this for you. In this
case, Vagrant was unable to. This is usually because the guest machine
is in a state which doesn't allow modifying port forwarding.

Looking at the Vagrantfile it seems that it's trying to setup two machines ("dev" and "master") with the same forwarded port mapping. Thus the port collision. Adding auto_correct: true fixed the problem for me.

Maybe we should assign two sets of fixed port mapping for the two machines. Thoughts?

philipn commented 8 years ago

Good catch! I'd been commenting out the "master" machine when developing. One option would be to just have a single machine in the Vagrantfile.

pm5 commented 8 years ago

Well, if two machines are not required for every scenario then I'd say auto correction is good enough. That way anyone using only one machine can still choose to comment out the other and expect the same behavior.

I'm just starting to work with this codebase, so I'm not sure if production-style testing in vagrant is much needed. Sounds reasonable for me to keep it, though.

pm5 commented 8 years ago

The fix: #80