Skip to content
luaye edited this page Dec 8, 2012 · 31 revisions

Foos Ladder

Table football rating and leaderboard system using Node.js and CouchDB.

How to set up local server

  1. Download and install Node.js > http://nodejs.org/
  2. Download compiled version of CouchDB > http://couchdb.apache.org/

Set up local files

  1. cp config.sample.json config.json - use COPY in windows.
  2. Open config.json
  3. Set useFacebookAuth to false - FB logins don't work on local machine
  4. Set port to 8080 - to avoid admin permissions on your local machine
  5. cp static/config.sample.js static/config.js - use COPY in windows.
  6. Open static/config.js
  7. Set FACEBOOK_ENABLED to false

Run server:

  1. Run Couch DB (by running the app you downloaded)
  2. node server.js
  3. go to URL: http://localhost:8080/

How to set up live server with facebook Auth

When facebook auth is enabled, only users who are registered as a player with facebookId can submit matches. Alternatively there is 'secretAuthKey' which can be used to submit matches. This is used from other ways of submitting scores. Such as from an iOS score board app.

Current version does not allow users to enter their facebook id when adding. therefore this method may not work smoothly yet. - We currently manually set 'facebookId' in CouchDB's player fields.

  1. Follow same steps as local setup
  2. Create new Facebook App at > https://developers.facebook.com/apps - requires to be facebook developer
  3. Set "App Domains" to web domain you will be hosting foosladder. e.g yourdomain.com
  4. Set "Website with Facebook Login" to point to url you will be hosting foosladder. e.g http://yourdomain.com
  5. Open config.json
  6. Set port to 80
  7. Set useFacebookAuth to true
  8. Set secretAuthKey to a new random string. (can leave blank if you don't have scoreboard app)
  9. Open static/config.js
  10. Set FACEBOOK_ENABLED to true
  11. Set FACEBOOK_APP_ID to facebook app ID you created in step 2
  12. Set FACEBOOK_APP_URL_PART to url you will be hosting foosladder. e.g //yourdomain.com
  13. Run server:
    • Run couchDB
    • Run as background task (on linux): sudo node server.js >> server.log 2 >&1 &

Copy DB from LIVE

  1. ssh -N -L 9000:localhost:5984 **\<user\>** @ **\<host\>** -i **~/.ssh/\<.pem file\>**
  2. go to URL: http://localhost:9000/_utils/