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.
- Download and install VirtualBox for OSX
- Download and install vagrant for OSX
- Get the "Command Line Tools for Xcode":https://developer.apple.com/downloads or "Xcode":http://itunes.apple.com/us/app/xcode/id497799835
- Install fabric and Jinja
sudo pip install --upgrade fabric==1.6.0 jinja2
- Checkout the repository
git clone git@github.com:whatsthehubbub/rippleeffect.git && cd rippleeffect
- Bootstrap the dev environment
fab bootstrap
(you may want to grab a coffee)
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=admin@email.com 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('admin@email.com', '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
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
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
To spinup a new server:
- In the control panel, create a new server from the saved image
appserver
. - Deploy the latest code to the server:
fab prod deploy deploy@<ip-address>
- In the control panel, add the server to the load balancer.
- 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;
- develop is mainline development
- release is the version currently on playrippleeffect.com
- master is currently unused
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).
To be able to access your local host from the virtual machine, you'll need to add a host-only network:
- Open your VirtualBox preferences
- Go to Network
- This is probably empty, click to add a new one
- Then, open the newly added network's settings and note down the IP address
- Close these settings and open the settings of the virtual machine. Go to network again. Adapter 1 should be set NAT. Make sure Adapter 2 is set to the host-only adapter you just created.
- Now, launch your image. Open the windows explorer and navigate to Windows\System32\drivers\etc and open the hosts file with Notepad.
- Make sure the IP address pointing to local hosts is the one you noted down earlier.
- Save the file, launch Internet Explorer and open your locally running Ripple Effect website through the same IP address with :8000 appended.