Build exe too. Update docs.

This commit is contained in:
David Newhall II 2019-06-21 02:37:25 -07:00
parent 64d0085ef2
commit 756dbf3574
3 changed files with 22 additions and 16 deletions

View File

@ -19,10 +19,10 @@ As long as this document is kept up to date, this is what the travis file does:
- Tests that the Docker container ran and produced expected output.
- Makes a release. `make release`: This does a lot of things, controlled by the [Makefile](Makefile).
- Runs go tests and go linters.
- Compiles the application binaries for Linux and macOS.
- Compiles the application binaries for Windows, Linux and macOS.
- Compiles a man page that goes into the packages.
- Creates rpm and deb packages using fpm.
- Puts the packages, gzipped binaries and a file containing the SHA256s of each asset into a release folder.
- Puts the packages, gzipped binaries and files containing the SHA256s of each asset into a release folder.
After the release is built and Docker image tested:
- Deploys the release assets to the tagged release on GitHub using an encrypted GitHub Token (api key).

View File

@ -20,15 +20,14 @@ RPMVERSION:=$(shell echo $(VERSION) | tr -- - _)
all: man build
# Prepare a release. Called in Travis CI.
release: clean test $(BINARY)-$(RPMVERSION)-$(ITERATION).x86_64.rpm $(BINARY)_$(VERSION)-$(ITERATION)_amd64.deb macos
release: clean test macos windows $(BINARY)-$(RPMVERSION)-$(ITERATION).x86_64.rpm $(BINARY)_$(VERSION)-$(ITERATION)_amd64.deb
# Prepareing a release!
mkdir -p release
gzip -9 $(BINARY).linux
gzip -9 $(BINARY).macos
mv $(BINARY)-$(RPMVERSION)-$(ITERATION).x86_64.rpm $(BINARY)_$(VERSION)-$(ITERATION)_amd64.deb \
$(BINARY).macos.gz $(BINARY).linux.gz release/
mv $(BINARY).linux $(BINARY).macos $(BINARY).exe release/
gzip -9r release/
mv $(BINARY)-$(RPMVERSION)-$(ITERATION).x86_64.rpm $(BINARY)_$(VERSION)-$(ITERATION)_amd64.deb release/
# Generating File Hashes
openssl dgst -sha256 release/* | tee release/$(BINARY)_checksums_$(VERSION)-$(ITERATION).txt
for i in release/*; do (openssl dgst -r -sha256 "$$i" | head -c64 ; echo) | tee "$$i.sha256.txt"; done
# Delete all build assets.
clean:
@ -74,6 +73,12 @@ $(BINARY).macos:
# Building darwin binary.
GOOS=darwin go build -o $(BINARY).macos -ldflags "-w -s -X github.com/davidnewhall/unifi-poller/pkg/unifi-poller.Version=$(VERSION)" $(PACKAGE)
exe: $(BINARY).exe
windows: $(BINARY).exe
$(BINARY).exe:
# Building darwin binary.
GOOS=windows go build -o $(BINARY).exe -ldflags "-w -s -X github.com/davidnewhall/unifi-poller/pkg/unifi-poller.Version=$(VERSION)" $(PACKAGE)
# Packages
rpm: clean $(BINARY)-$(RPMVERSION)-$(ITERATION).x86_64.rpm

View File

@ -13,10 +13,10 @@ device configuration. This controller can be installed on Windows, macOS and Lin
Ubiquiti also provides a dedicated hardware device called a
[CloudKey](https://www.ui.com/unifi/unifi-cloud-key/) that runs the controller software.
Unifi-Poller is a small application that runs on macOS, Linux or Docker. It
polls your controller every 30 seconds for metric data and stores that data in
Unifi-Poller is a small application that runs on Windows, macOS, Linux or Docker.
It polls your controller every 30 seconds for measurements and stores the data in
an Influx Database. A small setup with 2 APs, 1 switch, 1 gateway and 40 clients
produces nearly 3000 fields (metrics).
produces over 3000 fields (metrics).
This application requires your controller to be running all the time. If you run
a Unifi Controller, there's no excuse not to install
@ -76,15 +76,16 @@ I'm totally open to add more configuration options if someone raises a need or c
You can control this app with puppet, chef, saltstack, homebrew or a simple bash
script if you needed to. It's available for macOS, Linux and Docker. It comes with
a systemd service unit that allows you automatically start it up on most Linux
hosts. It probably works just fine on Windows too;
[let me know eh](https://github.com/davidnewhall/unifi-poller/wiki/Windows)?
hosts. It works just fine on [Windows](https://github.com/davidnewhall/unifi-poller/wiki/Windows) too.
The unifi data extraction is provided as an [external library](https://github.com/golift/unifi),
The unifi data extraction is provided as an [external library](https://godoc.org/github.com/golift/unifi),
and you can import that code directly without futzing with this application. That
means, if you wanted to do something like make telegraf collect your data instead
of unifi-poller you can achieve that with a little bit of Go code. You could write
a small app that acts as a telegraf input plugin using the available
[unifi](https://github.com/golift/unifi) library to grab the data from your controller.
a small app that acts as a telegraf input plugin using the [unifi](https://github.com/golift/unifi)
library to grab the data from your controller. As a bonus, all of the code in unifi-poller is
[also a library](https://godoc.org/github.com/davidnewhall/unifi-poller/pkg/unifi-poller)
and can be used in other projects.
# What now...