Skip to content

whatsthehubbub/rippleeffect

Repository files navigation

Ripple Effect

For more details on Ripple Effect see: http://whatsthehubbub.nl/projects/ripple-effect/

Ripple Effect is released under a MIT License as detailed in the LICENSE file in this same directory.

Dev Environment Setup

  1. Download and install VirtualBox for OSX
  2. Download and install vagrant for OSX
  3. Get the "Command Line Tools for Xcode":https://developer.apple.com/downloads or "Xcode":http://itunes.apple.com/us/app/xcode/id497799835
  4. Install fabric and Jinja sudo pip install --upgrade fabric==1.6.0 jinja2
  5. Checkout the repository git clone [email protected]:whatsthehubbub/rippleeffect.git && cd rippleeffect
  6. Bootstrap the dev environment fab bootstrap (you may want to grab a coffee)

Dev Environment Usage

Your dev environment runs a VirtualBox instance where the checkout you just did is mapped into. Any files you change on your machine are mirrored into the virtual machine and vice versa. The dev server runs on the virtual machine and forwards its ports to your local machine.

You can interface with your VM using the vagrant command. The commands you'll most often use are vagrant up and vagrant halt.

To be up and running do this:

  • git pull (or sync in your Github.app)

  • git checkout develop (we work in branch develop)

  • vagrant up

  • fab app.install_requirements (only when new packages have been added)

  • fab syncdb (only once on every new database)

  • fab migrate (only when the database schema has been changed)

  • fab runserver;

  • Access your environment at: http://127.0.0.1:8000

  • You can impersonate other players by adding ?impersonate=[email protected] behind a URL if you're logged in. You can stop by adding ?unimpersonate=1

  • Kill the VM with: vagrant halt

This process does not create a superuser. To create one:

  • fab shell;
  • from riskgame.models import EmailUser
  • EmailUser.objects.create_superuser('[email protected]', 'password')

When you're done stop your virtual machine with vagrant halt though you shouldn't really notice it and it will disappear on next reboot.

To get a list of available commands

fab -l

To run your django dev server:

fab runserver	# serves django app on localhost:8000

To sync your DB:

fab syncdb

To run a DB migration

fab migrate

To run a celery worker in the foreground

fab runworker

To run a django interactive shell

fab shell

To shutdown your virtual machine

vagrant halt

To startup your virtual machine

vagrant up

To drop into a shell on your virtual machine

vagrant ssh

The vagrant commands should be executed in the directory which contains the Vagrantfile

Staging Deployment

To view a full list of available commands:

fab --list

To deploy simple app updates:

fab staging deploy  # deploy the master branch to staging

To deploy more complex updates:

fab staging git_pull migrate reload  # pull code, run migrations, reload app in staging

# pull release branch, install requirements & reload app in staging
fab staging git_pull:release app.install_requirements migrate collectstatic reload

To tail the application logs:

fab staging logs    # tail the staging app log
fab staging logs:nginx  # tail the staging webserver log
fab staging logs:celery # tail the celery worker log
fab --display logs  # for more information

Do partial updates

To update nginx:

from fabfile import staging
from fabfile.nginx import configure_site, restart_nginx
staging()
configure_site()
restart_nginx()

To enable automatic security updates:

from fabfile import staging
from fabfile.base import automate_security_updates
staging()
automate_security_updates()

Everything runs as rippleeffect, so sudo -i -u rippleeffect

Production Deployment

To spinup a new server:

  1. In the control panel, create a new server from the saved image appserver.
  2. Deploy the latest code to the server: fab prod deploy deploy@<ip-address>
  3. In the control panel, add the server to the load balancer.

Tech Trial Deployment

  • ssh into the server
  • git pull
  • source venv/bin/activate
  • export RIPPLE_PRODUCTION=True
  • < do other actions >
  • sudo service rippleeffect stop; sudo service rippleeffect start;

Branches

  • develop is mainline development
  • release is the version currently on playrippleeffect.com
  • master is currently unused

Editing CSS and Javascript

CSS is written in SCSS, Javascript is written in Coffeescript. It's important to only edit the .scss and .coffee source files, otherwise your changes will be lost on a subsequent compile. The easiest way to compile these files on your local machine is to use Fire.app (http://fireapp.handlino.com/) and watch the 'static' folder (be sure to issue a 'clean and compile' when you add a new file, otherwise it won't be seen).

Setting up your Vista/IE8 image

To be able to access your local host from the virtual machine, you'll need to add a host-only network: