dewv / ops

Tracking of operational tasks in DevOps production environment
2 stars 0 forks source link

Upgrading NPM, Node, Sails #157

Closed makarenkojDe closed 3 years ago

makarenkojDe commented 3 years ago

1. What is the goal of these changes? The goal of these changes is to update the servers (NPM, Node, Sails) to the latest version for smoother performance

2. List the machine(s) and file(s)/setting(s) to be changed production server. no specific file changes; see next step

3. Give exact commands or use marked screenshots to show GUI-based changes

There are apparently many ways to upgrade Node and npm. In the past, we have used the snap package manager on production server to install Node. But a different approach would be preferred, because we use snap for nothing else. We will try an approach that uses the nvm tool (Node version manager); it allows the installation of multiple Node versions, and switching which is active. (This page is the source for the nvm,node,npm commands, and includes other approaches, too.

# consider silencing uptime monitors, etc.
# can we do this with app running? if not ...
# systemctl stop nlc_attendance 
# install nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
# verify installation
nvm --version
# install latest Long Term Support version of Node
nvm install -lts
# list all available versions of Node (may or may not find old snap installed version)
nvm ls
# upgrade npm to latest version
npm install -g npm
# remove *global* installation of sails (v1.2.3)
npm uninstall -g sails
# app should now use *local* sails install (currently v1.3.1, but updates with app deploys)
# restart app service
systemctl restart nlc_attendance
# verify it
systemctl status nlc_attendance

4. What production services will be affected by the changes?

The entire NLC production app will be offline for at least part of the process. Cloud database is unaffected.

5. What files or other data should be backed up before making these changes?

Need to verify that scheduled Acronis backup is current and available for restore.

6. Approximately how long will it take to make the changes?

Perhaps less than an hour if all goes smoothly.

7. List steps for testing that the goal is met, and nothing was broken

8. List steps for safely backing out of these changes in case of difficulties

9. Summarize the messages to be sent to customers and/or staff before, during (if needed), and after these changes

This should be transparent to users. We will send an advance notice in case there is a time window that should be avoided. We will follow up with a summary of the outcome.

smattingly commented 3 years ago

We plan to execute this late this week or early next, after db cleanup is complete.

smattingly commented 3 years ago

Changes made tonight, and recorded in Ops Log. Note that it was necessary to uninstall sails with the same node version/setup (snap) used to install it. The systemd service file also needed modifications.