4

I'm looking to run a meteor server for development purposes inside a virtualbox guest running Ubuntu. The project would be inside a folder on the host that would be shared to the guest (the folder itself is inside a Dropbox folder - this way I can share development between multiple VMs and workstations, but that shouldn't hurt),

I've got networking set up on the guest through host-only adapter & NAT with SSH keys entered into putty for convenience + the guest's ip in the windows etc/hosts file so the server is accessible locally on http://dev:3000, this part is working out fine.

The virtualbox is running on Windows 7 so the catch is that Meteor won't start due to not being able to start Mongo which wants to create a lockfile (since the file would have to be on the windows host shared to guest through vboxfs).

If I move the project to a different folder then there's no longer a way to edit the files with an editor on the host. I tried playing with moving .meteor/local folder out to an ext3 partition and connect with symlinks but this doesn't work for same reason lockfile can't be created.

So, anyone got suggestions on how to set this up?

UPDATE

I installed mongodb inside the ubuntu guest, but then when I attempted to run meteor the startup broke because meteor seems to want to create symlinks inside the folder:

/home/bbozo/.meteor/tools/09b63f1ed5/lib/node_modules/fibers/future.js:173
                                                throw(ex);
                                                      ^
Error: EROFS, read-only file system '/media/sf_Shared/Dropbox/dev_uhurajr/chat/.meteor/local/.build320446.build/programs/server/npm/logging/main/node_modules'

Plan B would be something in the lines of @user3185338 answer which is a workable workaround but I'm kind of hoping there's a more elegant alternative to running a while loop with x second lag inside screen

UPDATE

Is there perhaps a way to tell meteor to move it's .meteor work folder without resorting to symlinks? Perhaps by setting up an application server in ubuntu something in the lines of apache/nginx + passenger?

bbozo
  • 7,075
  • 3
  • 30
  • 56
  • Have you tried [Vagrant](http://www.vagrantup.com/)? – bredikhin Jan 11 '14 at 17:24
  • @bredikhin, I've played with it a bit, but since I've got a ready Ubuntu VM for other things I went with that. Do you know if any of the Vagrant VMs do something nice with the VM that I missed? – bbozo Jan 12 '14 at 09:25
  • AFAIK, Vagrant does, basically, everything you're trying to achieve: shared folder with the code, port mapping, etc. The only thing you have to do is set up provisioning (with Chef or Puppet) in order to install necessary software inside VM. The beauty of this approach is that you don't have to transfer the whole VM, all you need is to put `Vagrantfile` and some cookbooks/recipes under version control, and that's it. After that you'll be able to recreate your environment on any new machine using only one command, `vagrant up`. – bredikhin Jan 12 '14 at 21:14
  • I read your post and was wondering if there is a solution to remove the EROFS error after using an external mongoDb !? – TJR May 29 '14 at 20:59

3 Answers3

2

I had the same goal and same issues with symlinks.

Here is what I did:

  • configure a shared directory with VirtualBox (ex: /media/sf_meteor) where you copy the source files you need to edit
  • create and run a script of synchronisation on the guest (you will need perhaps to install rsync):

    #!/bin/sh
    #
    while true;
    do rsync -avt --delete <LIST OF DIRECTORY TO SYNC ex: ./client ./lib ./public ./server ./shared > <YOUR METEOR APP DIR IN THE HOST ex: ~/my_app/>;
    sleep 5;
    done

    • when you edit your code on windows host, it will be updated on the guest. If Meteor is running, your change will be auto-updated on your browser

Hope it can help you

1

VirtualBox shared folders (vboxsf devices) have a different device interface and are not supported for MongoDB data directories as at MongoDB 2.4.

The workaround is to only have your application files using the shared folder.

There are a few different approaches you can use to move your MongoDB data files outside the shared folder:

1) Login to the VirtualBox VM and symlink .meteor/local/db/ to a directory that isn't a shared folder (eg ~/db). This should allow you to share your app between systems and have a database local to the VM.

2) Run meteor using an external MongoDB server (i.e. one running in the host environment rather than the VM) by setting the MONGO_URL environment variable:

MONGO_URL=mongodb://192.168.1.123:27017 meteor 
Stennie
  • 63,885
  • 14
  • 149
  • 175
  • Thanks for the tips :) Unfortunately, #1 doesn't work because symlinks can't be made inside of the shared folder (which is on the host), and when I attempted #2 there was another snag, meteor seems to want to create symlinks inside its `.meteor` folder, I'll update the question shortly – bbozo Jan 11 '14 at 15:43
  • I forgot to mention that the share is on Dropbox :) Do you have an idea on how to go about the symlink issue inside the guest? – bbozo Jan 11 '14 at 15:51
  • Your configuration seems unusual since you are getting an error of "read-only file system". I've setup shared folders on VirtualBox before using this approach (OS X host, Linux VM) and the shared folder was read/write in both host and VM. If the share is on Dropbox, I would try setting up a Dropbox daemon for the source code folder in the VM rather than using a VirtualBox shared folder. – Stennie Jan 11 '14 at 15:55
  • You could perhaps also invert the approach: share a directory from your VM to the host via Samba. – Stennie Jan 11 '14 at 16:01
  • I'm pretty certain the "read only file system" is just Ubuntu being confused because symlinks can't be created. I've got full rw capability within the folders, it's just when I attempt `ln -s` ubuntu returns 'read-only filesystem' error. I could share via Samba but that means I would have to give up the Dropbox setup which I'm pretty fond of. I'm starting to realize that VirtualBox tricks won't help me solve this in a nice way – bbozo Jan 11 '14 at 16:09
1

Have a look at the virtualized solutions over at http://win.meteor.com

matb33
  • 2,820
  • 1
  • 19
  • 28