-
-
Save dshaw/fc55ac0d7fe2be5c2bf1 to your computer and use it in GitHub Desktop.
install N|Solid components into ~/nsolid
This file contains hidden or 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/sh | |
#------------------------------------------------------------------------------- | |
# 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.2.0 | |
VERSION_NSOL=`curl -s ${URL_NSOL}/nsolid-node/release/index.tab | grep -v project | sort -r | head -n 1 | awk '{print $2}'` | |
VERSION_CONS=`curl -s ${URL_NSOL}/nsolid-console/release/index.tab | grep -v project | sort -r | head -n 1 | awk '{print $2}'` | |
VERSION_PROX=`curl -s ${URL_NSOL}/nsolid-proxy/release/index.tab | grep -v project | sort -r | head -n 1 | awk '{print $2}'` | |
echo "downloading N|Solid to ${DIR_DOWN}" | |
echo "installing N|Solid in ${DIR_INST}" | |
echo "" | |
#------------------------------------------------------------------------------- | |
# 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}-darwin-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}-darwin-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.tar.gz \ | |
${URL_ETCD}/${VERSION_ETCD}/etcd-${VERSION_ETCD}-darwin-amd64.zip | |
#------------------------------------------------------------------------------- | |
# 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.tar.gz -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=1000 | |
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 | |
echo "installed N|Solid ${VERSION_NSOL} in ${DIR_INST}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment