Welcome

pimentaCHAT on Debian

This tutorial was tested on Debian 9 using pimentaCHAT 0.70.0

pimentaCHAT recommends MongoDB version 3.6 and NodeJS version is 8.11.3.

Install necessary dependency packages

Import the public key used by apt to install the official MongoDB packages and create the following list file:

sudo apt-get install dirmngr && sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5
echo "deb http://repo.mongodb.org/apt/debian stretch/mongodb-org/3.6 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list

Configure Node.js to be installed via package manager:

sudo apt-get update && sudo apt-get install -y curl && curl -sL https://deb.nodesource.com/setup_8.x | sudo bash -

Install build tools, MongoDB, nodejs and graphicsmagick:

sudo apt-get install -y build-essential mongodb-org nodejs graphicsmagick

Using npm install inherits and n, and the node version requiere by pimentaCHAT:

sudo npm install -g inherits n && sudo n 8.11.3

Install pimentaCHAT

Download pimentaCHAT latest version:

curl -L https://releases.pimenta.chat/latest/download -o /tmp/pimenta.chat.tgz
tar -xzf /tmp/pimenta.chat.tgz -C /tmp

Install (this tutorial uses /opt but change it as convenience):

cd /tmp/bundle/programs/server && npm install
sudo mv /tmp/bundle /opt/pimentaCHAT

Configure the pimentaCHAT service

Add the user pimentachat, set the right permissions on pimentaCHAT folder and create the pimentaCHAT service file:

sudo useradd -M pimentachat && sudo usermod -L pimentachat
sudo chown -R pimentachat:pimentachat /opt/pimentaCHAT
echo -e "[Unit]\nDescription=The pimentaCHAT server\nAfter=network.target remote-fs.target nss-lookup.target nginx.target mongod.target\n[Service]\nExecStart=/usr/local/bin/node /opt/pimentaCHAT/main.js\nStandardOutput=syslog\nStandardError=syslog\nSyslogIdentifier=pimentachat\nUser=pimentachat\nEnvironment=MONGO_URL=mongodb://localhost:27017/pimentachat ROOT_URL=http://your-host-name.com-as-accessed-from-internet:3000/ PORT=3000\n[Install]\nWantedBy=multi-user.target" | sudo tee /lib/systemd/system/pimentachat.service

Open the pimentaCHAT service file just created (/lib/systemd/system/pimentachat.service) using sudo and your favourite text editor, and change the ROOT_URL environmental variable to reflect the URL you want to use for accessing the server (optionally change MONGO_URL and PORT):

MONGO_URL=mongodb://localhost:27017/pimentachat
ROOT_URL=http://your-host-name.com-as-accessed-from-internet:3000
PORT=3000

Enable and start MongoDB and pimentaCHAT:

sudo systemctl enable mongod && sudo systemctl start mongod
sudo systemctl enable pimentachat && sudo systemctl start pimentachat

Additional configurations

Configure replicas for your MongoDB (recommended for production environments)

Configure a HTTP reverse proxy to access pimentaCHAT server

Configure your pimentaCHAT server

Once decided if going for a standalone instance or a replica set in MongoDB, open a web browser and access the configured ROOT_URL (http://your-host-name.com-as-accessed-from-internet:3000), follow the configuration steps to set an admin account and your organization and server info.