dcrpool icon indicating copy to clipboard operation
dcrpool copied to clipboard

Supply a example systemd file

Open githubsands opened this issue 4 years ago • 1 comments

Provide a dcrpool.service file

githubsands avatar Apr 23 '20 02:04 githubsands

I used the following as a guide to craft up my systemd files. YMMV. I have dcrpool running from a non-privileged account and systemd will still start it up and use an iptables rule to forward port 443 to 8080 (default). These configs are part of my test pool so I will be making these better as time allows. But for now this appears to work. Note: I added the output redirection config as all these services still dump messages to stdout for some reason. I don't know why as I assumed systemd would have redirected all the output.

I created one file for each service (dcrwallet, dcrd, dcrpool). Just note that dcrd and dcrwallet don't use homedir switch and instead use appdata switch. I also moved the dcr binaries to /usr/local/bin directory.

/etc/systemd/system/dcrwallet.service /etc/systemd/system/dcrd.service /etc/systemd/system/dcrpool.service

Iptables setup

eth0 may not be present on your system.

iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 443 -j REDIRECT --to-port 8080
iptables-save > /etc/network/iptables.up.rules
iptables-apply

Enabled the services

systemctl enable dcrwallet.service systemctl enable dcrd.service systemctl enable dcrpool.service

Started the services

systemctl start dcrwallet.service systemctl start dcrd.service systemctl start dcrpool.service

Example systemd file for dcrpool

[Unit]
Description=DCR mining pool web ui and stratum
After=network.target dcrpool.service

[Service]
Type=simple
User=decred
WorkingDirectory=/home/decred
ExecStart=/usr/local/bin/dcrpool --homedir=/home/decred/.dcrpool --configfile=/home/decred/.dcrpool/dcrpool.conf
Restart=on-failure
StandardOutput=file:/var/log/decred/dcrpool.log
StandardError=inherit
# Other restart options: always, on-abort, etc

# The install section is needed to use
# `systemctl enable` to start on boot
# For a user service that you want to enable
# and start automatically, use `default.target`
# For system level services, use `multi-user.target`
[Install]
WantedBy=multi-user.target

logicminds avatar Feb 14 '21 05:02 logicminds