Skip to content

Production architecture

Bmagic edited this page May 2, 2016 · 5 revisions

For production usage I use a lot of processes and a reverse proxy (ngnix) in front.

Process Count :

  • 8 WebserverProcess (one for each CPU)
  • 4 CharacterUpdateProcess
  • 4 GuildUpdateProcess
  • 1 WowProgressUpdateProcess

Start script

I start all of this with :

# Webserver
NODE_ENV=webserver forever start -w --watchDirectory=server -a -l /dev/null server/server.js -ws -p 3001
NODE_ENV=webserver2 forever start -w --watchDirectory=server -a -l /dev/null server/server.js -ws -p 3002
NODE_ENV=webserver3 forever start -w --watchDirectory=server -a -l /dev/null server/server.js -ws -p 3003
NODE_ENV=webserver4 forever start -w --watchDirectory=server -a -l /dev/null server/server.js -ws -p 3004
NODE_ENV=webserver5 forever start -w --watchDirectory=server -a -l /dev/null server/server.js -ws -p 3005
NODE_ENV=webserver6 forever start -w --watchDirectory=server -a -l /dev/null server/server.js -ws -p 3006
NODE_ENV=webserver7 forever start -w --watchDirectory=server -a -l /dev/null server/server.js -ws -p 3007
NODE_ENV=webserver8 forever start -w --watchDirectory=server -a -l /dev/null server/server.js -ws -p 3008

# Characters Update
NODE_ENV=characterupdate forever start -w --watchDirectory=server -a -l /dev/null server/server.js -cu
NODE_ENV=characterupdate forever start -w --watchDirectory=server -a -l /dev/null server/server.js -cu
NODE_ENV=characterupdate forever start -w --watchDirectory=server -a -l /dev/null server/server.js -cu
NODE_ENV=characterupdate forever start -w --watchDirectory=server -a -l /dev/null server/server.js -cu

# Guild Update
NODE_ENV=guildupdate forever start -w --watchDirectory=server -a -l /dev/null server/server.js -gu
NODE_ENV=guildupdate forever start -w --watchDirectory=server -a -l /dev/null server/server.js -gu
NODE_ENV=guildupdate forever start -w --watchDirectory=server -a -l /dev/null server/server.js -gu
NODE_ENV=guildupdate forever start -w --watchDirectory=server -a -l /dev/null server/server.js -gu

# Wowprogress Update
NODE_ENV=wowprogressupdate forever start -w --watchDirectory=server -a -l /dev/null server/server.js -wp

Crontab

And I run the cron every day @5am

0 5 * * * NODE_ENV=cron node warcraft-lfg/server/server.js -cron
Clone this wiki locally