Skip to content

Commit

Permalink
chore(monkey-patch-node): Node 8 upgrade script (#8655)
Browse files Browse the repository at this point in the history
* Update CHT 3.x node upgrade script to support both node 8 and 12

* fix URL, update zip name, add branch variable

* fix URL, update zip name, add branch variable
  • Loading branch information
mrjones-plip authored Oct 21, 2023
1 parent 1fdd76f commit 5555510
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 8 deletions.
Binary file added scripts/cht-3x-node-upgrade/node.8.17.0.zip
Binary file not shown.
40 changes: 32 additions & 8 deletions scripts/cht-3x-node-upgrade/upgrade.sh
Original file line number Diff line number Diff line change
@@ -1,27 +1,48 @@
#!/bin/bash

#####################################################
# Upgrade node from 8 -> 12 #
# Upgrade node from 8 to latest 8 or 12 #
# Defaults to version 12, but you can #
# pass "8" or "12" as arguments #
# #
# Only for use on CHT 3.x instances that have #
# TLS issues on outbound push #
# #
# see https://github.com/medic/cht-core/issues/7957 #
# see https://github.com/medic/config-muso/issues/1016 #
# #
#####################################################

echo "Start...Node version installed:"
/srv/software/medic-core/v2.1.1/x64/bin/node -v
set -e

NODE_VERSION="${1:-12}"

if [ "$NODE_VERSION" = "12" ];then
NODE_VERSION="12.22.12"
else
NODE_VERSION="8.17.0"
fi

# change BRANCH to "node-8-upgrade-script" to test before merging PR
BRANCH="master"
FILE="/srv/node.${NODE_VERSION}.zip"
URL="https://raw.githubusercontent.com/medic/cht-core/$BRANCH/scripts/cht-3x-node-upgrade/node.${NODE_VERSION}.zip"

echo ""
echo "Start to install latest Node ${NODE_VERSION}..."
echo ""

echo "Current Node version installed before upgrade:"
/srv/software/medic-core/v2.1.1/x64/bin/node -v

echo ""
echo "Installing zip..."
echo ""

cd /srv

apt -qq update
apt -qq install -y zip
apt-get -qq update
apt-get -qq install -y zip
echo ""
echo "Stopping services..."
echo ""
Expand All @@ -33,13 +54,16 @@ echo ""
echo ""
echo "Downloading node and installing..."
echo ""
echo "Writing to: $FILE"
echo "Curling from: $URL"
echo ""

curl -so /srv/node.12.22.12.zip https://raw.githubusercontent.com/medic/cht-core/master/scripts/cht-3x-node-upgrade/node.12.22.12.zip
curl -so $FILE $URL

unzip /srv/node.12.22.12.zip
unzip $FILE
chmod +x node
mv /srv/node /srv/software/medic-core/v2.1.1/x64/bin/node
rm /srv/node.12.22.12.zip
rm /srv/node.${NODE_VERSION}.zip


echo ""
Expand Down

0 comments on commit 5555510

Please sign in to comment.