by smiley1983 » Wed Dec 19, 2012 5:58 am
Here are some instructions for the setup:
First, clone or download the whole repository:
wget https://github.com/smiley1983/ants-tcp/archive/master.zip
or
git clone https://github.com/smiley1983/ants-tcp.git
In planetwars/planetwars_tcp there are two scripts, webserver.py and tcpserver.py - currently they are set to open ports 2090 and 2091 respectively. Change these to whichever ports you want.
Then run them both as a normal user with something like this:
nohup ./webserver.py> webserver.nohup &
nohup ./tcpserver.py> tcpserver.nohup &
Using nohup means that you can log out of the ssh session without the scripts dying.
You can redirect port 80 to whichever port you chose for the webserver if you prefer. I use this line, to be run on boot:
sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 2090
It's possible to run multiple servers on one machine, connecting to different ports as I have done here:
http://li414-97.members.linode.com/home
To create that front page and link all of the servers back to it, I have done some ugly context-specific editing of all the webserver.py files, not published on github. A better solution is not too difficult I'm sure, but I'm working on other things for now.