update systemd services; include make directives and docs for use

This commit is contained in:
Mike Greenberg 2020-05-27 17:12:45 -04:00
parent 75041b96e4
commit 78e0c96f22
3 changed files with 45 additions and 0 deletions

View File

@ -103,6 +103,18 @@ install:
install -C ./lotus-storage-miner /usr/local/bin/lotus-storage-miner install -C ./lotus-storage-miner /usr/local/bin/lotus-storage-miner
install -C ./lotus-seal-worker /usr/local/bin/lotus-seal-worker install -C ./lotus-seal-worker /usr/local/bin/lotus-seal-worker
install-services:
install -C -m 0644 ./scripts/lotus-daemon.service /etc/systemd/system/lotus-daemon.service
install -C -m 0644 ./scripts/lotus-miner.service /etc/systemd/system/lotus-miner.service
systemctl daemon-reload
@echo
@echo "lotus and lotus-miner services installed. Don't forget to 'systemctl enable lotus|lotus-miner' for it to be enabled on startup."
clean-services:
rm -f /etc/systemd/system/lotus-daemon.service
rm -f /etc/systemd/system/lotus-miner.service
systemctl daemon-reload
# TOOLS # TOOLS
lotus-seed: $(BUILD_DEPS) lotus-seed: $(BUILD_DEPS)

View File

@ -0,0 +1,29 @@
# Lotus and Miner as a systemd service
Lotus is capable of running as a systemd service daemon. You can find installable service files for systemd in the [lotus repo](https://github.com/filecoin-project/lotus/tree/master/scripts) as files with `.service` extension. In order to install these service files, you can copy these `.service` files to the default systemd service path.
## Installing via `make`
NOTE: Before using lotus and lotus-miner as systemd services, don't forget to `sudo make install` to ensure the binaries are accessible by the root user.
If your host uses the default systemd service path, it can be installed with `sudo make install-services`:
```sh
$ sudo make install-services
```
## Interacting with service logs
Logs from the services can be reviewed using `journalctl`.
### Follow logs from a specific service unit
```sh
$ sudo journalctl -u lotus-daemon -f
```
### View logs in reverse order
```sh
$ sudo journalctl -u lotus-miner -r
```

View File

@ -6,6 +6,10 @@ After=network.target
ExecStart=/usr/local/bin/lotus daemon ExecStart=/usr/local/bin/lotus daemon
Environment=GOLOG_FILE="/var/log/lotus-daemon" Environment=GOLOG_FILE="/var/log/lotus-daemon"
Environment=GOLOG_LOG_FMT="json" Environment=GOLOG_LOG_FMT="json"
MemoryAccounting=true
MemoryHigh=8G
MemoryMax=10G
LimitNOFILE=8192:10240
[Install] [Install]
WantedBy=multiuser.target WantedBy=multiuser.target