Open KevinSnyderCodes opened 6 years ago
Just making some notes. I'm pretty sure there are some more apt-get's in here to get Node installed.
mDNS instructions:
sudo vi /etc/hostname sudo vi /etc/hosts sudo apt-get update sudo apt-get -y dist-upgrade sudp apt-get -y install avahi-daemon build-essential reboot
bash <(curl -sL https://raw.githubusercontent.com/node-red/raspbian-deb-package/master/resources/update-nodejs-and-nodered)
git clone https://github.com/killer-queen-stats/kqstats cd kqstats
npm audit fix npm install
sudo -s cat > /lib/systemd/system/kqstats.service << EOF [Unit] Description=KQ Stats After=multi-user.target
[Service] Type=simple User=pi WorkingDirectory=/home/pi/kqstats ExecStart=/bin/bash -ce 'exec /usr/bin/npm run start:debug -- -c ws://kq.local:12749 >> /home/pi/kqstats/logs/kqstats.log 2>&1' Restart=on-abort
[Install] WantedBy=multi-user.target EOF
sudo systemctl daemon-reload sudo systemctl enable kqstats.service sudo systemctl start kqstats.service
** Update *** This is no longer an issue if you run "npm audit fix" before doing the install..... node-sass is no longer a dependency.
Original Message
Current issue is that the npm install basically bricks the Pi. Need a way to cross-compile elsewhere and then deliver it.
This would help tremendously: https://github.com/sass/node-sass/issues/1609
#!/bin/sh
REPODIR="/home/pi/repo"
HOMEDIR="/home/pi"
BRANCH=""
# Setting the nice value to as low priority as possible
# The npm install tends to hog up all resources
renice -n 10 $$
[[ `whoami` != "root" ]] && SUDO="/usr/bin/sudo"
if [[ ! -d ${REPODIR} ]]
then
mkdir -p ${REPODIR}
fi
cd ${REPODIR}
[[ -d ${REPODIR}/kqstats ]] && ${SUDO} rm -rf ${REPODIR}/kqstats
if [[ ${BRANCH} ]]
then
BRANCH_STR="-b ${BRANCH}"
fi
git clone https://github.com/killer-queen-stats/kqstats ${BRANCH_STR}
cd ${REPODIR}/kqstats
npm audit fix
npm install
NPMRC=$?
if [[ ! -d ${REPODIR}/kqstats ]]
then
echo "could not find ${REPODIR}/kqstats. Exiting."
exit 1
fi
if [[ $NPMRC == 0 ]]
then
[[ -d ${HOMEDIR}/kqstats.3.old ]] && rm -rf ${HOMEDIR}/kqstats.3.old
[[ -d ${HOMEDIR}/kqstats.2.old ]] && mv ${HOMEDIR}/kqstats.2.old ${HOMEDIR}/kqstats.3.old
[[ -d ${HOMEDIR}/kqstats.1.old ]] && mv ${HOMEDIR}/kqstats.1.old ${HOMEDIR}/kqstats.2.old
$SUDO systemctl stop kqstats.service
[[ -d ${HOMEDIR}/kqstats ]] && mv ${HOMEDIR}/kqstats ${HOMEDIR}/kqstats.1.old
mv ${REPODIR}/kqstats ${HOMEDIR}
$SUDO chown -R pi:pi ${HOMEDIR}/kqstats
$SUDO systemctl start kqstats.service
else
echo "npm intall returned non-zero return code."
exit 2
fi
kqstats can persistently run on a Raspberry Pi that is on the same network as the Killer Queen cabinet. This is beneficial for a number of reasons:
Getting this to work will be a multi-step process:
There may be other steps required.
Resources