Hosting Live Helper Chat on DigitalOcean

Introduction

DititalOcean let's you easily start preconfigured Live Helper Chat.

You can now easily host Live Helper Chat directly on DigitalOcean by using their marketplace https://marketplace.digitalocean.com/apps/live-helper-chat

Requirements

Live Helper Chat runs perfectly fine on the smallest available droplet. 5$/Month. It's cheaper to run on DititalOcean than on my own hosting 😄. With my hosting you get automated updates and support project directly.

Configured extensions

In the package I have included/configured following extensions:

  • NodeJS-Helper this will make chatting feel like real time without any delay for messages sync.
  • lhc-php-resque this will run background workers which can be used for external tasks. It enables to run background Rest API calls.

Snapshot has following parts configured also

  • cronjobs configured.
  • Co-Browsing nodejs server setup.

Core software stack

  • Centos 7.6
  • MariaDB 10.4.12-MariaDB
  • NodeJS v10.20.1
  • PHP 7.4.5
  • PHP-FPM 7.4.5 (fpm-fcgi)
  • Nginx 1.16.1

How to disable installed extensions

If for some reasons you want to disable installed extensions you can do the following

Disabling lhc-php-resque

Remove file so it won't start again

sudo rm -f /opt/livehelperchat/resque/.enable-cron

Kill the service

sudo kill -9 $(ps aux | grep "[0-9] resque-1.2: *" | awk '{print $2}')

Update /var/www/html/settings/settings.ini.php

From

...
'extensions' =>
array (
0 => 'nodejshelper',
1 => 'lhcphpresque',
),
...

To

...
'extensions' =>
array (
0 => 'nodejshelper',
),
...

Clear cache from back office.

Disabling Co-Browsing node server

If you are not planning to use screen sharing functionality makes sense to disable this service and save few megabytes of memory.

sudo systemctl stop nodejscobrowser
sudo systemctl disable nodejscobrowser

Disabling NodeJS-Helper extension

If for some reason you want to go even further you can disable and this extension

sudo systemctl stop nodejshelper
sudo systemctl disable nodejshelper

Update /var/www/html/settings/settings.ini.php

From

...
'extensions' =>
array (
0 => 'nodejshelper',
1 => 'lhcphpresque',
),
...

To

...
'extensions' =>
array (
0 => 'lhcphpresque',
),
...

Clear cache from back office.

Database logins

Database root logins can be found in this file

/root/.digitalocean_password

How to update Live Helper Chat

For that purposes I have prepared shell script. Just run this command once logged to the server. This command has to be run once you have installed Live Helper Chat itself.

sudo /opt/livehelperchat/lhc_upgrade.sh

If you are running older version you can also run this command.

cd /var/www/git/NodeJS-Helper/ && git pull origin master

If you run into issue like

Updating nodejs extension
remote: Enumerating objects: 144, done.
remote: Counting objects: 100% (144/144), done.
remote: Compressing objects: 100% (39/39), done.
remote: Total 118 (delta 72), reused 104 (delta 58), pack-reused 0
Receiving objects: 100% (118/118), 12.58 KiB | 0 bytes/s, done.
Resolving deltas: 100% (72/72), completed with 15 local objects.
From https://github.com/LiveHelperChat/NodeJS-Helper
* branch master -> FETCH_HEAD
Updating 636aeb4..5631e10
error: Your local changes to the following files would be overwritten by merge:
nodejshelper/serversc/lhc/server.js
Please, commit your changes or stash them before you can merge.
Aborting
Redirecting to /bin/systemctl restart nodejshelper.service

Run this command

cd /var/www/git/NodeJS-Helper && git checkout -f && git pull origin master

After that just modify /var/www/git/NodeJS-Helper/nodejshelper/serversc/lhc/server.js and change <use_your_secret_hash> with in /var/www/html/settings/settings.ini.php file located secrethash variable value.

After that just restart NodeJSHelper service.

service nodejshelper restart

After all that click clear cache in back office.

Todo's after install

  • Generate embed code and put it on your website.
  • Go to your account and configure your Username and Lastname also set your default nick as a support agent.
  • Configure your DNS records (SPF) so server can send legit e-mails.
  • If you are planning in using Rest API response type for bot. You should edit /var/www/html/extension/lhcphpresque/settings/settings.ini.php and set site_address to http://<server_ip> or http(s)://exmaple.org

SWAP

DigitalOcean does not recommend adding SWAP, but if you really want it you can follow this tutorial.

Last updated on by Remigijus Kiminas