Skip to content

Gantt PDF Server Setup

These are the instructions for setting up the Gantt PDF server in our current infrastructure. The Gantt PDF server is being installed on the same server as the websocket server.

Websocket Server Setup

Clone Bryntum PDF server repository

apt install -y git
git clone https://github.com/bryntum/pdf-export-server.git /usr/src/bryntum-pdf-export

Install Node 20 using NVM

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
nvm install v20.18.3
nvm use 20.18.3

Verify you are using node v20:

node -v
ln -s "$(which node)" /usr/bin/

Install Bryntum Dependencies

cd /usr/src/bryntum-pdf-export/
npm i

Install System Dependencies

Install Chromium

apt install -y ca-certificates fonts-liberation libasound2t64 libatk-bridge2.0-0 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgbm1 libgcc1 libglib2.0-0 libgtk-3-0 libnspr4 libnss3 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 lsb-release wget xdg-utils

apt install -y chromium

Update libstdc++

There's probably a less roundabout way of doing this, but this worked:

cd ~
wget https://repo.anaconda.com/archive/Anaconda3-2019.07-Linux-x86_64.sh
sh Anaconda3-2019.07-Linux-x86_64.sh
cp anaconda3/lib/libstdc++.so.6.0.26 /usr/lib64
rm /usr/lib64/libstdc++.so.6
ln -s /usr/lib64/libstdc++.so.6.0.26 /usr/lib64/libstdc++.so.6

Add to Supervisor

mkdir /var/log/bryntum-pdf-export

Add the following section to the end of /etc/supervisord.d/websocket.ini:

[program:gantt-pdf]
command=/usr/bin/node /usr/src/bryntum-pdf-export/src/server.js --http=8081 --maximum=250mb
autostart=true
autorestart=true
stderr_logfile=/var/log/bryntum-pdf-export/export.error.log
stdout_logfile=/var/log/bryntum-pdf-export/export.log

Restart Supervisor

systemctl restart supervisord

Check it's running, supervisor should show three processes (four including itself): bryntum pdf, websocket server, scheduler listener.

systemctl status supervisord.service

Add app.methodgrid.com to hosts file

This is necessary because CloudFlare can block requests from the Gantt PDF process to the app.

Replace APP_PUBLIC_IP with the public IP address of the load balancer that app.methodgrid.com is behind:

echo 'APP_PUBLIC_IP app.methodgrid.com' >> /etc/hosts
echo 'APP_PUBLIC_IP app.methodgrid.com' >> /etc/cloud/templates/hosts.debian.tmpl

Web Servers

On all web servers, add the following to the app apache conf, below the existing proxy rules.

The IP of the server is the same as in the existing proxy rule for the websocket server that is already in the config (the protocol and ports are different):

ProxyPass "/gantt-pdf" "http://WEBSOCKET_SERVER-IP:8081/"
ProxyPassReverse "/gantt-pdf" "http://WEBSOCKET-SERVER-IP:8081/"

This must be done on every web server.

Restart Apache

systemctl reload httpd

Firewalls

  • Webserver firewall: Add rule allowing outgoing connections to websocket server on port 8081
  • Websocket firewall: Add rule allowing incoming connections from webserver on port 8081
Last modified by: Unknown