-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathpending-dns.service
85 lines (63 loc) · 2.93 KB
/
pending-dns.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# Example systemd unit file for PendingDNS
# Requires Node.js and Redis
# Installation instructions for Node.js:
# https://nodejs.org/en/download/package-manager/
# Install Redis on Ubuntu:
# https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-redis-on-ubuntu-18-04
# Copy this file to /etc/systemd/system/pending-dns.service
# Once set up (or service file is modified) run as root:
# systemctl daemon-reload
# systemctl enable pending-dns
# systemctl restart pending-dns
[Unit]
Description=PendingDNS
# In some platforms redis could be installed as redis-server.service
# So make sure the service name listed here is valid
After=redis.service
# If redis is not installed into local machine
#After=network.target
[Service]
Environment="NODE_ENV=production"
# --- Configuration ---
# Optional. Use a system specific configuration file outside of the PendingDNS folder.
# Configuration settings from this file are merged with default settings (docs: https://www.npmjs.com/package/wild-config)
Environment="NODE_CONFIG_PATH=/etc/pending-dns.toml"
# --- Application ---
# This is the folder where PendingDNS files reside.
# Normally this folder would include a clean copy from the PendingDNS Github repository + `npm install --production`.
# To set up:
# git clone git://github.com/postalsys/pending-dns.git
# cd pending-dns
# npm install --production
# If PendingDNS files are cloned from Github then an easy way to upgrade the application would look like this:
# git pull origin master
# npm install --production
# And then (as root or a user with sudo privileges):
# sudo systemctl restart pending-dns
WorkingDirectory=/opt/pending-dns/
# --- Service user ---
# PendingDNS requires root access to bind to privileged ports (80, 53 443)
# Make sure this user has read access to application files and, if using
# config file at $NODE_CONFIG_PATH, then to this file as well.
# You can use config values "process.user" and "process.group" to make PendingDNS
# to downgrade user from root to something unprivileged once ports have been bound
User=root
Group=root
# If you want to use a non-root user then enable the following line which allows
# privileged ports for Node. You can also run this command just once manually but as
# it is binary specific, when Node is upgraded this commands needs to be ran again.
# Keeping it in the service file ensures that the setting is always enabled.
# 1) Enabling this setting allows *every* node script to bind to these ports, not just PendingDNS
# 2) Verify the paths for setcap and node, these might be different depending on the OS distribution
#ExecStartPre=+/usr/sbin/setcap 'cap_net_bind_service=+ep' /usr/bin/node
# --- Execution ---
# npm location is dependent on platform.
# Use `which npm` to resolve actual path.
ExecStart=/usr/bin/npm start
Type=simple
Restart=always
RestartSec=5
# --- Logging ---
SyslogIdentifier=pending-dns
[Install]
WantedBy=multi-user.target