Update Server:
apt update && apt upgrade -y
Set hostname:
hostnamectl set-hostname letschat.example.com
Install Node.JS:
apt install dirmngr gnupg apt-transport-https ca-certificates software-properties-common -y
curl -sL https://deb.nodesource.com/setup_18.x | bash -
apt install nodejs -y
node -v
Install MongoDB Database:
wget http://archive.ubuntu.com/ubuntu/pool...
dpkg -i libssl1.1_1.1.1f-1ubuntu2_amd64.deb
wget -qO - https://www.mongodb.org/static/pgp/se... | apt-key add -
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-4.4.list
apt update
apt install -y mongodb-org
systemctl start mongod
systemctl enable mongod
systemctl status mongod
Install Let's Chat:
git clone https://github.com/sdelements/lets-ch...
cd lets-chat
npm install
cp settings.yml.sample settings.yml
npm start
ctrl+c
Create a Systemd Service File for Let's Chat:
nano /etc/systemd/system/letschat.service
paste
[Unit]
Description=Let's Chat Server
Wants=mongodb.service
After=network.target mongod.service
[Service]
Type=simple
WorkingDirectory=/root/lets-chat
ExecStart=/usr/bin/npm start
User=root
Group=root
Restart=always
RestartSec=9
[Install]
WantedBy=multi-user.target
systemctl daemon-reload
systemctl start letschat
systemctl enable letschat
systemctl status letschat
ss -antpl | grep 5000
Configure Nginx for Let's Chat:
apt install nginx -y
nano /etc/nginx/conf.d/letschat.conf
paste
server {
server_name letschat.example.com;
listen 80;
access_log /var/log/nginx/lets_chat-access.log;
error_log /var/log/nginx/lets_chat-error.log;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_cache_bypass $http_upgrade;
proxy_pass http://127.0.0.1:5000;
}
}
nginx -t
systemctl restart nginx
systemctl status nginx
Access Let's Chat Web Interface:
http://letschat.example.com