I think we can install mongodb on host (running windows/linux), and then config to allow remote connect. By this way we don't need to custom the vagrant box (or install by some commands through vagrantfile).
I think we can add a simple shell provision for mongodb, like this: https://github.com/fideloper/Vaprobash/blob/master/scripts/mongodb.sh
xgenvn said:
I think we can install mongodb on host (running windows/linux), and then config to allow remote connect. By this way we don't need to custom the vagrant box (or install by some commands through vagrantfile).
I'd like mongodb running on the VM, just like redis, nginx, etc. The goal is to make the development environment repeatable.
angelside said:
I think we can add a simple shell provision for mongodb, like this: https://github.com/fideloper/Vaprobash/blob/master/scripts/mongodb.sh
Again, that would work for installing mongo locally, not so good for installing on the VM. Could be executed over ssh, so an option, but doesn't handle things like port forwarding, etc.
Not sure it's the right place to post my question, but it's very pertinent
I can't get MongoDB to work, I installed it and it works in the VM, I also forwarded the port 27170 by adding this line to scripts/homestead.rb:
config.vm.network "forwarded_port", guest: 27017, host: 27170
but when I try to run mongo --port 27170 in local, I get this error:
DBClientCursor::init call() failed
Error: DBClientBase::findN: transport error: 127.0.0.1:27170 ns: admin.$cmd query: { whatsmyuri: 1 } at src/mongo/shell/mongo.js:147
exception: connect failed
@epitomus Shell provisioners run on the VM, not locally, and would be your best bet of installing new functionality to Homestead, I guess. Doesn't make sense to use a fully fledged provisioner just to add that one bit, even if they're easier to use. So, just fork the homestead project, create your shell provisioner and add it to scripts/homestead.rb as per the Vagrant docs.
I add the same issue than you and fixed it by editing the mongod.conf file in /etc and changing the bind_ip line from 127.0.0.1 to 0.0.0.0 and then sudo service mongod restart You can also run netstat -anp | grep 27017 to check your changes.
Now I can use robomongo from windows to manage the dbs :)
I've make a file with all the Vaprobash scripts that can be used with Homestead.
I've only tested Mongodb, but it should all work.
Thank you @Dpblandin , now it works!
Also thank you @kaamaru , very helpful :)
As for me just rebinding to 0.0.0.0 didn't help: in this case I could connect from my Windows system, but my applications on Homestead failed to connect to mongo. As a solution, I wrote two bindings for bind_ip:
bind_ip = 10.0.2.15,127.0.0.1
Now everything works perfectly.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community