Last active
January 31, 2021 13:19
-
-
Save pmuellr/3854a1a7f17159b432e6 to your computer and use it in GitHub Desktop.
sample script to install N|Solid components into ~/nsolid
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#------------------------------------------------------------------------------- | |
# download/unpack componentry for N|Solid into ~/nsolid | |
#------------------------------------------------------------------------------- | |
# updates: | |
# 2016-05-04 print note about officially supported "Download All" tarball | |
# 2016-02-10 change to get N|Solid versions dynamically from index.tab | |
# 2016-02-10 upgrade to N|Solid 1.2.1 | |
# 2016-01-12 upgrade to N|Solid 1.2.0 | |
# 2015-12-04 upgrade to N|Solid 1.1.1 | |
# 2015-11-18 upgrade to N|Solid 1.1.0 | |
# 2015-10-20 first published | |
#------------------------------------------------------------------------------- | |
echo 'As of May 2016, with N|Solid 1.3, you can now download all the N|Solid bits' | |
echo 'in a single tarball. That tarball includes an `install.sh` script similar' | |
echo 'to this one. See the "Download All" links at https://downloads.nodesource.com/' | |
echo '' | |
echo 'Though this script will continue to work, you probably want to use the' | |
echo '"Download All" process in the future, as that is officially supported,' | |
echo 'and this script is not.' | |
echo '' | |
#------------------------------------------------------------------------------- | |
# download/unpack componentry for N|Solid into ~/nsolid | |
#------------------------------------------------------------------------------- | |
# directories | |
DIR_DOWN=~/Downloads | |
DIR_INST=~/nsolid | |
# URL prefixes | |
URL_NSOL=https://nsolid-download.nodesource.com/download | |
URL_ETCD=https://github.com/coreos/etcd/releases/download | |
# version #'s | |
VERSION_ETCD=v2.3.3 | |
VERSION_NSOL=`curl -s https://nsolid-download.nodesource.com/download/nsolid-node/release/index.tab | tail -n +2 | head -n 1 | cut -f2` | |
VERSION_CONS=`curl -s https://nsolid-download.nodesource.com/download/nsolid-console/release/index.tab | tail -n +2 | head -n 1 | cut -f2` | |
VERSION_PROX=`curl -s https://nsolid-download.nodesource.com/download/nsolid-proxy/release/index.tab | tail -n +2 | head -n 1 | cut -f2` | |
echo "downloading N|Solid to ${DIR_DOWN}" | |
echo "installing N|Solid in ${DIR_INST}" | |
echo "" | |
# get os version | |
if [[ "$OSTYPE" == "linux-gnu" ]]; then | |
OS=linux | |
ETCD_EXT=tar.gz | |
elif [[ "$OSTYPE" == "darwin"* ]]; then | |
OS=darwin | |
ETCD_EXT=zip | |
else | |
echo "unknown OS, downloading linux" | |
OS=linux | |
ETCD_EXT=tar.gz | |
fi | |
#------------------------------------------------------------------------------- | |
# start downloads | |
#------------------------------------------------------------------------------- | |
mkdir -p ${DIR_DOWN} | |
echo "downloading N|Solid Runtime ${VERSION_NSOL}" | |
curl \ | |
--user-agent nsolid-install.sh \ | |
--location \ | |
--progress-bar \ | |
--output ${DIR_DOWN}/nsolid-node.tar.gz \ | |
${URL_NSOL}/nsolid-node/release/${VERSION_NSOL}/nsolid-${VERSION_NSOL}-${OS}-x64.tar.gz | |
echo "downloading N|Solid Console ${VERSION_CONS}" | |
curl \ | |
--user-agent nsolid-install.sh \ | |
--location \ | |
--progress-bar \ | |
--output ${DIR_DOWN}/nsolid-cons.tar.gz \ | |
${URL_NSOL}/nsolid-console/release/${VERSION_CONS}/nsolid-console-${VERSION_CONS}-${OS}-x64.tar.gz | |
echo "downloading N|Solid Proxy ${VERSION_PROX}" | |
curl \ | |
--user-agent nsolid-install.sh \ | |
--location \ | |
--progress-bar \ | |
--output ${DIR_DOWN}/nsolid-prox.tar.gz \ | |
${URL_NSOL}/nsolid-proxy/release/${VERSION_PROX}/nsolid-proxy-${VERSION_PROX}.tar.gz | |
echo "downloading etcd ${VERSION_ETCD}" | |
curl \ | |
--user-agent nsolid-install.sh \ | |
--location \ | |
--progress-bar \ | |
--output ${DIR_DOWN}/etcd.${ETCD_EXT} \ | |
${URL_ETCD}/${VERSION_ETCD}/etcd-${VERSION_ETCD}-${OS}-amd64.${ETCD_EXT} | |
#------------------------------------------------------------------------------- | |
# unpack | |
#------------------------------------------------------------------------------- | |
echo "" | |
echo "unpacking tarballs" | |
mkdir -p ${DIR_INST} | |
mkdir -p ${DIR_INST}/console | |
mkdir -p ${DIR_INST}/proxy | |
mkdir -p ${DIR_INST}/etcd | |
rm -rf ${DIR_INST}/console/* | |
rm -rf ${DIR_INST}/proxy/* | |
rm -rf ${DIR_INST}/etcd/* | |
tar --strip-components 1 -zxf ${DIR_DOWN}/nsolid-node.tar.gz -C ${DIR_INST} | |
tar --strip-components 1 -zxf ${DIR_DOWN}/nsolid-cons.tar.gz -C ${DIR_INST}/console | |
tar --strip-components 1 -zxf ${DIR_DOWN}/nsolid-prox.tar.gz -C ${DIR_INST}/proxy | |
tar --strip-components 1 -zxf ${DIR_DOWN}/etcd.${ETCD_EXT} -C ${DIR_INST}/etcd | |
#------------------------------------------------------------------------------- | |
# write launch scripts | |
#------------------------------------------------------------------------------- | |
#-------------------------------------- | |
echo "writing launch-etcd.sh" | |
cat > ${DIR_INST}/launch-etcd.sh << END_ETCD_SH | |
#!/bin/sh | |
cd ${DIR_INST}/etcd | |
./etcd | |
END_ETCD_SH | |
chmod +x ${DIR_INST}/launch-etcd.sh | |
#-------------------------------------- | |
echo "writing launch-nsolid-console.sh" | |
cat > ${DIR_INST}/launch-nsolid-console.sh << END_CONSOLE_SH | |
#!/bin/sh | |
cd ${DIR_INST}/console | |
NODE_ENV=production ../bin/nsolid bin/nsolid-console --interval=3000 | |
END_CONSOLE_SH | |
chmod +x ${DIR_INST}/launch-nsolid-console.sh | |
#-------------------------------------- | |
echo "writing launch-proxy.sh" | |
cat > ${DIR_INST}/launch-nsolid-proxy.sh << END_PROXY_SH | |
#!/bin/sh | |
cd ${DIR_INST}/proxy | |
../bin/nsolid proxy.js | |
END_PROXY_SH | |
chmod +x ${DIR_INST}/launch-nsolid-proxy.sh |
@mytototo in the future, best to ask questions on Stack Overflow, tagging nsolid: http://stackoverflow.com/questions/tagged/nsolid
Seems possible that something is still running an older version of N|Solid that you had installed. Can you remove (or move out of the way) any older versions, and try again?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks a lot for sharing! Everything works fine with the latest revision expect snapshots... I can't create a new one. I have this error:
Is it related to an old version of N|Solid previously installed on my computer?