diff --git a/Makefile b/Makefile index 99900e310..3038e929c 100644 --- a/Makefile +++ b/Makefile @@ -105,15 +105,17 @@ install: install-services: install mkdir -p /usr/local/lib/systemd/system + mkdir -p /var/log/lotus install -C -m 0644 ./scripts/lotus-daemon.service /usr/local/lib/systemd/system/lotus-daemon.service install -C -m 0644 ./scripts/lotus-miner.service /usr/local/lib/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." + @echo "lotus-daemon and lotus-miner services installed. Don't forget to 'systemctl enable lotus-daemon|lotus-miner' for it to be enabled on startup." clean-services: rm -f /usr/local/lib/systemd/system/lotus-daemon.service rm -f /usr/local/lib/systemd/system/lotus-miner.service + rm -f /usr/local/lib/systemd/system/chainwatch.service systemctl daemon-reload # TOOLS @@ -160,6 +162,13 @@ chainwatch: .PHONY: chainwatch BINS+=chainwatch +install-chainwatch-service: chainwatch + install -C ./chainwatch /usr/local/bin/chainwatch + install -C -m 0644 ./scripts/chainwatch.service /usr/local/lib/systemd/system/chainwatch.service + systemctl daemon-reload + @echo + @echo "chainwatch installed. Don't forget to 'systemctl enable chainwatch' for it to be enabled on startup." + bench: rm -f bench go build -o bench ./cmd/lotus-bench diff --git a/scripts/chainwatch.service b/scripts/chainwatch.service new file mode 100644 index 000000000..74afee0e9 --- /dev/null +++ b/scripts/chainwatch.service @@ -0,0 +1,15 @@ +[Unit] +Description=Chainwatch +After=lotus-daemon.service +Requires=lotus-daemon.service + +[Service] +Environment=GOLOG_FILE="/var/log/lotus/chainwatch.log" +Environment=GOLOG_LOG_FMT="json" +Environment=LOTUS_DB="" +Environment=LOTUS_PATH="%h/.lotus" +EnvironmentFile=-/etc/lotus/chainwatch.env +ExecStart=/usr/local/bin/chainwatch run + +[Install] +WantedBy=multi-user.target diff --git a/scripts/lotus-daemon.service b/scripts/lotus-daemon.service index d65393bdb..997eab8cf 100644 --- a/scripts/lotus-daemon.service +++ b/scripts/lotus-daemon.service @@ -1,14 +1,14 @@ [Unit] Description=Lotus Daemon After=network-online.target -Wants=network-online.target +Requires=network-online.target [Service] -Environment=GOLOG_FILE="/var/log/lotus-daemon" +Environment=GOLOG_FILE="/var/log/lotus/daemon.log" Environment=GOLOG_LOG_FMT="json" ExecStart=/usr/local/bin/lotus daemon Restart=always -RestartSec=30 +RestartSec=10 MemoryAccounting=true MemoryHigh=8G diff --git a/scripts/lotus-miner.service b/scripts/lotus-miner.service index 7b866e043..3a460450f 100644 --- a/scripts/lotus-miner.service +++ b/scripts/lotus-miner.service @@ -2,10 +2,11 @@ Description=Lotus Storage Miner After=network.target After=lotus-daemon.service +Requires=lotus-daemon.service [Service] ExecStart=/usr/local/bin/lotus-storage-miner run -Environment=GOLOG_FILE="/var/log/lotus-miner" +Environment=GOLOG_FILE="/var/log/lotus/miner.log" Environment=GOLOG_LOG_FMT="json" [Install]