Skip to content
Web Socket Tau
Python HTML JavaScript Java CSS C++ Other
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


*** Requirements
Python 2.7 (for argparse module)

Tornado Web Server


**** Install requirements with MacPorts

  sudo port install python27 py27-tornado py27-sqlalchemy

*** Running

Before running the first time, to set up necessary files run:


Then edit to add the missing fields.

Then, to run locally for development:

  sudo python2.7 --debug --port=8000 --ssl_port=8001

To build and run with Docker (experimental):

  docker build -t websockettau . && docker run --rm -p 8000:8000 -p 8001:8001 websockettau

To avoid having to rebuild the docker container on every change, you can run from your work directory:

  docker run --rm -p 8000:8000 -p 8001:8001 -v $PWD:/live -w /live websockettau

To run against a test version of a mysql db:

  docker run --rm -p 8000:8000 -p 8001:8001 -v $PWD:/live -w /live -e db=mysql -e mysql_password=$MYSQL_PASSWORD -e mysql_addr=$LOCAL_IP_FROM_IFCONFIG:3306 -e db_name=tau_game_2 websockettau python ./ --debug --port=8000

Connect to actual mysql for testing by running the proxy:

  curl -o cloud_sql_proxy
  ./cloud_sql_proxy -instances=tau-game:us-central1:tau-game-db=tcp:

Root access is required to bind to port 80 which is the default, so using ports 8000 and 8001 avoids this. The --debug flag allows the use of ^C to kill the server (very handy for restarting it during development).

For other options, type:

  python2.7 --help

*** Adding a new game type (as of July 15, 2012)
- Implement the rules in
- Add a name mapping to static/game_list.js.
- Add a name mapping and URL mapping to
- Add a rules description and name mapping to templates/about.html.
- (Sometimes applicable) Add changes to playing area in static/tau.js.
- (If adding new cards) Make the following updates:
    static/tau.js: getImgClass(), get_card_number()
    static/styles.css: new class similar to .regularTau, .projectiveTau, etc.

How to set up Fedora 16 server:
$ ssh root@...
$ passwd # to set password to something sane
$ yum install git
$ yum install python
$ yum install gcc-c++
$ git clone
# install tornado
$ wget
$ tar xvzf tornado-4.0.2.tar.gz
$ cd tornado-4.0.2
$ python build
$ sudo python install
# install backports
$ cd ~ && wget
$ tar -zxvf backports.ssl_match_hostname-
$ cd backports.ssl_match_hostname-
$ python install
# install pip
$ sudo yum install python-pip
# install certifi
$ pip-python install certifi
# install sqlalchemy
$ yum install python-sqlalchemy
# create
# Get google client id and secret from
$ cd ~/websockettau && cat >
cookie_secret = "SOME STRING HERE"
client_id = "GOOGLE CLIENT ID"
client_secret = "GOOGLE CLIENT SECRET"
# Set up certificates by creating localhost.crt certificate, and put in websockettau directory.
# Open ports, add to /etc/sysconfig/iptables:
# -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
# -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT
$ ./

# Set up ntp, so that time stays up to date (otherwise backups will fail when the clock skew gets too high!)
$ yum install ntp
$ ntpd

# setup automatic backups to S3
$ yum install s3cmd
$ s3cmd --configure
# follow the prompts...
# test that backups will work properly
$ ./run_backup
# verify that the backup appears in S3
# set up automatic backups. s3_crontab is a template. Modify it to suit you.
$ crontab s3_crontab

### How to set up GCP instance

1. Create GCP project.

2. Upload Docker image to GCR (called `$PROJECT/websockettau`). Probably requires enabling the GCR API:

docker build -t .
docker push

3. Enable Stackdriver Logging API.

4. Create a GCP instance that runs the container uploaded (or do via the UI), and populates the environment variables needed by
You can’t perform that action at this time.