Store Community Support Documentation
ElekTrO

Can anyone do a step by step on how to setup nodejs on centos7?  What is chat server key and what is the private key?

#1

Chat server key : Is rendom string of numbers like "64645746" (What ever you choose)

private key : you will get when you install SSL Certificate for your domain name..

FroztIkon
#2

EPEL repo required

1.

sudo yum install nodejs
yum install npm

yum install redis -y

systemctl start redis.service

systemctl enable redis

nano /etc/redis.conf (or vi if you prefer)

Add this to bind redis to answer only from localhost

bind 127.0.0.1

systemctl restart redis.service

2. 

npm update

npm install

cd /path/to/PF.Site/Apps/core-im/server/

mv config.js.new config.js

3.

FTP or filemanager edit config.js

    chat_server_key: "your-chat-server-key", <- create a random string but avoid things like !,.?[]{}';:"% | remember this key for later

    secure: false, // use ssl ?   <- set to true if you use SSL certificates

    privateKey: "./private_key.key"// path to private key ?   <- location of the certificates private key

    cert: "./cert.crt",  // path to cert key ?   <- location of the certificate itself

    redis: {

        host: '127.0.0.1',

        port: 6379,

        password: '' <- there wasn't a redis password or auth in the previous steps so leave this like it is

4.

Now we need another application to run stuff in the background, since if we close our SSH it stops the application running.

npm install pm2 -g
pm2 start index.js --name imchat

 

5.

With both NodeJS and Redis installed you can now visit your AdminCP and head over to the IM App: AdminCP > Apps > IM

For the Provide your Node JS server setting enter: http://your-nodejs-server.com:3000 or https://your-nodejs-server.com:3000

  • If your site is using SSL, you need to configure this setting with domain name of NodeJS server instead of IP address. 

In Provide your Node JS server key, enter the key that you have configured in your chat server.

Make sure to change your-nodejs-server.com with the IP or Domain that leads to your NodeJS server.

Congratulations you have successfully setup the IM App.

Last update on April 1, 4:02 am by FroztIkon.
ElekTrO
#3

Thank you.