I am having an issue with mongo provisioning.
For some reason when I do provision the first time, it will give me an error:
==> METEOR_Dev_Box_test: ADDING MONGO INITIATE
==> METEOR_Dev_Box_test: MongoDB shell version v3.4.2
==> METEOR_Dev_Box_test: connecting to: 127.0.0.1:27017
==> METEOR_Dev_Box_test: W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: Connection refused
==> METEOR_Dev_Box_test: E QUERY [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :
but if I do vagrant ssh
and run:
mongo 127.0.0.1:27017 --eval "db=db.getSiblingDB('local');rs.initiate()"
It works perfectly.
this is the relevant part of my provision:
sudo service mongod stop
sudo sed -i '/#replication:/a replication:\n \ \ replSetName: rs0' /etc/mongod.conf
sudo sed -i '/#replication:/d' /etc/mongod.conf
sudo service mongod restart
mongo 127.0.0.1:27017 --eval "db=db.getSiblingDB('local');rs.initiate()"
Vagrantfile:
# -*- mode: ruby -*-
# vi: set ft=ruby :
require 'yaml'
settings = YAML.load_file('./vagrant_setup.yml')
VAGRANTFILE_API_VERSION = '2'
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
settings.each do |settings|
config.vm.define settings['name'] do |machine|
machine.vm.box = settings['box']
machine.vm.network "private_network", ip: settings['ip']
machine.vm.hostname = settings['hostname']
machine.vm.provision :shell, path: './vagrant_bootstrap.sh'
machine.vm.provision :shell, path: './vagrant_meteor.sh', privileged: false
machine.vm.network 'forwarded_port', guest: settings['port_1'], host: settings['port_1']
machine.vm.network 'forwarded_port', guest: settings['port_2'], host: settings['port_2']
machine.vm.network 'forwarded_port', guest: settings['port_3'], host: settings['port_3']
machine.vm.provider :virtualbox do |vb|
vb.name = settings['name']
vb.memory = settings['memory']
vb.cpus = settings['cpus']
vb.customize ["modifyvm", :id, "--usb", "on"]
vb.customize ["usbfilter", "add", "0", "--target", :id, "--name", "android", "--vendorid", "0x18d1"]
vb.customize ["usbfilter", "add", "0", "--target", :id, "--name", "androidSamsung", "--vendorid", "0x04e8"]
vb.customize ["usbfilter", "add", "0", "--target", :id, "--name", "androidLG", "--vendorid", "0x1004"]
end
end
end
end
It feels that while in provision, he is associating 127.0.0.1 as not reachable.
Thank you in advance. :)