Skip to content

gramidt/my-rails-dev-box

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

No longer supported. Long live Docker!

A Virtual Machine to Jump Start Your Ruby on Rails Development

What's in this magical box?

Ruby / Rails

  • RVM
  • Ruby 2.0.0, 2.1.0, & 2.2.0
  • Bundler

Source Control

  • Git

Databases

  • SQLite
  • MySQL
  • PostgreSQL (9.1)
  • MongoDB

Caching

  • Redis (2.6.5)

Misc.

  • Qt
  • MailCatcher

What are the requirements to get up and running?

So the prerequisites are installed, how do I get started?

host $ git clone https://github.com/granvilleschmidt/my-rails-dev-box.git
host $ cd my-rails-dev-box
host $ vagrant up

BOOM! Everything is now ready for development. Magic right?

Note: It may take upwards of a few minutes the first time you run 'vagrant up', since it will need to download the base box.

After the installation has finished, you can access the magical box with

host $ vagrant ssh
Welcome to Ubuntu 12.04 LTS (GNU/Linux 3.2.0-23-generic x86_64)
...
vagrant@my-rails-dev-box:/vagrant/projects$

Given that port 3000 is the default port for new Rails apps, we went ahead and forwarded that port to the magical box, so you can access your web applications from your host machine.

NOTICE: If you are using Rails 4.2 and greater, you need to use rails s -b 0.0.0.0 to start the server, as the Rails 4.2 changed the listening address default from 0.0.0.0 to localhost.

This seems like voodoo. How do you expect me to work on a magical box from my host machine?

Well it turns out that Vagrant mounts the my-rails-dev-box directory as /vagrant within the magical box. So with a little additional black magic (aka. one liner bash script), you can just start working directly out of the current directory which happens to be /vagrant/projects after running vagrant ssh.

Additional Notes

MailCatcher

Add the following to your 'environment/development.rb', and MailCatcher will catch any outgoing mail.

config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = { :address => "localhost", :port => 1025 }

Then all you have to do is run mailcatcher --ip=0.0.0.0, and you can access the application at http://localhost:1080.

PostgreSQL

# login
sudo -u postgres psql postgres

# create user
sudo -u postgres createuser -s <username>

# set password
ALTER USER <username> WITH PASSWORD ‘<newpassword>’;