Skip to content

Instantly share code, notes, and snippets.

@rujmah
Last active October 25, 2019 16:06
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rujmah/f565c99d243c31b93af0 to your computer and use it in GitHub Desktop.
Save rujmah/f565c99d243c31b93af0 to your computer and use it in GitHub Desktop.
Setting up Vagrant for Node.js development

##Setting up Vagrant for Node.js development

These are instructions for an internal project setup for node.js development in the same enviromment regardless of host OS. Some items may be specific to our project and internal processes, but I put it here as a starting point for others or help to setting up your own OS.

There is an internal postinstall.sh on install of the vagrant box mentioned here, but I prefer to roll my own and outline the essential steps so that other can input the items that they require.

###Setting up Vagrant box

  • Install VirtualBox
  • Download and install Vagrant
  • Follow the instructions for creating an ubuntu 'precise32' vagrant box on the 'Getting Started' page (really quick)
  • Edit Vagrantfile to include the following line: config.vm.network "forwarded_port", guest: 3000, host: 5000
  • Enter your vagrant instance (vagrant ssh) and run the following commands
    • sudo apt-get update
    • sudo apt-get upgrade (if asked select /dev/sda for the GRUB)
    • sudo apt-get install git-core zsh memcached make
  • Follow the NVM setup instructions on this page
  • Get the current node version for dev: nvm install <chosen node version>

###Cloning the dev repo You will need to have an ssh-key set up on your vagrant box to push and pull from private repos. See this article for help generating an ssh-key. This ssh key should be added to an account with privileges on Bitbucket - preferably your own.

  • Create a shared folder at /vagrant and cd to it
  • Clone the repo: git clone <git repo>
  • Enter the repo and set the node version: nvm use <chosen node version>
  • Install the testing library globally: npm install -g mocha
  • Run the tests: npm test With the last command you should see the tests running. If you get an error something went wrong and you may need help from someone who knows what they are doing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment