Deploying

To reduce the load on the nm2207.org server, I migrated the game to my personal server.

In class, we were taught to start the Node.js process in the background by appending an ampersand character.

$ node index.js &

Instead of doing that, I made use of an npm module called forever to run the script in the background.

$ npm install forever -g
$ forever start index.js

Forever ensures that the script runs continuously. On top of that, it also monitors the process and logs the stdout and stderr output to a log file.

The server listens to port 8000 on the loopback interface. It is then served through a reverse proxy by Apache.

<VirtualHost *:80>
  ServerName  game.nm2207.jon.sg
  ProxyPreserveHost On
  ProxyPass / http://127.0.0.1:8000/
  ProxyPassReverse / http://127.0.0.1:8000/
</VirtualHost>

The game is still work-in-progress but should be accessible here.