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 stretch main' > /etc/apt/sources.list.d/nodesource.list
echo 'deb-src stretch main' >> /etc/apt/sources.list.d/nodesource.list
wget -O- | 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 .

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

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

echo '{ "host": "" }' > 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 .
git checkout 2018-east-lansing

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

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 '' >> /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 '' >> /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: 2018/10/10 23:51 by tdobes
Recent changes RSS feed Driven by DokuWiki Valid XHTML 1.0 Valid CSS