This document describes the steps to install the traveler application. These steps can be automated in a puppet or docker platform.
Check OS release
cat /etc/os-release
Check if yum is available. Install if not.
which yum
Check available node.js from the default yum repo.
yum list nodejs
Check https://nodejs.org/en/about/releases/ for the current LTS node version.
You will need curl
to install.
which curl
E.g. in order to install node v14.
curl -sL https://rpm.nodesource.com/setup_14.x | sudo bash -
sudo yum install -y nodejs
Check https://github.com/nodesource/distributions for the current LTS.
After install, verify the node
and npm
version.
which node
node --version
which npm
npm --version
Following https://www.digitalocean.com/community/tutorials/how-to-install-mongodb-on-centos-7 to install on centos 7.
sudo nano /etc/yum.repos.d/mongodb-org.repo
Add the following
[mongodb-org-3.4]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.4/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.4.asc
yum repolist
sudo yum install mongodb-org
Check mongod
with systemctl
after installation.
sudo systemctl stop mongod
sudo systemctl status mongod
See https://docs.mongodb.com/manual/tutorial/transparent-huge-pages/ for how to disable THP.
Add a traveler
user to run the application on the box with node.js.
useradd -m -d /home/traveler traveler
sudo passwd traveler
At /home/traveler
,
git clone https://github.com/dongliu/traveler.git
Copy the config
directory from the repo root to /home/traveler/traveler-config/
. Update the configuration files according to the installation. See the docker
directory for example.
As an admin user
sudo npm install pm2@latest -g
which pm2
As the traveler
user
pm2 install pm2-logrotate
Start the traveler application with pm2. This requires the application is properly configured.
NODE_ENV=production TRAVELER_CONFIG_REL_PATH=../traveler-config/ pm2 start --name traveler app.js
pm2 save
pm2 files will be created at /home/traveler/.pm2
.
As the admin user
sudo env PATH=$PATH:/usr/bin pm2 startup centos -u traveler --hp /home/traveler
Check if traveler script is properly created by
cat /etc/systemd/system/pm2-traveler.service
Reboot the box and the traveler application should start.