Vagrant configuration for a virtual machine that can run Meteor apps.
You must install Cygwin with the packages openssh
and rsync
.
You can and use the Cygwin shell for running the vagrant commands.
If you want to use the Windows shell instead, you must add the cygwin/bin folder to your PATH.
Important: The folder is synchronised two times. It is necessary because Meteor don't likes the shared folders of Virtualbox that are usually used.
- /vagrant: One way synchronisation from the host to the guest with rsync. It must be used to start the app.
- /meteor: Two way synchronisation with a Virualbox shared folder. Use it when you create or edit files in the guest.
- Download this repository and unpack the downloaded zip file.
- Install the latest version of Vagrant (1.6.1 or newer is recommended).
- Open a shell and change the directory to the unpacked
vagrant-meteor-master
folder. - Run the command
vagrant up
and wait until the installation finished. This will create the virtual machine. - Run the command
vagrant ssh
to connect to the virtual machine. Thevagrant-meteor
folder is mounted to/vagrant
.
You will only need a few vagrant command that you should remember.
vagrant up
: Starts your virtual machine or creates it if it doesn't exist.vagrant ssh
: Opens a SSH connection to the virtual machine.vagrant suspend
: Pauses the virtual machine. It will save the current state to the disk.
You can find more commands and info in the Vagrant documentation.
- Change the directory to
/meteor
(withcd /meteor
) - Create a new app with
mrt create <name>
(see Meteorite documentation). You can also use themeteor
tool if you want.
Move your app folder into the downloaded vagrant-meteor-master
folder.
Rsync is used for file synchronisation.
By default the files will only be copied to the virtual machine,
when you start the virtual machine with vagrant up
or reload it with vagrant reload
.
vagrant rsync-auto
will watch your files and automatically copy changes to the virtual machine.
You have to run the command in a separate shell. The command is not perfect (yet).
I recommend to read the documentation about it.
There is a better plugin for vagrant rsync-auto
that is more efficient and less CPU intensive.
Install it with vagrant plugin install vagrant-gatling-rsync
.
Then run vagrant gatling-rsync-auto
for automatic file synchronisation instead of vagrant rsync-auto
.
- Connect to the virtual machine with
vagrant ssh
. - Change to the app directory in the virtual machine (
cd /vagrant/<MY_APP>
) - Start your app with
mrt
(ormeteor
). - You can access the app on your host machine with
http://localhost:3000/
.
By default the packages folder of your app won't be copied to the virtual machine. Meteorite will install the packages inside the virtual machine.
If you have local smart packages that should be copied, add them in the Vagrantfile where it says
# Add your local packages here
by adding a line "+ /<MY_APP>/packages/<MY_PACKAGE>/***",
for each package under the comment.
Example: My package is in the folder vagrant-meteor/myApp/packages/myPackage/
. I would add the line "+ /myApp/packages/myPackage/***"
.
- Run
./scripts/vagrant-ssh-node.sh
on your host machine. On Windows you must use the Cygwin shell to run it. - Start your app with
NODE_OPTIONS=--debug=5858 mrt
. - After this you can connect to the app with the IP 127.0.0.1 and the port 5858.
You can modify the scripts/bootstrap.sh
if you need additional things installed in you VM.
By default Vagrant will install:
- Node.js 0.10.x
- NPM
- Meteor
- Meteorite
- MongoDB