Created
July 8, 2025 19:40
-
-
Save wileyj/d7ff4e0dc7f335839a89c823a79d66dd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Modeled after https://github.com/bitcoin/bitcoin/blob/master/contrib/init/bitcoind.service | |
[Unit] | |
Description=Stacks Blockchain | |
# https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget/ | |
After=network-online.target | |
After=bitcoin.service | |
After=signer.service | |
Wants=network-online.target | |
ConditionFileIsExecutable=/usr/local/bin/stacks-node | |
ConditionPathExists=/stacks-blockchain/conf/mainnet/follower.toml | |
ConditionPathIsDirectory=/stacks-blockchain | |
[Service] | |
ExecStart=/usr/local/bin/stacks-node start --config /stacks-blockchain/conf/mainnet/follower.toml | |
# Make sure the config directory is readable by the service user | |
PermissionsStartOnly=true | |
ExecStartPre=/bin/chgrp stacks /stacks-blockchain/conf/mainnet | |
# Process management | |
#################### | |
PIDFile=/run/stacks-blockchain/stacks-blockchain.pid | |
Restart=no | |
TimeoutStopSec=900 | |
KillSignal=SIGINT | |
SendSIGKILL=no | |
# Directory creation and permissions | |
#################################### | |
# Run as SERVICE_USER:SERVICE_USER | |
User=stacks | |
Group=stacks | |
# /run/stacks-blockchain | |
RuntimeDirectory=stacks-blockchain | |
RuntimeDirectoryMode=0710 | |
# /etc/stacks-blockchain | |
ConfigurationDirectory=stacks-blockchain | |
ConfigurationDirectoryMode=0710 | |
# Hardening measures | |
#################### | |
# Provide a private /tmp and /var/tmp. | |
PrivateTmp=true | |
# Mount /usr, /boot/ and /etc read-only for the process. | |
ProtectSystem=full | |
# Deny access to /home, /root and /run/user | |
ProtectHome=true | |
# Disallow the process and all of its children to gain | |
# new privileges through execve(). | |
NoNewPrivileges=true | |
# Use a new /dev namespace only populated with API pseudo devices | |
# such as /dev/null, /dev/zero and /dev/random. | |
PrivateDevices=true | |
# Deny the creation of writable and executable memory mappings. | |
MemoryDenyWriteExecute=true | |
SystemCallArchitectures=native | |
[Install] | |
WantedBy=multi-user.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment