Don't mess around with wonky local development setups for Rails. Use a VM to streamline your workflow!
- Use Postgres for your local DB. Great for deploying to Heroku
- Sets you up with a fresh development database ready for Rails
- Sets up RVM, Bundler, and Ruby-2.0.0
- Configures zsh + vcprompt (displays git branch info) for a better console experience
- Use a shared folder to keep your codebase repo separate from the VM repo
- NFS folder sharing helps keep your tests fast
- Configuration options to speed up your VM
- Download Vagrant: http://www.vagrantup.com/
- Download VirtualBox: https://www.virtualbox.org/wiki/Downloads
- Install them!
- Clone this Repo
$ git clone git@github.com:blakeharv/vagrant-ruby-postgres-vm.git - From the cloned repo
$ vagrant up - During the install you may be prompted for a password to enable folder sharing. On OSX this is just your regular account password (like when you login into your computer or install software).
- Log into the VM
$ vagrant ssh
The default Postgres settings will configure 1 user and database. You can use the following settings in your Rails database.yml (See the customization settings below for configuring your databases and users)
development:
adapter: postgresql
encoding: latin1
database: development
pool: 5
username: vagrant
password: passwordThe following places can be customized to fit your individual needs:
- Add additional Ubuntu packages: bootstrap.sh#L9
- Set your project folder: Vagrantfile#L19
- Add ports: Vagrantfile#L30
- Set your timezone: /cookbooks/timezone/recipes/default.rb
- Set your Postgres users and databases: /cookbooks/postgresql/recipes/setup.rb#L20-L27
- Speed up your VM: Vagrantfile#L22
- zsh and vcprompt config: Skim and Myles from 8th Light
- Vagrant Ruby-2.0 Box: Richard Dong | https://github.com/richarddong/vagrant-ruby-rvm
- Chef & Cookbooks: Opscode | https://github.com/opscode-cookbooks/