Building your local environment (NFS) - DoSomething/legacy-website GitHub Wiki

Prerequisites

Install VirtualBox

Available here. We haven't seen any problems from running different versions, so just grab the latest.

Vagrant

Once you've installed Vagrant, you should have the vagrant command in your CLI.

Vagrant Setup

  1. Clone the phoenix repo. The phoenix repo's main branch is dev.

  2. Because Vagrant uses SSH agent forwarding, make sure your local SSH key -- the one you use with GitHub -- is ready to be used.

  • From your host, try ssh-add -L. If your key is listed, you're good.

  • If not, run ssh-add without arguments. It will add any of the 'standard' keys in: $HOME/.ssh/identity, $HOME/.ssh/id_rsa, and $HOME/.ssh/id_dsa. (To add a key with a nonstandard name, specify it like ssh-add /path/to/key.)

  1. To start up your environment, run vagrant up from the local directory of the clone of the dosomething repo fork.
  • During this process you will be asked for a password, it's asking for the password on your computer

Application setup

  1. From the original repo directory, run vagrant ssh. This will open a terminal into the vagrant vm.

  2. If this is the first time you ran vagrant up, make sure to complete the following two actions:

  • The staging site is hosted at a different domain, so make the following change to your ~/.drush/ds.aliases.drushrc.php file, on line 35:
 $aliases['staging'] = array(
  'uri' => 'staging.beta.dosomething.org',
  'root' => '/var/www/staging.beta.dosomething.org/current/html',
- 'remote-host' => 'staging.beta.dosomething.org',
+ 'remote-host' => 'staging-beta.dosomething.org',
  'remote-user' => 'dosomething',
  'path-aliases' => array(
    '%files' => '/var/www/staging.beta.dosomething.org/shared/files',
  ),
);
  • Next, make sure to run the setup script: setup-www which is located in /home/dosomething/bin. This will deploy your local DoSomething distribution to the base directory /var/www/dev.dosomething.org in the vm.
  1. After ssh'ed in do the following steps:
  • cd /var/www/dev.dosomething.org
  • ds build --install
  • ds pull stage --db
  1. :coffee: time. The previous step takes 10–30 mins to complete, depending on your machine's happiness.

  2. Edit your local (not your vagrant box!) host file and add the development hostname. This is required to make sure that cookies work properly.

sudo vim /etc/hosts

Add this line to the bottom, and save:
127.0.0.1 dev.dosomething.org

  1. You're done!