The elves did a little winter cleaning! They are making room for all the features and bug fixes coming soon, I can almost hear the jolly old ho ho ho!
This commit is contained in:
parent
eb3653a178
commit
9ffa6e3af9
Binary file not shown.
143
.travis.yml-bak
143
.travis.yml-bak
|
|
@ -1,143 +0,0 @@
|
||||||
# Powered by Application Builder: https://github.com/golift/application-builder
|
|
||||||
jobs:
|
|
||||||
include:
|
|
||||||
- os: osx
|
|
||||||
osx_image: xcode12
|
|
||||||
language: go
|
|
||||||
go: 1.19.x
|
|
||||||
- os: linux
|
|
||||||
dist: focal
|
|
||||||
services: docker
|
|
||||||
language: go
|
|
||||||
go: 1.19.x
|
|
||||||
git:
|
|
||||||
depth: false
|
|
||||||
addons:
|
|
||||||
homebrew:
|
|
||||||
packages:
|
|
||||||
- upx
|
|
||||||
apt:
|
|
||||||
packages:
|
|
||||||
- ruby-dev
|
|
||||||
- rpm
|
|
||||||
- build-essential
|
|
||||||
- git
|
|
||||||
- libgnome-keyring-dev
|
|
||||||
- fakeroot
|
|
||||||
- zip
|
|
||||||
- debsigs
|
|
||||||
- gnupg
|
|
||||||
- upx
|
|
||||||
install:
|
|
||||||
- mkdir -p $(go env GOPATH)/bin
|
|
||||||
- curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin latest
|
|
||||||
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then rvm install 2.6.0; fi
|
|
||||||
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then rvm 2.6.0 do gem install --no-document fpm -v 1.11.0; fi
|
|
||||||
before_script:
|
|
||||||
# Create your own deploy key, tar it, and encrypt the file to make this work. Optionally add a bitly_token file to the archive.
|
|
||||||
- openssl aes-256-cbc -K $encrypted_772fc4772f04_key -iv $encrypted_772fc4772f04_iv -in .secret_files.tar.enc -out .secret_files.tar -d
|
|
||||||
- tar -xf .secret_files.tar
|
|
||||||
- gpg --import gpg.signing.key
|
|
||||||
- rm -f gpg.signing.key .secret_files.tar
|
|
||||||
- source settings.sh
|
|
||||||
script:
|
|
||||||
# Test Go.
|
|
||||||
- make test
|
|
||||||
# Test Docker.
|
|
||||||
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then make docker; fi
|
|
||||||
# Test built docker image.
|
|
||||||
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then docker run $BINARY -v 2>&1 | grep -Eq "^$BINARY,? v.*$VERSION"; fi
|
|
||||||
# Build everything
|
|
||||||
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then rvm 2.6.0 do make release; fi
|
|
||||||
# Build mac binary or image.
|
|
||||||
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then make dmg; fi
|
|
||||||
# Test homebrew (with make install).
|
|
||||||
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then make install VERSION=$VERSION ITERATION=$ITERATION PREFIX=/tmp/ab-$VERSION ETC=/tmp/ab-$VERSION/etc; fi
|
|
||||||
after_success:
|
|
||||||
# Display Release Folder
|
|
||||||
- ls -l release/
|
|
||||||
# Setup the ssh client so we can clone and push to the homebrew formula repo.
|
|
||||||
# You must put github_deploy_file into .secret_files.tar.enc
|
|
||||||
# This is an ssh key added to your homebrew forumla repo.
|
|
||||||
- |
|
|
||||||
mkdir -p $HOME/.ssh
|
|
||||||
declare -r SSH_FILE="$(mktemp -u $HOME/.ssh/XXXXX)"
|
|
||||||
echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> $HOME/.ssh/config
|
|
||||||
[ ! -f github_deploy_key ] || (mv github_deploy_key $SSH_FILE \
|
|
||||||
&& chmod 600 "$SSH_FILE" \
|
|
||||||
&& printf "%s\n" \
|
|
||||||
"Host github.com" \
|
|
||||||
" IdentityFile $SSH_FILE" \
|
|
||||||
" StrictHostKeyChecking no" \
|
|
||||||
" LogLevel ERROR" >> $HOME/.ssh/config)
|
|
||||||
deploy:
|
|
||||||
# Unstable (master pushes).
|
|
||||||
- provider: packagecloud
|
|
||||||
repository: unstable
|
|
||||||
username: golift
|
|
||||||
token:
|
|
||||||
secure: 1vzsIxgcDkMkkmxpvaw3vEMt4cbDNpk3UMeiv5qnHJ9/k0D6+VhNVS0I3QLgP5+WQgH11Y0YX00NvcY13M+hSj6vLhPCBroFisXJyDpg/f/bxyHxILFeO6AY/CSFbdLzyLcjJo5SC7JedEhqd4xeqjEo14FxGrzKB7guOBCdOQPtaFxfimm02vNt34LoLGYOfZMek2vt50qAR8ChvX2fG/gGxfAlQ4AYvppJLwfPs4jwMN1rrndDI1EUgy3ZMafM40KguXD2wGkctLmyoelTEX2TEDa8TBZKot3lRmK1vyI3wCzNY/Jb5chGq9J5zWFpPlSvn+NPeqj+8UGCZ+bCb0unFH5OdOEKTmQ46cYgL6d3RRbpwoxbG/twg/bAfJ0iiSNTJfXjXDLKT9j+YyeCerbnh7rT/qCuwO+W/HIsnu0waCXvXGAKXGAAE+xvnBygp/YS6I4Y26V2CBIF8KJEWIF/CuooHzraa5c1hg50h5YZnZ9EwVXxFRdsFSNxle9uNe2iJ08FEV6VyHPybYsOnA37yM7E8wCLbcKRKavAyVT7OykLU2GAAOCdcN8tpSDA/kwKx3imZhyjGGUrYQxVN/bCb4hhBX+OymcVIw2gQFkJ/sc09ck+Vo77FVR6JVi0tCjan7x4oCTQfbEa5lkioMjKgY6JDfRVZdX6HUjlJTw=
|
|
||||||
dist: ubuntu/focal
|
|
||||||
local-dir: release
|
|
||||||
package_glob: "*.deb"
|
|
||||||
skip_cleanup: true
|
|
||||||
cleanup: false
|
|
||||||
on:
|
|
||||||
branch: unstable
|
|
||||||
condition: "$TRAVIS_OS_NAME = linux"
|
|
||||||
- provider: packagecloud
|
|
||||||
repository: unstable
|
|
||||||
username: golift
|
|
||||||
token:
|
|
||||||
secure: 1vzsIxgcDkMkkmxpvaw3vEMt4cbDNpk3UMeiv5qnHJ9/k0D6+VhNVS0I3QLgP5+WQgH11Y0YX00NvcY13M+hSj6vLhPCBroFisXJyDpg/f/bxyHxILFeO6AY/CSFbdLzyLcjJo5SC7JedEhqd4xeqjEo14FxGrzKB7guOBCdOQPtaFxfimm02vNt34LoLGYOfZMek2vt50qAR8ChvX2fG/gGxfAlQ4AYvppJLwfPs4jwMN1rrndDI1EUgy3ZMafM40KguXD2wGkctLmyoelTEX2TEDa8TBZKot3lRmK1vyI3wCzNY/Jb5chGq9J5zWFpPlSvn+NPeqj+8UGCZ+bCb0unFH5OdOEKTmQ46cYgL6d3RRbpwoxbG/twg/bAfJ0iiSNTJfXjXDLKT9j+YyeCerbnh7rT/qCuwO+W/HIsnu0waCXvXGAKXGAAE+xvnBygp/YS6I4Y26V2CBIF8KJEWIF/CuooHzraa5c1hg50h5YZnZ9EwVXxFRdsFSNxle9uNe2iJ08FEV6VyHPybYsOnA37yM7E8wCLbcKRKavAyVT7OykLU2GAAOCdcN8tpSDA/kwKx3imZhyjGGUrYQxVN/bCb4hhBX+OymcVIw2gQFkJ/sc09ck+Vo77FVR6JVi0tCjan7x4oCTQfbEa5lkioMjKgY6JDfRVZdX6HUjlJTw=
|
|
||||||
dist: el/6
|
|
||||||
local-dir: release
|
|
||||||
package_glob: "*.rpm"
|
|
||||||
skip_cleanup: true
|
|
||||||
cleanup: false
|
|
||||||
on:
|
|
||||||
branch: unstable
|
|
||||||
condition: "$TRAVIS_OS_NAME = linux"
|
|
||||||
# Stable packages (releases).
|
|
||||||
- provider: packagecloud
|
|
||||||
repository: pkgs
|
|
||||||
username: golift
|
|
||||||
token:
|
|
||||||
secure: 1vzsIxgcDkMkkmxpvaw3vEMt4cbDNpk3UMeiv5qnHJ9/k0D6+VhNVS0I3QLgP5+WQgH11Y0YX00NvcY13M+hSj6vLhPCBroFisXJyDpg/f/bxyHxILFeO6AY/CSFbdLzyLcjJo5SC7JedEhqd4xeqjEo14FxGrzKB7guOBCdOQPtaFxfimm02vNt34LoLGYOfZMek2vt50qAR8ChvX2fG/gGxfAlQ4AYvppJLwfPs4jwMN1rrndDI1EUgy3ZMafM40KguXD2wGkctLmyoelTEX2TEDa8TBZKot3lRmK1vyI3wCzNY/Jb5chGq9J5zWFpPlSvn+NPeqj+8UGCZ+bCb0unFH5OdOEKTmQ46cYgL6d3RRbpwoxbG/twg/bAfJ0iiSNTJfXjXDLKT9j+YyeCerbnh7rT/qCuwO+W/HIsnu0waCXvXGAKXGAAE+xvnBygp/YS6I4Y26V2CBIF8KJEWIF/CuooHzraa5c1hg50h5YZnZ9EwVXxFRdsFSNxle9uNe2iJ08FEV6VyHPybYsOnA37yM7E8wCLbcKRKavAyVT7OykLU2GAAOCdcN8tpSDA/kwKx3imZhyjGGUrYQxVN/bCb4hhBX+OymcVIw2gQFkJ/sc09ck+Vo77FVR6JVi0tCjan7x4oCTQfbEa5lkioMjKgY6JDfRVZdX6HUjlJTw=
|
|
||||||
dist: ubuntu/focal
|
|
||||||
local-dir: release
|
|
||||||
package_glob: "*.deb"
|
|
||||||
skip_cleanup: true
|
|
||||||
cleanup: false
|
|
||||||
on:
|
|
||||||
tags: true
|
|
||||||
condition: "$TRAVIS_OS_NAME = linux"
|
|
||||||
- provider: packagecloud
|
|
||||||
repository: pkgs
|
|
||||||
username: golift
|
|
||||||
token:
|
|
||||||
secure: 1vzsIxgcDkMkkmxpvaw3vEMt4cbDNpk3UMeiv5qnHJ9/k0D6+VhNVS0I3QLgP5+WQgH11Y0YX00NvcY13M+hSj6vLhPCBroFisXJyDpg/f/bxyHxILFeO6AY/CSFbdLzyLcjJo5SC7JedEhqd4xeqjEo14FxGrzKB7guOBCdOQPtaFxfimm02vNt34LoLGYOfZMek2vt50qAR8ChvX2fG/gGxfAlQ4AYvppJLwfPs4jwMN1rrndDI1EUgy3ZMafM40KguXD2wGkctLmyoelTEX2TEDa8TBZKot3lRmK1vyI3wCzNY/Jb5chGq9J5zWFpPlSvn+NPeqj+8UGCZ+bCb0unFH5OdOEKTmQ46cYgL6d3RRbpwoxbG/twg/bAfJ0iiSNTJfXjXDLKT9j+YyeCerbnh7rT/qCuwO+W/HIsnu0waCXvXGAKXGAAE+xvnBygp/YS6I4Y26V2CBIF8KJEWIF/CuooHzraa5c1hg50h5YZnZ9EwVXxFRdsFSNxle9uNe2iJ08FEV6VyHPybYsOnA37yM7E8wCLbcKRKavAyVT7OykLU2GAAOCdcN8tpSDA/kwKx3imZhyjGGUrYQxVN/bCb4hhBX+OymcVIw2gQFkJ/sc09ck+Vo77FVR6JVi0tCjan7x4oCTQfbEa5lkioMjKgY6JDfRVZdX6HUjlJTw=
|
|
||||||
dist: el/6
|
|
||||||
local-dir: release
|
|
||||||
package_glob: "*.rpm"
|
|
||||||
skip_cleanup: true
|
|
||||||
cleanup: false
|
|
||||||
on:
|
|
||||||
tags: true
|
|
||||||
condition: "$TRAVIS_OS_NAME = linux"
|
|
||||||
# Upload built files to github too.
|
|
||||||
- provider: releases
|
|
||||||
api_key:
|
|
||||||
secure: GsvW0m+EnRELQMk8DjH63VXinqbwse4FJ4vNUslOE6CZ8PBXPrH0ZgaI7ic/uxRtm7CYj0sir4CZq62W5l6uhoXCCQfjOnmJspqnQcrFZ1xRdWktsNXaRwM6hlzaUThsJ/1PD9Psc66uKXBYTg0IlUz0yjZAZk7tCUE4libuj41z40ZKxUcbfcNvH4Njc9IpNB4QSA3ss+a9/6ZwBz4tHVamsGIrzaE0Zf99ItNBYvaOwhM2rC/NWIsFmwt8w4rIA2NIrkZgMDV+Z2Niqh4JRLAWCQNx/RjC5U52lG2yhqivUC3TromZ+q4O4alUltsyIzF2nVanLWgJmbeFo8uXT5A+gd3ovSkFLU9medXd9i4kap7kN/o5m9p5QZvrdEYHEmIU4ml5rjT2EQQVy5CtSmpiRAbhpEJIvA1wDtRq8rdz8IVfJXkHNjg2XdouNmMMWqa3OkEPw21+uxsqv4LscW/6ZjsavzL5SSdnBRU9n79EfGJE/tJLKiNumah/vLuJ5buNhgqmCdtX/Tg+DhQS1BOyYg4l4L8s9IIKZgFRwrOPsZnA/KsrWg4ZsjJ87cqKCaT/qs2EJx5odZcZWJYLBngeO8Tc6cQtLgJdieY2oEKo51Agq4rgikZDt21m6TY9/R5lPN0piwdpy3ZGKfv1ijXx74raMT03qskputzMCvc=
|
|
||||||
overwrite: true
|
|
||||||
skip_cleanup: true
|
|
||||||
cleanup: false
|
|
||||||
file_glob: true
|
|
||||||
file: release/*
|
|
||||||
on:
|
|
||||||
tags: true
|
|
||||||
# Upload homebrew formula file to a special repo.
|
|
||||||
- provider: script
|
|
||||||
script: scripts/formula-deploy.sh
|
|
||||||
on:
|
|
||||||
tags: true
|
|
||||||
|
|
@ -6,50 +6,33 @@ Lets talk about how the software gets built for our users before we talk about
|
||||||
making changes to it.
|
making changes to it.
|
||||||
|
|
||||||
|
|
||||||
## TravisCI
|
## Github Actions
|
||||||
|
|
||||||
This repo is tested, built and deployed by [Travis-CI](https://travis-ci.org/unifi-poller/unifi-poller).
|
This repo is tested, built and deployed by [Github Actions](https://github.com/unpoller/unpoller/actions).
|
||||||
|
|
||||||
The [.travis.yml](.travis.yml) file in this repo coordinates the entire process.
|
The [.github/](.github/) directory in this repo coordinates the entire process.
|
||||||
As long as this document is kept up to date, this is what the travis file does:
|
As long as this document is kept up to date, this is what github does:
|
||||||
|
|
||||||
- Creates a go-capable build environment on a Linux host, some debian variant.
|
- Builds and Tests code changes
|
||||||
- Install ruby-devel to get rubygems.
|
- Lints code changes
|
||||||
- Installs other build tools including rpm and fpm from rubygems.
|
- On Release (through git tags) it uses goreleaser-pro to build and release:
|
||||||
- Starts docker, builds the docker container and runs it.
|
- Linux, Mac and Windows Binaries
|
||||||
- Tests that the Docker container ran and produced expected output.
|
- Provides a packaged source copy
|
||||||
- Makes a release. `make release`: This does a lot of things, controlled by the [Makefile](Makefile).
|
- Builds Debian, RedHat packages
|
||||||
- Runs go tests and go linters.
|
- Builds Mac universal binary
|
||||||
- Compiles the application binaries for Windows, Linux and macOS.
|
- Builds Windows executable
|
||||||
- Compiles a man page that goes into the packages.
|
- Builds numerous platform docker images and uploads them
|
||||||
- Creates rpm and deb packages using fpm.
|
|
||||||
- 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:
|
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).
|
- Deploys the release assets to the tagged release on [GitHub releases](https://github.com/unpoller/unpoller/releases)
|
||||||
- Runs [another script](scripts/formula-deploy.sh) to create and upload a Homebrew formula to [golift/homebrew-mugs](https://github.com/golift/homebrew-mugs).
|
|
||||||
- Uses an encrypted SSH key to upload the updated formula to the repo.
|
|
||||||
- Travis does nothing else with Docker; it just makes sure the thing compiles and runs.
|
|
||||||
|
|
||||||
### Homebrew
|
### Homebrew
|
||||||
|
|
||||||
it's a mac thing.
|
it's a mac thing. [Homebrew](https://brew.sh)
|
||||||
|
|
||||||
[Homebrew](https://brew.sh) is all I use at home. Please don't break the homebrew
|
|
||||||
formula stuff; it took a lot of pain to get it just right. I am very interested
|
|
||||||
in how it works for you.
|
|
||||||
|
|
||||||
### Docker
|
### Docker
|
||||||
|
|
||||||
Docker is built automatically by Docker Cloud using the Dockerfile in the path
|
Docker is built automatically and uploaded to ghcr.io by the release github action.
|
||||||
[init/docker/Dockerfile](init/docker/Dockerfile). Some of the configuration is
|
|
||||||
done in the Cloud service under my personal account `golift`, but the majority
|
|
||||||
happens in the build files in the [init/docker/hooks/](init/docker/hooks/) directory.
|
|
||||||
|
|
||||||
If you have need to change the Dockerfile, please clearly explain what problem your
|
|
||||||
changes are solving, and how it has been tested and validated. As far as I'm
|
|
||||||
concerned this file should never need to change again, but I'm not a Docker expert;
|
|
||||||
you're welcome to prove me wrong.
|
|
||||||
|
|
||||||
# Contributing
|
# Contributing
|
||||||
|
|
||||||
|
|
|
||||||
156
Makefile
156
Makefile
|
|
@ -11,15 +11,7 @@ MD2ROFF_BIN=github.com/davidnewhall/md2roff@v0.0.1
|
||||||
# rsrc adds an ico file to a Windows exe file.
|
# rsrc adds an ico file to a Windows exe file.
|
||||||
RSRC_BIN=github.com/akavel/rsrc
|
RSRC_BIN=github.com/akavel/rsrc
|
||||||
|
|
||||||
# If upx is available, use it to compress the binaries.
|
# CI passes the version in. Local builds get it from the current git tag.
|
||||||
UPXPATH=$(shell which upx)
|
|
||||||
|
|
||||||
# Skip upx in Mac ARM environments: https://github.com/upx/upx/issues/446
|
|
||||||
ifeq ($(shell uname -ps),Darwin arm)
|
|
||||||
UPXPATH=
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Travis CI passes the version in. Local builds get it from the current git tag.
|
|
||||||
ifeq ($(VERSION),)
|
ifeq ($(VERSION),)
|
||||||
include .metadata.make
|
include .metadata.make
|
||||||
else
|
else
|
||||||
|
|
@ -31,73 +23,9 @@ else
|
||||||
ITERATION:=$(_ITERATION)
|
ITERATION:=$(_ITERATION)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# rpm is wierd and changes - to _ in versions.
|
|
||||||
RPMVERSION:=$(shell echo $(VERSION) | tr -- - _)
|
|
||||||
# used for freebsd packages.
|
|
||||||
BINARYU:=$(shell echo $(BINARY) | tr -- - _)
|
|
||||||
|
|
||||||
PACKAGE_SCRIPTS=
|
|
||||||
ifeq ($(FORMULA),service)
|
|
||||||
PACKAGE_SCRIPTS=--after-install after-install-rendered.sh --before-remove before-remove-rendered.sh
|
|
||||||
endif
|
|
||||||
|
|
||||||
define PACKAGE_ARGS
|
|
||||||
$(PACKAGE_SCRIPTS) \
|
|
||||||
--name $(BINARY) \
|
|
||||||
--deb-no-default-config-files \
|
|
||||||
--rpm-os linux \
|
|
||||||
--iteration $(ITERATION) \
|
|
||||||
--license $(LICENSE) \
|
|
||||||
--url $(SOURCE_URL) \
|
|
||||||
--maintainer "$(MAINT)" \
|
|
||||||
--vendor "$(VENDOR)" \
|
|
||||||
--description "$(DESC)" \
|
|
||||||
--config-files "/etc/$(BINARY)/$(CONFIG_FILE)" \
|
|
||||||
--freebsd-origin "$(SOURCE_URL)"
|
|
||||||
endef
|
|
||||||
|
|
||||||
PLUGINS:=$(patsubst plugins/%/main.go,%,$(wildcard plugins/*/main.go))
|
|
||||||
|
|
||||||
VERSION_LDFLAGS:= -X \"$(VERSION_PATH).Branch=$(BRANCH) ($(COMMIT))\" \
|
|
||||||
-X \"$(VERSION_PATH).BuildDate=$(DATE)\" \
|
|
||||||
-X \"$(VERSION_PATH).BuildUser=$(shell whoami)\" \
|
|
||||||
-X \"$(VERSION_PATH).Revision=$(ITERATION)\" \
|
|
||||||
-X \"$(VERSION_PATH).Version=$(VERSION)\"
|
|
||||||
|
|
||||||
# Makefile targets follow.
|
# Makefile targets follow.
|
||||||
|
|
||||||
all: clean generate build
|
all: build
|
||||||
|
|
||||||
####################
|
|
||||||
##### Releases #####
|
|
||||||
####################
|
|
||||||
|
|
||||||
# Prepare a release. Called in Travis CI.
|
|
||||||
release: clean windows
|
|
||||||
# Prepareing a release!
|
|
||||||
mkdir -p $@
|
|
||||||
mv $(BINARY).*.linux $(BINARY).*.freebsd $@/
|
|
||||||
gzip -9r $@/
|
|
||||||
for i in $(BINARY)*.exe ; do zip -9qj $@/$$i.zip $$i examples/*.example *.html; rm -f $$i;done
|
|
||||||
mv *.rpm *.deb *.txz $@/
|
|
||||||
# Generating File Hashes
|
|
||||||
openssl dgst -r -sha256 $@/* | sed 's#release/##' | tee $@/checksums.sha256.txt
|
|
||||||
|
|
||||||
# DMG only makes a DMG file is MACAPP is set. Otherwise, it makes a gzipped binary for macOS.
|
|
||||||
dmg: clean macapp
|
|
||||||
mkdir -p release
|
|
||||||
[ "$(MACAPP)" = "" ] || hdiutil create release/$(MACAPP).dmg -srcfolder $(MACAPP).app -ov
|
|
||||||
[ "$(MACAPP)" != "" ] || mv $(BINARY).*.macos release/
|
|
||||||
[ "$(MACAPP)" != "" ] || gzip -9r release/
|
|
||||||
openssl dgst -r -sha256 release/* | sed 's#release/##' | tee release/macos_checksum.sha256.txt
|
|
||||||
|
|
||||||
# Delete all build assets.
|
|
||||||
clean:
|
|
||||||
rm -rf dist
|
|
||||||
rm -f $(BINARY) $(BINARY).*.{macos,freebsd,linux,exe,upx}{,.gz,.zip} $(BINARY).1{,.gz} $(BINARY).rb
|
|
||||||
rm -f $(BINARY){_,-}*.{deb,rpm,txz} v*.tar.gz.sha256 examples/MANUAL .metadata.make rsrc_*.syso
|
|
||||||
rm -f cmd/$(BINARY)/README{,.html} README{,.html} ./$(BINARY)_manual.html rsrc.syso $(MACAPP).app.zip
|
|
||||||
rm -rf package_build_* release after-install-rendered.sh before-remove-rendered.sh $(MACAPP).app
|
|
||||||
|
|
||||||
####################
|
####################
|
||||||
##### Sidecars #####
|
##### Sidecars #####
|
||||||
|
|
@ -129,85 +57,9 @@ rsrc.syso: init/windows/application.ico init/windows/manifest.xml $(shell go env
|
||||||
$(shell go env GOPATH)/bin/rsrc:
|
$(shell go env GOPATH)/bin/rsrc:
|
||||||
cd /tmp ; go get $(RSRC_BIN) ; go install $(RSRC_BIN)@latest
|
cd /tmp ; go get $(RSRC_BIN) ; go install $(RSRC_BIN)@latest
|
||||||
|
|
||||||
####################
|
|
||||||
##### Binaries #####
|
|
||||||
####################
|
|
||||||
|
|
||||||
build: $(BINARY)
|
bulid-and-release:
|
||||||
$(BINARY): main.go
|
|
||||||
go build -o $(BINARY) -ldflags "-w -s $(VERSION_LDFLAGS) $(EXTRA_LDFLAGS) "
|
|
||||||
[ -z "$(UPXPATH)" ] || $(UPXPATH) -q9 $@
|
|
||||||
|
|
||||||
macos: $(BINARY).amd64.macos
|
|
||||||
$(BINARY).amd64.macos: main.go
|
|
||||||
# Building darwin 64-bit x86 binary.
|
|
||||||
GOOS=darwin GOARCH=amd64 go build -o $@ -ldflags "-w -s $(VERSION_LDFLAGS) $(EXTRA_LDFLAGS) "
|
|
||||||
[ -z "$(UPXPATH)" ] || $(UPXPATH) -q9 $@
|
|
||||||
|
|
||||||
exe: $(BINARY).amd64.exe
|
|
||||||
windows: $(BINARY).amd64.exe
|
|
||||||
$(BINARY).amd64.exe: rsrc.syso main.go
|
|
||||||
# Building windows 64-bit x86 binary.
|
|
||||||
GOOS=windows GOARCH=amd64 go build -o $@ -ldflags "-w -s $(VERSION_LDFLAGS) $(EXTRA_LDFLAGS) $(WINDOWS_LDFLAGS)"
|
|
||||||
[ -z "$(UPXPATH)" ] || $(UPXPATH) -q9 $@
|
|
||||||
|
|
||||||
####################
|
|
||||||
##### Packages #####
|
|
||||||
####################
|
|
||||||
|
|
||||||
macapp: $(MACAPP).app
|
|
||||||
$(MACAPP).app: macos
|
|
||||||
[ -z "$(MACAPP)" ] || mkdir -p init/macos/$(MACAPP).app/Contents/MacOS
|
|
||||||
[ -z "$(MACAPP)" ] || cp $(BINARY).amd64.macos init/macos/$(MACAPP).app/Contents/MacOS/$(MACAPP)
|
|
||||||
[ -z "$(MACAPP)" ] || cp -rp init/macos/$(MACAPP).app $(MACAPP).app
|
|
||||||
|
|
||||||
####################
|
|
||||||
##### Homebrew #####
|
|
||||||
####################
|
|
||||||
|
|
||||||
# This builds a Homebrew formula file that can be used to install this app from source.
|
|
||||||
# The source used comes from the released version on GitHub. This will not work with local source.
|
|
||||||
# This target is used by Travis CI to update the released Forumla when a new tag is created.
|
|
||||||
formula: $(BINARY).rb
|
|
||||||
v$(VERSION).tar.gz.sha256:
|
|
||||||
# Calculate the SHA from the Github source file.
|
|
||||||
curl -sL $(SOURCE_URL)/archive/v$(VERSION).tar.gz | openssl dgst -r -sha256 | tee $@
|
|
||||||
$(BINARY).rb: v$(VERSION).tar.gz.sha256 init/homebrew/$(FORMULA).rb.tmpl
|
|
||||||
# Creating formula from template using sed.
|
|
||||||
sed -e "s/{{Version}}/$(VERSION)/g" \
|
|
||||||
-e "s/{{Iter}}/$(ITERATION)/g" \
|
|
||||||
-e "s/{{SHA256}}/$(shell head -c64 $<)/g" \
|
|
||||||
-e "s/{{Desc}}/$(DESC)/g" \
|
|
||||||
-e "s%{{SOURCE_URL}}%$(SOURCE_URL)%g" \
|
|
||||||
-e "s%{{SOURCE_PATH}}%$(SOURCE_PATH)%g" \
|
|
||||||
-e "s%{{CONFIG_FILE}}%$(CONFIG_FILE)%g" \
|
|
||||||
-e "s%{{Class}}%$(shell echo $(BINARY) | perl -pe 's/(?:\b|-)(\p{Ll})/\u$$1/g')%g" \
|
|
||||||
init/homebrew/$(FORMULA).rb.tmpl | tee $(BINARY).rb
|
|
||||||
# That perl line turns hello-world into HelloWorld, etc.
|
|
||||||
|
|
||||||
# Used for Homebrew only. Other distros can create packages.
|
|
||||||
install: man readme $(BINARY) plugins_darwin
|
|
||||||
@echo - Done Building -
|
|
||||||
@echo - Local installation with the Makefile is only supported on macOS.
|
|
||||||
@echo - Otherwise, build and install a package: make rpm -or- make deb
|
|
||||||
@[ "$(shell uname)" = "Darwin" ] || (echo "Unable to continue, not a Mac." && false)
|
|
||||||
@[ "$(PREFIX)" != "" ] || (echo "Unable to continue, PREFIX not set. Use: make install PREFIX=/usr/local ETC=/usr/local/etc" && false)
|
|
||||||
@[ "$(ETC)" != "" ] || (echo "Unable to continue, ETC not set. Use: make install PREFIX=/usr/local ETC=/usr/local/etc" && false)
|
|
||||||
# Copying the binary, config file, unit file, and man page into the env.
|
|
||||||
/usr/bin/install -m 0755 -d $(PREFIX)/bin $(PREFIX)/share/man/man1 $(ETC)/$(BINARY) $(PREFIX)/share/doc/$(BINARY) $(PREFIX)/lib/$(BINARY)
|
|
||||||
/usr/bin/install -m 0755 -cp $(BINARY) $(PREFIX)/bin/$(BINARY)
|
|
||||||
/usr/bin/install -m 0644 -cp $(BINARY).1.gz $(PREFIX)/share/man/man1
|
|
||||||
/usr/bin/install -m 0644 -cp examples/$(CONFIG_FILE).example $(ETC)/$(BINARY)/
|
|
||||||
/usr/bin/install -m 0755 -d $(PREFIX)/lib/$(BINARY)/web/static/{css,js,images}
|
|
||||||
/usr/bin/install -m 0644 -cp init/webserver/index.html $(PREFIX)/lib/$(BINARY)/web/index.html
|
|
||||||
/usr/bin/install -m 0644 -cp init/webserver/static/css/* $(PREFIX)/lib/$(BINARY)/web/static/css/
|
|
||||||
/usr/bin/install -m 0644 -cp init/webserver/static/js/* $(PREFIX)/lib/$(BINARY)/web/static/js/
|
|
||||||
/usr/bin/install -m 0644 -cp init/webserver/static/images/* $(PREFIX)/lib/$(BINARY)/web/static/images/
|
|
||||||
[ -f $(ETC)/$(BINARY)/$(CONFIG_FILE) ] || /usr/bin/install -m 0644 -cp examples/$(CONFIG_FILE).example $(ETC)/$(BINARY)/$(CONFIG_FILE)
|
|
||||||
/usr/bin/install -m 0644 -cp LICENSE *.html examples/* $(PREFIX)/share/doc/$(BINARY)/
|
|
||||||
|
|
||||||
goreleaser:
|
|
||||||
goreleaser release --rm-dist
|
goreleaser release --rm-dist
|
||||||
|
|
||||||
goreleaser-test:
|
build:
|
||||||
goreleaser release --rm-dist --skip-validate --skip-publish --skip-sign --debug
|
goreleaser release --rm-dist --skip-validate --skip-publish --skip-sign --debug
|
||||||
|
|
|
||||||
|
|
@ -1,62 +0,0 @@
|
||||||
#
|
|
||||||
# This is part of Application Builder.
|
|
||||||
# https://github.com/golift/application-builder
|
|
||||||
#
|
|
||||||
|
|
||||||
ARG ARCH=amd64
|
|
||||||
ARG OS=linux
|
|
||||||
ARG BUILD_DATE=0
|
|
||||||
ARG COMMIT=0
|
|
||||||
ARG VERSION=unknown
|
|
||||||
ARG BINARY=application-builder
|
|
||||||
|
|
||||||
FROM golang:latest as builder
|
|
||||||
ARG ARCH
|
|
||||||
ARG OS
|
|
||||||
ARG BINARY
|
|
||||||
|
|
||||||
RUN mkdir -p $GOPATH/pkg/mod $GOPATH/bin $GOPATH/src /${BINARY}
|
|
||||||
COPY . /${BINARY}
|
|
||||||
WORKDIR /${BINARY}
|
|
||||||
|
|
||||||
RUN apt update && \
|
|
||||||
apt install -y upx && \
|
|
||||||
CGO_ENABLED=0 make ${BINARY}.${ARCH}.${OS}
|
|
||||||
|
|
||||||
FROM scratch
|
|
||||||
ARG ARCH
|
|
||||||
ARG OS
|
|
||||||
ARG BUILD_DATE
|
|
||||||
ARG COMMIT
|
|
||||||
ARG VERSION
|
|
||||||
ARG LICENSE=MIT
|
|
||||||
ARG BINARY
|
|
||||||
ARG SOURCE_URL=http://github.com/golift/application-builder
|
|
||||||
ARG DESC=application-builder
|
|
||||||
ARG VENDOR=golift
|
|
||||||
ARG AUTHOR=golift
|
|
||||||
ARG CONFIG_FILE=config.conf
|
|
||||||
|
|
||||||
# Build-time metadata as defined at https://github.com/opencontainers/image-spec/blob/master/annotations.md
|
|
||||||
LABEL org.opencontainers.image.created="${BUILD_DATE}" \
|
|
||||||
org.opencontainers.image.title="${BINARY}" \
|
|
||||||
org.opencontainers.image.documentation="${SOURCE_URL}/wiki/Docker" \
|
|
||||||
org.opencontainers.image.description="${DESC}" \
|
|
||||||
org.opencontainers.image.url="${SOURCE_URL}" \
|
|
||||||
org.opencontainers.image.revision="${COMMIT}" \
|
|
||||||
org.opencontainers.image.source="${SOURCE_URL}" \
|
|
||||||
org.opencontainers.image.vendor="${VENDOR}" \
|
|
||||||
org.opencontainers.image.authors="${AUTHOR}" \
|
|
||||||
org.opencontainers.image.architecture="${OS} ${ARCH}" \
|
|
||||||
org.opencontainers.image.licenses="${LICENSE}" \
|
|
||||||
org.opencontainers.image.version="${VERSION}"
|
|
||||||
|
|
||||||
COPY --from=builder /${BINARY}/${BINARY}.${ARCH}.${OS} /image
|
|
||||||
COPY --from=builder /${BINARY}/examples/${CONFIG_FILE}.example /etc/${BINARY}/${CONFIG_FILE}
|
|
||||||
COPY --from=builder /${BINARY}/init/webserver /usr/lib/unifi-poller/web
|
|
||||||
COPY --from=builder /etc/ssl /etc/ssl
|
|
||||||
COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo
|
|
||||||
|
|
||||||
ENV TZ=UTC
|
|
||||||
|
|
||||||
ENTRYPOINT [ "/image" ]
|
|
||||||
|
|
@ -1,12 +1,6 @@
|
||||||
## Docker Cloud Builds
|
|
||||||
|
|
||||||
This folder contains the files that build our Docker image. The image
|
|
||||||
is built by Docker Hub "automatically" using the [Dockerfile](Dockerfile)
|
|
||||||
and [hooks/](hooks/) in this folder.
|
|
||||||
|
|
||||||
## Docker Compose
|
## Docker Compose
|
||||||
|
|
||||||
The other files in this folder can be used locally to spin up
|
The files in this folder can be used locally to spin up
|
||||||
a full set of applications (minus the UniFi controller) to get
|
a full set of applications (minus the UniFi controller) to get
|
||||||
UniFi Poller up and running. Including InfluxDB, Grafana, and
|
UniFi Poller up and running. Including InfluxDB, Grafana, and
|
||||||
Chronograph. This last app is useful to inspect the data stored
|
Chronograph. This last app is useful to inspect the data stored
|
||||||
|
|
@ -14,4 +8,4 @@ in InfluxDB by UniFi Poller.
|
||||||
|
|
||||||
##### HOWTO
|
##### HOWTO
|
||||||
**Learn more about how and when to use these *Docker Compose* files in the
|
**Learn more about how and when to use these *Docker Compose* files in the
|
||||||
[Docker Wiki](https://github.com/unifi-poller/unifi-poller/wiki/Docker).**
|
[Docker Wiki](https://unpoller.com/docs/install/dockercompose).**
|
||||||
|
|
|
||||||
|
|
@ -1,34 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
# The Docker Cloud config must pass in the BUILDS env variable.
|
|
||||||
# See README.md (in this dir) and the screenshot for more info.
|
|
||||||
# This is part of Application Builder.
|
|
||||||
# https://github.com/golift/application-builder
|
|
||||||
|
|
||||||
# This always run local to the Dockerfile folder, so the path is ../..
|
|
||||||
pushd ../..
|
|
||||||
|
|
||||||
source settings.sh
|
|
||||||
|
|
||||||
# Build each configured image from Docker Cloud.
|
|
||||||
for build in $BUILDS; do
|
|
||||||
# os:name:arch
|
|
||||||
os=$(echo $build | cut -d: -f1)
|
|
||||||
name=$(echo $build | cut -d: -f2)
|
|
||||||
echo "Building Image ${IMAGE_NAME}_${os}_${name}"
|
|
||||||
docker build \
|
|
||||||
--build-arg "ARCH=${name}" \
|
|
||||||
--build-arg "BUILD_DATE=${DATE}" \
|
|
||||||
--build-arg "COMMIT=${COMMIT}" \
|
|
||||||
--build-arg "VERSION=${VERSION}-${ITERATION}" \
|
|
||||||
--build-arg "LICENSE=${LICENSE}" \
|
|
||||||
--build-arg "DESC=${DESC}" \
|
|
||||||
--build-arg "VENDOR=${VENDOR}" \
|
|
||||||
--build-arg "AUTHOR=${MAINT}" \
|
|
||||||
--build-arg "BINARY=${BINARY}" \
|
|
||||||
--build-arg "SOURCE_URL=${SOURCE_URL}" \
|
|
||||||
--build-arg "CONFIG_FILE=${CONFIG_FILE}" \
|
|
||||||
--tag "${IMAGE_NAME}_${os}_${name}" \
|
|
||||||
--file ${DOCKERFILE_PATH} .
|
|
||||||
done
|
|
||||||
|
|
||||||
popd
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
# This is part of Application Builder.
|
|
||||||
# https://github.com/golift/application-builder
|
|
||||||
|
|
||||||
# https://www.smockle.com/blog/2019/04/22/migrating-from-travis-ci-to-docker-hub-automated-builds/
|
|
||||||
|
|
||||||
# This upgrades the docker client on the Docker Cloud server to a version
|
|
||||||
# that contains the `docker manifest` command. To use `docker manifest`
|
|
||||||
# set `DOCKER_CLI_EXPERIMENTAL=enabled` in your build environment.
|
|
||||||
# See README.md (in this dir) and the screenshot for more info.
|
|
||||||
|
|
||||||
docker run --rm --privileged multiarch/qemu-user-static:register --reset
|
|
||||||
|
|
@ -1,53 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
# This post build hook creates multi-architecture docker manifests.
|
|
||||||
# It's all a bit complicated for some reason.
|
|
||||||
# This is part of Application Builder.
|
|
||||||
# https://github.com/golift/application-builder
|
|
||||||
|
|
||||||
pushd ../..
|
|
||||||
source settings.sh
|
|
||||||
popd
|
|
||||||
|
|
||||||
if [ "$BUILDS" != "" ]; then
|
|
||||||
TAGS=$DOCKER_TAG
|
|
||||||
fi
|
|
||||||
|
|
||||||
export DOCKER_CLI_EXPERIMENTAL=enabled
|
|
||||||
|
|
||||||
# Push the extra custom images that were created.
|
|
||||||
for build in $BUILDS; do
|
|
||||||
os=$(echo $build | cut -d: -f1)
|
|
||||||
name=$(echo $build | cut -d: -f2)
|
|
||||||
echo "Pushing Image ${IMAGE_NAME}_${os}_${name}"
|
|
||||||
docker push ${IMAGE_NAME}_${os}_${name}
|
|
||||||
IMAGES="${IMAGES} ${IMAGE_NAME}_${os}_${name}"
|
|
||||||
done
|
|
||||||
echo "Annotating Images: ${IMAGES}"
|
|
||||||
|
|
||||||
# Build all the Docker tags if the source branch is a release and not a branch or pre-release.
|
|
||||||
if [ "v$VERSION" = "$SOURCE_BRANCH" ]; then
|
|
||||||
TAGS="$VERSION"
|
|
||||||
|
|
||||||
echo $SOURCE_BRANCH | grep -q -- -
|
|
||||||
if [ "$?" = "1" ]; then
|
|
||||||
# tag does not contain a dash, so assume it's a prod tag.
|
|
||||||
TAGS="$TAGS latest stable $(echo $VERSION | cut -d. -f1,2) $(echo $VERSION | cut -d. -f1)"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Version: $VERSION, Source: $SOURCE_BRANCH, Building tags: ${TAGS}"
|
|
||||||
|
|
||||||
# Create multi-architecture manifests for each tag with all the built images.
|
|
||||||
for tag in $TAGS; do
|
|
||||||
docker manifest create --amend ${DOCKER_REPO}:${tag} $IMAGES
|
|
||||||
for build in $BUILDS; do
|
|
||||||
# os:name:arch, ie linux:amd64:amd64
|
|
||||||
os=$(echo $build | cut -d: -f1)
|
|
||||||
name=$(echo $build | cut -d: -f2)
|
|
||||||
arch=$(echo $build | cut -d: -f3)
|
|
||||||
# Annotating updates the manifest to describe each images' capabilities.
|
|
||||||
docker manifest annotate ${DOCKER_REPO}:${tag} ${IMAGE_NAME}_${os}_${name} --os ${os} --arch ${arch}
|
|
||||||
done
|
|
||||||
echo "Pushing Manifest ${DOCKER_REPO}:${tag}"
|
|
||||||
docker manifest push ${DOCKER_REPO}:${tag}
|
|
||||||
done
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
Copy your plugins into this folder and run `make plugins` to build them.
|
|
||||||
There is an example plugin available:
|
|
||||||
[https://github.com/unifi-poller/mysqlunifi](https://github.com/unifi-poller/mysqlunifi)
|
|
||||||
|
|
@ -36,7 +36,3 @@ export LICENSE FORMULA SOURCE_URL VERSION_PATH SOURCE_PATH
|
||||||
# Import this signing key only if it's in the keyring.
|
# Import this signing key only if it's in the keyring.
|
||||||
gpg --list-keys 2>/dev/null | grep -q B93DD66EF98E54E2EAE025BA0166AD34ABC5A57C
|
gpg --list-keys 2>/dev/null | grep -q B93DD66EF98E54E2EAE025BA0166AD34ABC5A57C
|
||||||
[ "$?" != "0" ] || export SIGNING_KEY=B93DD66EF98E54E2EAE025BA0166AD34ABC5A57C
|
[ "$?" != "0" ] || export SIGNING_KEY=B93DD66EF98E54E2EAE025BA0166AD34ABC5A57C
|
||||||
|
|
||||||
export WINDOWS_LDFLAGS=""
|
|
||||||
export MACAPP=""
|
|
||||||
export EXTRA_FPM_FLAGS=""
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue