Skip to content

Latest commit

 

History

History
executable file
·
66 lines (39 loc) · 1.62 KB

README.md

File metadata and controls

executable file
·
66 lines (39 loc) · 1.62 KB

These files provision a VM for rails development with:

  • Ubuntu Trusty 64

  • rbenv

  • MySQL

  • nodejs for javascript

Usage

Assuming you have Vagrant and VirtualBox already installed you can use these files the following way.

  1. Clone this repository to your computer

  2. Install the Vagrant plugins

    vagrant plugin install vagrant-vbguest
    vagrant plugin install vagrant-librarian-chef-nochef
    
  3. Copy Vagrantfile and Cheffile to the root of our Rails project

  4. Update the database username and password in Vagrantfile to what's in your database.yml

  5. Update the ruby version to match your Gemfile

  6. Add the following to your .gitignore to keep the files generated by Chef and Vagrant out of your repo.

    /.vagrant
    /cookbooks
    
    
  7. Run vagrant up and then go get a ☕. It takes a while for the VM to be created and provisioned.

  8. vagrant ssh to access the VM

  9. cd /vagrant

  10. bundle install

  11. rails s

  12. Access your app at http:localhost:3000

Extras

Depending on what gems you include in your app, you might find it necessary to add additional software to you VM.

ImageMagick

A number of file uploader gems require imagemagick to be on the server. You can easily add it to your VM by adding a couple lines to your vagrant config.

  1. Add cookbook 'imagemagick', '~> 0.2.3' to your Cheffile

  2. Add chef.add_recipe "imagemagick" to the block in Vagrantfile where you configure chef solo

Notes

  • If you're app is Rails 4.2, you'll need to run rails s -b 0.0.0.0.

  • You might need to change the host port if you have multiple vagrant VMs running on your system.