Skip to content

Instantly share code, notes, and snippets.

@DannyFeliz
Last active March 1, 2017 02:49
Show Gist options
  • Save DannyFeliz/edfa0b0edcd4a526931f8964d5658f81 to your computer and use it in GitHub Desktop.
Save DannyFeliz/edfa0b0edcd4a526931f8964d5658f81 to your computer and use it in GitHub Desktop.
Vagrant.config

Vagrant Meteor Development Environment Installation & Configuration

Overview

Only the VirtualBox and Vagrant versions specified below will work. Later versions have problems, so do not try to use them (we tried almost all of them).

Vagrant Installation

  • Install VirtualBox version 4.2.24, from here

  • Add to the Windows PATH environment variable: C:\Program Files\Oracle\VirtualBox

  • Install Vagrant version 1.6.2, from here

  • Add to the Windows PATH environment variable: C:\HashiCorp\Vagrant\embedded\mingw\bin

Cygwin Installation

  • Download Cygwin 64 bit and save it to c:\cygwin64setup from here

  • Run the setup file and install Cygwin with wget (web), git (devel), openssh (net) and ncurses (utils)

Cygwin git configuration

  • Open a Cygwin64 Terminal and:
wget -O init-git.sh http://goo.gl/AvJWSH
chmod 700 init-git.sh
# i.e. ./init-git.sh "Ronen Babayoff" ronen@lavaina.com
./init-git.sh "<Your Full Name>" <Your Email Address>
  • Add the outputed ssh key to your github account ssh keys (name it cygwin) here

  • Fix ssh file permissions:

# The following fixes cygwin ~/.ssh folder and file permission problems
wget -O cygwin-fix-ssh-file-permissions.sh http://goo.gl/ZXOzlA
chmod 700 cygwin-fix-ssh-file-permissions.sh
./cygwin-fix-ssh-file-permissions.sh
  • Clone the shopify-lavaina repo:
# So we don't get source files with Windows end of line which makes Cygwin crazy 
git config --global core.autocrlf false
cd
mkdir repos
cd repos
git clone git@github.com:lavaina/shopify-lavaina.git
cd shopify-lavaina
bin/config-git.sh

Vagrant VirtualBox VM Installation

bin/vagrant-install-vm.sh <vm samba netbios name> <vagrant user samba password> "<git user.name>" <git user.email>
# i.e. bin/vagrant-install-vm.sh ronenvm MyPass "Ronen Babayoff" ronen@lavaina.com
  • Add the outputed ssh key to your github account ssh keys (name it vagrant) here

  • At the end of this script a `meteor-dev-env' vm snapshot will be created.

Samba Windows Configuration

Try and access your vagrant home directory from your windows file explorer, by accessing:

\\<netbios name>\vagrant

i.e.

\\ronenvm\vagrant

Login to access

username: vagrant
password: <MyPass>

If you can't, you need to enable netbios for all network adapters you use regularly, as in https://www.youtube.com/watch?v=6l2O07MbaFg and choose "Enable NetBIOS over TCP/IP" (the 2nd option)

Map a network drive to your vagrant vm repos folder, so webstorm will be able to access it without problems. Goto windows explorer, select 'This PC' and click "Map network drive". Map R: to \\ronenvm\vagrant\repos. In WebStorm, open R: as the project root.

LaVaina Development Environment Configuration

ngrok signup

First, you will need to sign up to ngrok:

  • Signup to ngrok with your github account at https://ngrok.com/

  • Have Ronen pay you 1 dollar 1 year subscription with HIS paypal

  • Go to your ngrok dashboard and reserve domain [yourname].lavaina.com, i.e. ronen.lavaina.com

  • If you don't already have one, create a file called [yourname].ngrok in shopify-lavaina/etc/ngrok (copy an existing one from another developer)

  • Change the authkey at the top of the file to your ngrok auth token (find it here: https://ngrok.com/dashboard)

  • Change hostname to your reserved domain [yourname].lavaina.com, i.e hostname: "ronen.lavaina.com"

  • Commit your new file to git and push it.

LaVaina Development Environment Setup

bin/vagrant-init-lavaina-dev-env.sh <developer name>
# i.e. bin/vagrant-init-lavaina-dev-env.sh ronen

At the end of this script a `lavaina-dev-env' vm snapshot will be created.

Now, you can just:

vagrant ssh

ngrok usage

  • To start ngrok, run:
ngrok start meteor

This will tunnel traffic from [yourname].lavaina.com to your meteor app running on vagrant on port 3000.

You will also be able to introspect the http traffic that ngrok tunnels at your windows machine, at: http://localhost:4040

Enjoy!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment