Building your local environment (NFS) - DoSomethingArchive/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
-
Clone the phoenix repo. The phoenix repo's main branch is
dev
. -
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 likessh-add /path/to/key
.)
- 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
-
From the original repo directory, run
vagrant ssh
. This will open a terminal into the vagrant vm. -
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.
- After ssh'ed in do the following steps:
cd /var/www/dev.dosomething.org
ds build --install
ds pull stage --db
-
:coffee: time. The previous step takes 10–30 mins to complete, depending on your machine's happiness.
-
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
-
You're done!
- Your environment will be available at http://localhost:8888/ and http://dev.dosomething.org:8888/.
- The webroot in Vagrant is the
/var/www/dev.dosomething.org/html
directory.