here is my (not fucking working) headless 4play setup. requires xorg, openbox, firefox-esr.
node, user, & server*
# apt install npm # npm install -g nodemon # useradd 4play -mG video # su 4play $ mkdir ~/4play $ cd ~/4play $ cp /var/www/4get/extra/4play/page-render.js ./ $ npm install @lawlers/4play
files*
/etc/systemd/system/4play.service
[Unit] Description=4play After=network.target [Service] Type=simple User=4play WorkingDirectory=/home/4play/4play ExecStart=/usr/libexec/4play Restart=always Environment=NODE_ENV=production [Install] WantedBy=multi-user.target
/usr/libexec/4play
#!/bin/sh
res=1920x1080x24
user=4play
DISPLAY=:9
export DISPLAY
fatal(){
echo "FATAL: $1"
cleanup
exit 1
}
cleanup(){
pkill -u $user node
pkill -u $user firefox
pkill -u $user openbox
pkill -u $user Xvfb
}
xdpyinfo -display $DISPLAY > /dev/null && fatal "Xorg already running on display $DISPLAY." || {
echo "starting Xvfb on display $DISPLAY."
Xvfb $DISPLAY -screen 0 $res & sleep 1
}
xdpyinfo -display $DISPLAY > /dev/null && {
openbox & sleep 1
pgrep -l openbox || fatal "openbox did not start."
firefox-esr & sleep 5
cd ~/4play
nodemon page-render.js
} || fatal "failed to start Xvfb on $DISPLAY."
cleanup