Difference between revisions of "Node Chat/Docs/Dev Setup"

From BlueLine Games Wiki
Jump to: navigation, search
(Pulled over from prior version of wiki)
 
(No difference)

Latest revision as of 18:54, 9 October 2015

Node Chat / Docs

Overview

The full stack of chat will run on the devboxes if you enable the extension.

Setup

To set it up:

  • Check out the chat repo to /usr/wikia/source/chat:
git clone https://github.com/SeanColombo/chat
  • Edit config/ChatConfig_EXAMPLE.json (and rename it not to have _EXAMPLE in it)) and
    • update "ChatHost": "dev-chat:8080" to "ChatHost": "dev-chat:9002"
    • change all instances of dev-chat to dev-YOURDEVBOX
  • Add to DevBoxSettings.php: $wgEnableChat = true;
  • Install Redis if not already on your dev-box:
 sudo apt-get install redis-server
  • Make sure redis-server is running locally
 service redis-server start
  • run npm install inside the chat main directory
npm install

Running Chat

  • start the chat service
 cd [PATH TO THE github CHECKOUT]
 /usr/bin/node server.js loglevel=debug mode=dev basket=1 instance=2


Running Chat with multiple baskets

If you need to test failover between the multiple baskets, then you can make that happen on dev:

  • Modify [github clone location]/ChatConfig.json to have multiple buckets for dev. For example, change the code to:
"dev":{
                "ChatHost": "dev-chat:9000",
                "MainChatServers": {
                        "1":[ "dev-chat:9001" , "dev-chat:9002" ],
                        "2":[ "dev-chat:9003" , "dev-chat:9004" ] 
                },
                "ApiChatServers": {
                        "1":[ "dev-chat:9101", "dev-chat:9102" ],
                        "2":[ "dev-chat:9103", "dev-chat:9104" ] 
                },
                "RedisServer": {
                        "1": "127.0.0.1:6379",
                        "2": "127.0.0.1:6379"
                },
                "ProxyServer": "127.0.0.1:6081"
        },

But with your whatever your chat server box is, instead of dev-chat.

 cd /usr/wikia/source/chat
 /usr/bin/node server.js loglevel=debug mode=dev basket=1 instance=2
 /usr/bin/node server.js loglevel=debug mode=dev basket=2 instance=2
  • You can move all wikis over to use a different basket by changing wgChatServerBasket in WikiFactory for community.wikia.com to put it in a different basket (all wikis share the setting from Community). - TODO:Update this

Testing multiple instances

TODO: CHAT PROXY NOTES HERE... need to make some general-purpose proxy rules to keep Chat servers only internally accessible.

Troubleshooting

If you get an error on the AJAX request that says:

io.j[0](new Error("handshake unauthorized"))

It means that the chat server has probably allocated an instance of the chat for that wiki on somebody else's devbox.  Try using a different test wiki.  If that doesn't work, flush redis cache to reset all chat rooms, then try again:

$ redis-cli
> flushall

Additional Help

  • Contact the Social Team to debug if anything goes wrong (it probably will)
  • If the client can't connect, double check the instance number in the http request, it might be 1
  • Contact Owen if you want to set up a full hproxy config for this to run both instances.