-
You need to install virtualbox
-
You also need to install vagrant
-
Clone the github repository containing this README file:
git clone git@github.com:CrowdSpot/crowdspot-vagrant-box.git ~/crowdspot-vagrant-box
-
Obtain the virtualbox image (ubuntu 14.04 LTS) which contains the local development environment:
# Ensure you are logged into the crowdspot aws console and then in your browser go to: https://s3-ap-southeast-2.amazonaws.com/crowdspot-vagrant-box/crowdspot.box # and save that file into the ~/crowdspot-vagrant-box directory
-
Clone the shareabouts repo locally (this will get synced into your virtual machine via the vagrant config):
cd ~/crowdspot-vagrant-box git clone git@gitlab.com:crowdspot/shareabouts.git shareabouts
-
Checkout the v3 branch (this is effectively master, as far as you guys are concerned):
cd shareabouts && git checkout v3
-
Ensure that any old vagrant boxes that might interfere with the new box you will install, are removed, then add the new one you downloaded in step 4:
vagrant box remove crowdspot.box # Note that in the line below /path/to/my/home/directory/ must be replaced with the actual # path to your home directory vagrant box add file:///path/to/my/home/directory/crowdspot-vagrant-box/crowdspot.box
-
Start up the vagrant box and ssh to it:
vagrant up # Activate your virtualbox vagrant ssh # Enter your virtualbox, 'vagrant' as default password if prompted
-
Copy the local settings template to create a local settings file (this is done whilst ssh'd into the vagrant box):
cp /home/vagrant/shareabouts/src/project/local_settings.py.template /home/vagrant/shareabouts/src/project/local_settings.py
-
Install Fabric 1.14.0 (not version 2) and add it to your path:
pip install --user fabric==1.14.0 echo "export PATH=$PATH:/Users/anthony/Library/Python/2.7/bin" > ~/.bash_profile
-
Restart the development servers on the vagrant box:
fab -f ~/fabfile restart_dev_servers
-
Access your local development environment:
Go to http://127.0.0.1:8000/ in your browser and you are good to go :)
-
On your local file system, checkout a new feature branch off v3 (let's for example's sake call it sekrit-project):
cd ~/crowdspot-vagrant-box/shareabouts git checkout v3 git checkout -b feature-sekrit-project
-
Create your new flavour, probably by copying an existing one and renaming the directory (again let's call it sekrit-project)
-
Update local_settings.py to point at your new flavour (eg, change contents so FLAVOUR=sekrit-project)
-
Restart the development servers on your virtualbox:
cd ~/crowdspot-vagrant-box && vagrant ssh fab -f ~/fabfile restart_dev_servers
-
Access your local development environment to review your changes:
Go to http://127.0.0.1:8000/ and you are good to go :)
-
Commit and push your changes on your local file system:
cd ~/crowdspot-vagrant-box/shareabouts git commit -m"Created the sekrit-project flavour and tested" git push origin feature-sekrit-project
- Checkout your colleague's feature branch (let's call it feature-sekrit-project) on your local filesystem:
cd ~/crowdspot-vagrant-box/shareabouts
git fetch origin
git checkout feature-sekrit-project
- Update local_settings.py to point at your new flavour (eg, change contents so FLAVOUR=sekrit-project)
- Restart the development servers on your virtualbox:
cd ~/crowdspot-vagrant-box && vagrant ssh
fab -f ~/fabfile restart_dev_servers
- Access your local development environment to review your colleague's changes:
Go to `http://127.0.0.1:8000/` in your browser
- username: crowdspot
- password: cc&20!6@
- apicrowdspot: tar/copied directly from the production server (though the repo is does exist at https://github.com/openplans/shareabouts-api)
- shareabouts:
**
git clone git@github.com:CrowdSpot/shareabouts.git
**cd shareabouts
**git checkout v3
sudo apt-get install virtualbox-guest-additions-iso
sudo mount /usr/share/virtualbox/VBoxGuestAdditions.iso /mnt
cd /mnt
sudo ./VBoxLinuxAdditions.run
Note - need to run vagrant reload
to include synced folders (also need uncomment synced_folders in vagrant file)
sudo apt-get -y install python-pip
_Installation
sudo pip install virtualenv
sudo pip install virtualenvwrapper
Configuration
echo 'export WORKON_HOME=$HOME/.virtualenvs' >> .bashrc
echo 'export PROJECT_HOME=$HOME/Devel' >> .bashrc
echo 'source /usr/local/bin/virtualenvwrapper.sh' >> .bashrc
source .bashrc
Installation
git clone git@github.com:yyuu/pyenv.git ~/.pyenv
sudo apt-get install -y make build-essential libssl-dev zlib1g-dev
libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev
Configuration
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> .bashrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> .bashrc
echo 'eval "$(pyenv init -)"' >> .bashrc
exec $SHELL
Install Python Version
pyenv install 2.7.3
Installation
sudo apt-get install -y postgresql postgresql-contrib
sudo apt-get install -y postgis postgresql-9.3-postgis-2.1
sudo apt-get install libpq-dev python-dev
Create Database
sudo -u postgres createuser -Ps vagrant
- Add your password
createuser -P shareabouts
createdb -O shareabouts shareabouts
- Check if you could access your database -
psql -h localhost -U shareabouts shareabouts
psql -c "CREATE EXTENSION postgis; CREATE EXTENSION postgis_topology;" shareabouts
Installation
mkvirtualenv /home/vagrant/.virtualenvs/shareabouts
cd /home/vagrant/shareabouts
workon shareabouts
pip install -Ur snapshotted_requirements.txt
Create local settings file
cp /home/vagrant/shareabouts/src/project/local_settings.py.template /home/vagrant/shareabouts/src/project/local_settings.py
Start Dev Server
cd src
./manage.py runserver 0.0.0.0:8000
Installation
mkvirtualenv -p ~/.pyenv/versions/2.7.3/bin/python2.7 apicrowdspot
cd home/vagrant/apicrowdspot
pip install -Ur requirements.txt
database
./manage.py syncdb --migrate
./manage.py createsuperuser
- username: crowdspot
- email: just press enter
- password: cc&20!6@
Start Dev Server
cd src
./manage.py runserver 0.0.0.0:8001
Configure Api
-
Go to
http://127.0.0.1:8001/admin/
in your browser- username:
crowdspot
- password:
cc&20!6@
- username:
-
Go to API Keys
- Add API Key:
MGJlYzRhMTIxNGFkNDYyMmU1ZDRmNmNk
- Add Dataset
- owner:
crowdspot
- display name:
default-instance
- save Dataset
- owner:
- save API Keys
- Add API Key:
-
Go to
http://127.0.0.1:8000/
and you are good to go :)