-
Notifications
You must be signed in to change notification settings - Fork 20
Create Monkshu Service on Linux CentOS Ubuntu
-
If needed, permit node to bind to lower ports using this command -
sudo setcap 'cap_net_bind_service=+ep' `which node`
. Monkshu runs as a regular OS process, not a privileged process and never as root. -
Download crashguard using
git clone https://github.com/TekMonksGitHub/crashguard.git
-
Copy
[monkshu_path]/crashguard.process.json
to[crashguard_path]/conf/process.json
. E.g.cp ~myapp/monkshu/crashguard.process.json ~myapp/crashguard/conf/process.json
. -
Edit the file
[crashguard_path]/conf/process.json
and fix the paths inside the file to match your setup. -
Test the configuration works by running crashguard, e.g. -
node ~/crashguard/crashguard.js
. If this works both the backend and frontend servers should be started and the console will display the appropriate messages. -
If the test above works, kill crashguard using Ctrl+C or the kill command. We will now setup crashguard to start as a system service.
-
Copy the file
[monkshu_path]/monkshu.service
to/usr/lib/systemd/system
. E.g.cp ~myapp/monkshu/monkshu.service /usr/lib/systemd/system
. -
Edit this file using this command
vi /usr/lib/systemd/system/monkshu.service
and fix these lines to match the Monkshu user and path on your system
User=monkshu
ExecStart=/usr/bin/env node /home/monkshu/crashguard/crashguard.js
-
Enable the service using
systemctl enable monkshu
. -
Start the service using
systemctl start monkshu
. -
Run this command to ensure Monkshu is running cleanly -
systemctl status monkshu
. The output should showactive (running)
as below.
monkshu.service - Monkshu service
Loaded: loaded (/lib/systemd/system/monkshu.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2021-02-10 05:04:19 UTC; 6s ago
Main PID: 29309 (node)
Tasks: 31 (limit: 1137)
Memory: 26.9M
CGroup: /system.slice/monkshu.service
├─29309 node /home/myapp/crashguard/crashguard.js
├─29326 /bin/bash /home/myapp/monkshu/frontend/server/server.sh
├─29327 /bin/bash /home/myapp/monkshu/backend/server/server.sh
├─29332 node /home/myapp/monkshu/frontend/server/server.js
└─29333 node /home/myapp/monkshu/backend/server/server.js
Feb 10 05:04:19 myapp systemd[1]: Started Monkshu service.
Feb 10 05:04:19 myapp env[29309]: / /
Feb 10 05:04:19 myapp env[29309]: Starting...
Feb 10 05:04:19 myapp env[29309]: Initializing the logs.
Feb 10 05:04:19 myapp env[29309]: Starting...
Feb 10 05:04:19 myapp env[29309]: Initializing the logs.
Feb 10 05:04:19 myapp env[29309]: Server started on 0.0.0.0:443
Feb 10 05:04:19 myapp env[29309]: Server started on 0.0.0.0:9090