diff --git a/README.md b/README.md index dfb41bb..427c240 100644 --- a/README.md +++ b/README.md @@ -37,13 +37,13 @@ Pre-built binaries are provided for all [releases]: It's also possible to produce custom builds directly using [Go][golang] or [GoReleaser][goreleaser]. -With [Go 1.16][go1.16] or later the following command installs `luxws-exporter` +With Go 1.16 or later the following command installs `luxws-exporter` system-wide into `/usr/local/bin/`: - sudo GOBIN=/usr/local/bin/ go install github.com/hansmi/wp2reg-luxws/luxws-exporter@main + go build -o luxws-exporter/luxws-exporter ./luxws-exporter && \ + sudo install -t /usr/local/bin -m 0755 luxws-exporter/luxws-exporter [golang]: https://golang.org/ -[go1.16]: https://github.com/golang/go/wiki/Modules#go-116 [goreleaser]: https://goreleaser.com/ [releases]: https://github.com/hansmi/wp2reg-luxws/releases/latest [websocket]: https://en.wikipedia.org/wiki/WebSocket diff --git a/contrib/systemd/wp2reg-luxws-exporter.default b/contrib/systemd/wp2reg-luxws-exporter.default new file mode 100644 index 0000000..17ad43d --- /dev/null +++ b/contrib/systemd/wp2reg-luxws-exporter.default @@ -0,0 +1,3 @@ +# Place this file into /etc/default/wp2reg-luxws-exporter and set the flags +# according to your environment. +WP2REG_LUXWS_EXPORTER_ARGS='--controller.address=192.168.0.1:8214 --controller.address.http=192.168.0.1:80 --controller.language=en --web.listen-address=localhost:9101' diff --git a/wp2reg-luxws-exporter.service b/contrib/systemd/wp2reg-luxws-exporter.service similarity index 72% rename from wp2reg-luxws-exporter.service rename to contrib/systemd/wp2reg-luxws-exporter.service index dcef4c5..52ab63a 100644 --- a/wp2reg-luxws-exporter.service +++ b/contrib/systemd/wp2reg-luxws-exporter.service @@ -6,15 +6,12 @@ Description=Prometheus exporter for working with heat pump controllers from Alph ; Start after the network has been configured After=network-online.target Wants=network-online.target -StartLimitInterval=200 -StartLimitBurst=5 [Service] +EnvironmentFile=-/etc/default/wp2reg-luxws-exporter Type=simple -; ===> Set the path and flags according to your environment. <================ -ExecStart=/usr/local/sbin/luxws-exporter --controller.address=192.168.0.1:8214 --controller.address.http=192.168.0.1:80 --controller.language=cz --web.listen-address=localhost:9101 +ExecStart=/usr/local/sbin/luxws-exporter $WP2REG_LUXWS_EXPORTER_ARGS Restart=always -RestartSec=30 ; The fields below are optional, but strongly recommended: The service is put ; into an empty runtime directory chroot, i.e. the runtime directory which ; usually resides under /run. See also https://unix.stackexchange.com/q/635027/22339