Let me start by saying this.. sometimes I’m lazy. So when I see a new way to spin up a development environment that will literally do EVERYTHING FOR ME I jump at the opportunity. I’m no master with vagrant (started using it yesterday) or puppet (started using it this morning) but they are not hard to figure out.
I primarily use Windows which means that most of the scripts and plugins that you see out on the web for Vagrant will not work, especially the ones using Chef for some reason.
How to get your Rails application development environment on Windows
I’m using Windows 7 so this is not tested on any other version yet (please let me know if you do test it on another version!)
Step 1: Install Virtual Box
DO NOT INSTALL 4.3.14 on Windows 7 as of 8/21/14 it won’t work with Vagrant
I installed 4.3.10 and it works fine
Step 2: Install Vagrant
Step 3: New Project Directory
Create a new directory somewhere on your computer to store your project files.
Step 4: Download the Scripts
Once downloaded put the Vagrantfile and puppet folder into your new projects directory.
Step 5: vagrant up
Once everything is in place open up CMD in Windows. Then “cd” or change directory to your project directory. Once there simply type “vagrant up” then go get some coffee, this steps takes a few minutes. This step took my computer about 451.3 seconds the first go around. When you run vagrant up next time (when you come back to work on your homework or whatever) it won’t take as long because the provisioner (the part that installs everything for you) doesn’t run the second time.
cd C:\Local Storage\Coursera\Web Application Architectures\rails-dev-env-test vagrant up
That’s it now you should be able to go to http://localhost:3000 and see you default rails app page.
If you don’t see it the rails server may have not started up. You’ll need to SSH into your VM with vagrant ssh. If your having trouble with vagrant SSH check this page. Once in type:
cd /vargrant/myapp rails server
Check the page now to see if it’s loading. If not please post your comments here I’ll be glad to help.
To learn more about the available vagrant commands please read their documentation: https://docs.vagrantup.com/v2/cli/index.html