2021-03-04 02:31:29 +00:00
|
|
|
.PHONY: gen-cert build-weather build-poller gen-cert dev-dependencies cert-info cert-info-remote curl-test clean get-root-ca
|
2021-03-11 01:59:21 +00:00
|
|
|
.EXPORT_ALL_VARIABLES:
|
|
|
|
|
|
|
|
GOARCH=amd64
|
|
|
|
# GOARCH=arm
|
2021-03-12 01:04:54 +00:00
|
|
|
GOOS=darwin
|
|
|
|
# GOOS=linux
|
2021-04-05 14:42:16 +00:00
|
|
|
LDFLAGS=-w -s -X go/weather/internal/version.Version=$$(git rev-list -1 HEAD)
|
|
|
|
GOBUILDFLAGS=-tags dev
|
2021-03-11 01:59:21 +00:00
|
|
|
CGO_ENABLED=0
|
2021-04-05 14:42:16 +00:00
|
|
|
|
|
|
|
DOCKER_BUILDKIT=1
|
|
|
|
|
|
|
|
WEATHER_VERSION=1.0.0
|
|
|
|
POLLER_VERSION=1.0.0
|
|
|
|
DOMAIN_ALIAS=weather.localdomain,weather-dev.localdomain
|
2021-02-25 01:02:43 +00:00
|
|
|
|
2021-03-04 02:31:29 +00:00
|
|
|
build: build-poller build-weather
|
2021-03-01 00:40:33 +00:00
|
|
|
|
2021-03-11 01:59:21 +00:00
|
|
|
build-weather: dependencies
|
|
|
|
@echo "build for os $$GOOS and arch $$GOARCH"
|
2021-04-05 14:42:16 +00:00
|
|
|
go build -o bin/weather-$(GOOS)-$(GOARCH) -ldflags="$(LDFLAGS)" $(GOBUILDFLAGS) cmd/weather/main.go
|
2021-03-01 00:40:33 +00:00
|
|
|
|
2021-03-11 01:59:21 +00:00
|
|
|
build-poller: dependencies
|
|
|
|
@echo "build for os $$GOOS and arch $$GOARCH"
|
|
|
|
go build -o bin/poller-$(GOOS)-$(GOARCH) -ldflags="$(LDFLAGS)" $(GOBUILDFLAGS) cmd/poller/main.go
|
2021-03-04 02:31:29 +00:00
|
|
|
|
2021-02-25 01:02:43 +00:00
|
|
|
gen-cert:
|
2021-03-17 22:19:05 +00:00
|
|
|
cfssl gencert -config certs/client-config.json -profile server -hostname $(DOMAIN_ALIAS) certs/client-csr.json | cfssljson -bare certs/out/weather
|
2021-02-25 01:02:43 +00:00
|
|
|
|
2021-03-11 01:59:21 +00:00
|
|
|
dependencies:
|
|
|
|
go mod download
|
|
|
|
go mod verify
|
|
|
|
|
2021-03-04 02:31:29 +00:00
|
|
|
dev-dependencies:
|
2021-02-25 01:02:43 +00:00
|
|
|
go get github.com/cloudflare/cfssl/cmd/cfssl
|
|
|
|
go get github.com/cloudflare/cfssl/cmd/cfssljson
|
|
|
|
go get github.com/cloudflare/cfssl/cmd/mkbundle
|
2021-03-01 00:40:33 +00:00
|
|
|
|
|
|
|
cert-info:
|
|
|
|
cfssl certinfo -cert certs/out/weather.pem
|
|
|
|
|
|
|
|
cert-info-remote:
|
|
|
|
cfssl certinfo -domain weather.localdomain:8080
|
|
|
|
|
|
|
|
curl-test:
|
|
|
|
curl --cacert certs/out/ca.pem https://weather.localdomain:8080
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -rf bin/*
|
|
|
|
|
|
|
|
get-root-ca:
|
|
|
|
cfssl info -remote rasp1.localdomain:444 -config certs/client-config.json | cfssljson -bare -stdout /dev/stdout | tee certs/out/ca.pem
|
2021-03-11 01:59:21 +00:00
|
|
|
|
2021-04-05 14:42:16 +00:00
|
|
|
docker: docker-build-poller docker-build-weather
|
2021-03-12 00:28:49 +00:00
|
|
|
|
2021-03-12 23:57:41 +00:00
|
|
|
docker-build-poller:
|
2021-04-05 14:42:16 +00:00
|
|
|
docker build --force-rm -t docker.registry:5000/weather/poller:$(POLLER_VERSION) --build-arg POLLER_VERSION=$(POLLER_VERSION) -f DockerfilePoller .
|
2021-03-12 23:57:41 +00:00
|
|
|
docker push docker.registry:5000/weather/poller:$(POLLER_VERSION)
|
2021-04-05 14:42:16 +00:00
|
|
|
|
|
|
|
docker-build-weather:
|
|
|
|
docker build --force-rm -t docker.registry:5000/weather/server:$(WEATHER_VERSION) --build-arg WEATHER_VERSION=$(WEATHER_VERSION) -f DockerfileWeather .
|
2021-03-17 22:19:05 +00:00
|
|
|
docker push docker.registry:5000/weather/server:$(WEATHER_VERSION)
|
|
|
|
|
|
|
|
change-log-level:
|
|
|
|
curl https://127.0.0.1:8080/api/log -k -X PUT -d '{"level": "debug"}'
|