This is an old revision of the document!

Recipe for Shinobi Security DVR

Debian 9.4 container
4 cores, 8 GB disk, 2 GB RAM, 512 MB swap, big storage mountpoint on /mnt/dvr

adduser tdobes
adduser tdobes adm
adduser tdobes systemd-journal

aptitude update && aptitude forget-new && aptitude full-upgrade

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
aptitude --without-recommends install ffmpeg # alternate plan: install static binaries to avoid tons of X11 deps
aptitude install mariadb-server mariadb-client

# see
mkdir -p /opt/shinobi
git clone -b master /opt/shinobi
echo '{"Product": "Shinobi Professional (Pro)", "Branch": "master", "Version": "'`GIT_DIR=/opt/shinobi/.git git rev-parse HEAD`'", "Date": "'`date`'", "Repository": ""}' > /opt/shinobi/version.json

# see
# ...maybe use jq to manipulate json for config + stuff?

# TODO: finish this

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

npm install -g pm2 # I sorta don't think these are needed anymore: generator-nodecg yo electron

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
computer/shinobi_dvr.1547983328.txt.gz · Last modified: 2019/01/20 05:22 by tdobes
Recent changes RSS feed Driven by DokuWiki Valid XHTML 1.0 Valid CSS