Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supply a example systemd file #203

Open
githubsands opened this issue Apr 23, 2020 · 1 comment
Open

Supply a example systemd file #203

githubsands opened this issue Apr 23, 2020 · 1 comment

Comments

@githubsands
Copy link
Contributor

Provide a dcrpool.service file

@logicminds
Copy link

logicminds commented Feb 14, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants