Skip to content
This repository has been archived by the owner on Mar 27, 2022. It is now read-only.

Using Vagrant

Rob edited this page Sep 28, 2015 · 14 revisions

Vagrant is great. With it you can easily get OneBody running on your local PC or Mac without having to install all the necessary software. You can be hacking on open source software in only a few minutes!

Vagrant is free and runs on Windows, Mac, and Linux. It works by launching a virtual machine with Ubuntu Linux on it and running OneBody there. But don't worry -- most of the time you don't have to think about this running VM, as everything is pretty automatic.

Install Vagrant and Launch the App

  1. Install VirtualBox. It's free and it runs on Windows, Mac, and Linux.
  2. Install Vagrant on your host machine.
  3. Install Git.
  4. Clone the repository to your host machine: git clone git://github.com/churchio/onebody.git
  5. In your host terminal, change to the project directory: cd onebody
  6. Run vagrant: vagrant up

View the App in Your Browser

Visit the site running in development mode at localhost:8080.

Using MailCatcher

  1. vagrant ssh
  2. add SetEnv MAILCATCHER true to your apache config file in /etc/apache2/sites-available/onebody.conf
  3. service apache2 restart
  4. cd /vagrant
  5. gem install mailcatcher
  6. nano Vagrantfile
  7. add config.vm.network :forwarded_port, host: 1080, guest: 1080 the Vagrant.configure section.
  8. run mailcatcher --ip=0.0.0.0
  9. View MailCatcher in a web browser http://localhost:1080

Use Your Favorite Editor

You can use your favorite text editor to make changes inside the onebody directory on your host machine (no need to edit anything "inside" the running VM). Changes should show in your browser after refreshing.

Updating Gems & Running Migrations

Whenever gems are updated or new migrations are needed, you can just run vagrant provision.

Getting a Terminal Inside the VM

To gain access to the vagrant box terminal, run vagrant ssh to get an active SSH session. Once inside, the OneBody directory is mirrored at /vagrant inside the Vagrant box.

Restarting the Rails Server

To restart the Rails server, type touch tmp/restart.txt. Or you can vagrant reload to restart the dev box.

Vagrant Docs

For more help with Vagrant, check out the Vagrant docs.