Skip to content

mfasanya/vagrant-meteor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vagrant-meteor

Vagrant configuration for a virtual machine that can run Meteor apps.

How to use

Additional step for Windows

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.

Synchronisation

Important: The folder is synchronised two times. It is necessary because Meteor don't likes the shared folders of Virtualbox that are usually used.

  1. /vagrant: One way synchronisation from the host to the guest with rsync. It must be used to start the app.
  2. /meteor: Two way synchronisation with a Virualbox shared folder. Use it when you create or edit files in the guest.

Installation

  1. Download this repository and unpack the downloaded zip file.
  2. Install the latest version of Vagrant (1.6.1 or newer is recommended).
  3. Open a shell and change the directory to the unpacked vagrant-meteor-master folder.
  4. Run the command vagrant up and wait until the installation finished. This will create the virtual machine.
  5. Run the command vagrant ssh to connect to the virtual machine. The vagrant-meteor folder is mounted to /vagrant.

Vagrant 101

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.

Create a new app

  1. Change the directory to /meteor (with cd /meteor)
  2. Create a new app with mrt create <name> (see Meteorite documentation). You can also use the meteor tool if you want.

Use an existing app

Move your app folder into the downloaded vagrant-meteor-master folder.

File synchronisation

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.

Better alternative for Mac OS and Linux

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.

Start your app

  1. Connect to the virtual machine with vagrant ssh.
  2. Change to the app directory in the virtual machine (cd /vagrant/<MY_APP>)
  3. Start your app with mrt (or meteor).
  4. You can access the app on your host machine with http://localhost:3000/.

Local smart packages

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/***".

Debugging

  1. Run ./scripts/vagrant-ssh-node.sh on your host machine. On Windows you must use the Cygwin shell to run it.
  2. Start your app with NODE_OPTIONS=--debug=5858 mrt.
  3. After this you can connect to the app with the IP 127.0.0.1 and the port 5858.

Install additional things

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

About

A vagrant machine to run meteor apps.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published