Skip to content

Install a own Fishtris Server

Sven Anders edited this page Mar 8, 2014 · 5 revisions

Install node.js

https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager

Install npm

curl https://www.npmjs.org/install.sh >install.sh
chmod 755 install.sh
./install.sh

Install socket.io

npm install -p socket.io

Start the Fishtris Server

useradd fishtris
su -s /bin/bash fishtris
git clone [email protected]:tabacha/fishtris2.git
cd fishtris2
nodejs fishtris-server.js

Now you can connect with a browser to http://localhost:8080/

If you want to listen to port 80 add as root:

iptables -t nat -A PREROUTING -i eth0 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8080

Not required, but usefull

Install js-beatuify

npm install -p js-beatuify

Create a pre-comit check

#!/bin/bash
JSB=$(which js-beautify)

if [ -z "$JSB" ] ; then
   echo please install js-beautify
   exit 1
else 
     $JSB fishtris.js >/tmp/fishtris$$.js
     diff fishtris.js /tmp/fishtris$$.js
     if [ $? != 0 ] ; then 
        echo "Please js-beautify -r fishtris.js"
        exit 1
     fi

     $JSB fishtris-server.js >/tmp/fishtris-server$$.js
     diff fishtris-server.js /tmp/fishtris-server$$.js
     if [ $? != 0 ] ; then 
        echo "Please js-beautify -r fishtris-server.js"
        exit 1
     fi

     rm /tmp/fishtris$$.js /tmp/fishtris-server$$.js

fi
exit 0
Clone this wiki locally