-
Notifications
You must be signed in to change notification settings - Fork 0
/
backend.service
35 lines (24 loc) · 1.14 KB
/
backend.service
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Create this file in this /etc/systemd/system directory.
[Unit]
Description=Discord Daemon
[Service]
ExecStart=/home/azureuser/discord/backend/dist/server.js # Absolute path for the executable file.
Restart=always
User=nobody
Group=nogroup # 'nobody' -> for fedora.
Environment=PATH=/usr/bin:/usr/local/bin # Note: Path for nodejs.
Environment=NODE_ENV=production # Remark: Setting env directly.
WorkingDirectory=/home/azureuser/discord/backend/dist/ # Note: Absolute path for application directory.
[Install]
WantedBy=multi-user.target
# Remark: Add this at the top of this /home/azureuser/discord/backend/dist/server.js file.
#!/usr/bin/env node
# After that make this /home/azureuser/discord/backend/dist/server.js file executable.
# Also needs to provide additional permissions to the parent directory/adding root/current user to the server.js's group in some cases.
# sudo systemctl daemon-reload
# sudo systemctl start discord
# journalctl -u discord # Show logs of discord service.
# systemctl enable discord # Run discord service on startup
# journalctl -u discord -n1 -o json-pretty
# journalctl -u discord -fn10
# journalctl -u discord -rn10