jakethedev / tavernbot

D&D Discord Bot - based on Discord.js and Node 8.
MIT License
25 stars 6 forks source link

Autostart and Reloading #47

Closed ghost closed 6 years ago

ghost commented 6 years ago

We need an init script or something of the sort that we can enable to auto-start the bot on boot, and to reload the bot when code changes. That way we can cron a "git pull master" and have auto-updates work smoothly

Nodemon: https://www.npmjs.com/package/nodemon https://github.com/remy/nodemon/issues/1176

Node service init.d creator: https://www.npmjs.com/package/node-service-linux

PM2, could run a script that runs nodemon: http://pm2.keymetrics.io/docs/usage/quick-start/

Could shorten this: https://github.com/chovy/node-startup/blob/master/init.d/node-app

ghost commented 6 years ago

Alrighty then. Pi is stuck with systemd, but any number of other systems might use init scripts, and the pi systemd scripts basically all call init scripts because #bandaidislife, so we're doing both.

Note to self after hours of systemd research and some good beer: This is a great bare-bones systemd guide http://nodesource.com/blog/running-your-node-js-app-with-systemd-part-1/

ghost commented 6 years ago

This allows a much easier time of ensuring #38 while we're at it

ghost commented 6 years ago

Nodemon is not the right tool here. Stripped it as a dependency, will add it later as a dev-dependency.

This is officially fixed, and works for old versions of systemd. That system has been around forever, and I won't support any non-linux setup with this thing (though node does a good job of covering many bases) - so we're done here.