Install:
Debian 9.1 container
4 cores, 10 GB disk, 1 GB RAM, 512 MB swap

adduser tdobes
adduser tdobes adm
adduser tdobes systemd-journal
adduser tdobes staff
adduser ssumichrast
adduser ssumichrast adm
adduser ssumichrast systemd-journal
adduser ssumichrast staff

aptitude install ca-certificates apt-transport-https
#echo 'deb https://deb.nodesource.com/node_8.x stretch main' > /etc/apt/sources.list.d/nodesource.list # 2018
#echo 'deb-src https://deb.nodesource.com/node_8.x stretch main' >> /etc/apt/sources.list.d/nodesource.list # 2018
echo 'deb https://deb.nodesource.com/node_8.x stretch main' > /etc/apt/sources.list.d/nodesource.list # 2019
echo 'deb-src https://deb.nodesource.com/node_8.x stretch main' >> /etc/apt/sources.list.d/nodesource.list # 2019
wget -O- https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -
aptitude update

aptitude install git nodejs

adduser --system --home /nonexistent --no-create-home nodecg

mkdir -p /var/local/nodecg
pushd /var/local/nodecg
git clone https://github.com/nodecg/nodecg.git .

#2018: npm install -g nodecg-cli bower pm2 # I sorta don't think these are needed anymore: generator-nodecg yo electron
npm install -g nodecg-cli pm2 # 2019
npm install --production
#2018: bower install --allow-root # ew

# extra for 2019 upgrade:
# npm install -g npm
# npm audit fix

mkdir -p logs
mkdir -p db/replicants
mkdir -p assets
mkdir -p cfg
chown nodecg logs db db/replicants assets cfg

echo '{ "host": "0.0.0.0" }' > cfg/nodecg.json # this is needed by new-ish versions of nodecg to listen on wildcard interface

mkdir -p /var/local/nodecg/bundles/glpa-infodisplay
chown tdobes /var/local/nodecg/bundles/glpa-infodisplay
su - tdobes
cd /var/local/nodecg/bundles/glpa-infodisplay
git clone https://bitbucket.org/glpa_av/glpa-infodisplay.git .
git checkout 2018-east-lansing
exit

chgrp -R staff .
chmod -R g+w .

su - tdobes
cd /var/local/nodecg/bundles/glpa-infodisplay
nodecg defaultconfig
cd /var/local/nodecg/cfg
mv glpa-infodisplay.json glpa-infodisplay.json.orig
wget http://live.packhead.com/glpa-infodisplay.json
exit

mkdir -p /var/local/pm2
chown nodecg:staff /var/local/pm2
chmod g+w /var/local/pm2

echo '[Unit]' > /etc/systemd/system/nodecg.service
echo 'Description=NodeCG Service' >> /etc/systemd/system/nodecg.service
echo 'After=network.target' >> /etc/systemd/system/nodecg.service
echo >> /etc/systemd/system/nodecg.service
echo '[Service]' >> /etc/systemd/system/nodecg.service
echo 'ExecStart=/usr/bin/pm2 start /var/local/nodecg/index.js --name nodecg' >> /etc/systemd/system/nodecg.service
echo 'User=nodecg' >> /etc/systemd/system/nodecg.service
echo 'Environment=PM2_HOME=/var/local/pm2' >> /etc/systemd/system/nodecg.service
echo 'Type=forking' >> /etc/systemd/system/nodecg.service
echo 'Restart=always' >> /etc/systemd/system/nodecg.service
echo 'RestartSec=1' >> /etc/systemd/system/nodecg.service
echo >> /etc/systemd/system/nodecg.service
echo '[Install]' >> /etc/systemd/system/nodecg.service
echo 'WantedBy=multi-user.target' >> /etc/systemd/system/nodecg.service

systemctl daemon-reload
systemctl enable nodecg.service
systemctl start nodecg.service

aptitude install sudo
adduser tdobes sudo
adduser ssumichrast sudo
computer/glpa_nodecg_container_creation_notes.txt · Last modified: 2019/10/20 01:39 by tdobes
Recent changes RSS feed Driven by DokuWiki Valid XHTML 1.0 Valid CSS