Upgrade to current node/emergence v1.0.x on legacy systems


This guide covers getting a current node version and current version of emergence-kernel running on a legacy Ubuntu VM

Upgrade system, node, and emergence packages

# list current global node modules and bin
ls -l /usr/local/lib/node_modules
ls -l /usr/local/bin

sudo su -
curl -sL https://deb.nodesource.com/setup_10.x | bash
apt-get remove nodejs nodejs-legacy npm

# made sure there is no node
which node
which npm

apt-get dist-upgrade
apt-get install nodejs
apt-get autoremove

npm cache clean -f
npm install -g npm

npm install --unsafe-perm --verbose -g emergence puppeteer-cli
npm install -g git+https://github.com/JarvusInnovations/emergence-backup.git
npm install -g underscore-cli htpasswd

mv /usr/local/lib/node_modules /usr/local/lib/node_modules.bak
find /usr/local/bin -type l ! -exec test -e {} \; -delete

# review
ls -l /usr/local/bin
ls -l /usr/local/lib/node_modules
ls -l /usr/lib/node_modules

# do a full emergence reset

Upgrade and validate backups

# check for old backup schedules
find /etc/cron* -name '*emergence*'
echo "require('/usr/lib/node_modules/emergence-backup/lib').writeCron(null, null, console.log);" | node

# verify that backup works