How to run meteor app inside an Ubuntu VrtualBox a

2019-05-04 08:49发布

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?

3条回答
倾城 Initia
2楼-- · 2019-05-04 09:31

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

查看更多
手持菜刀,她持情操
3楼-- · 2019-05-04 09:36

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

查看更多
▲ chillily
4楼-- · 2019-05-04 09:46

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 
查看更多
登录 后发表回答