weather poller application deploy on kubernetes. and weather api with ssl
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
2.1KB

  1. .PHONY: gen-cert build-weather build-poller gen-cert dev-dependencies cert-info cert-info-remote curl-test clean get-root-ca
  2. .EXPORT_ALL_VARIABLES:
  3. GOARCH=amd64
  4. # GOARCH=arm
  5. GOOS=darwin
  6. # GOOS=linux
  7. LDFLAGS=-w -s -X go/weather/internal/version.Version=$$(git rev-list -1 HEAD)
  8. GOBUILDFLAGS=-tags dev
  9. CGO_ENABLED=0
  10. DOCKER_BUILDKIT=1
  11. WEATHER_VERSION=1.0.0
  12. POLLER_VERSION=1.0.0
  13. DOMAIN_ALIAS=weather.localdomain,weather-dev.localdomain
  14. build: build-poller build-weather
  15. build-weather: dependencies
  16. @echo "build for os $$GOOS and arch $$GOARCH"
  17. go build -o bin/weather-$(GOOS)-$(GOARCH) -ldflags="$(LDFLAGS)" $(GOBUILDFLAGS) cmd/weather/main.go
  18. build-poller: dependencies
  19. @echo "build for os $$GOOS and arch $$GOARCH"
  20. go build -o bin/poller-$(GOOS)-$(GOARCH) -ldflags="$(LDFLAGS)" $(GOBUILDFLAGS) cmd/poller/main.go
  21. gen-cert:
  22. cfssl gencert -config certs/client-config.json -profile server -hostname $(DOMAIN_ALIAS) certs/client-csr.json | cfssljson -bare certs/out/weather
  23. dependencies:
  24. go mod download
  25. go mod verify
  26. dev-dependencies:
  27. go get github.com/cloudflare/cfssl/cmd/cfssl
  28. go get github.com/cloudflare/cfssl/cmd/cfssljson
  29. go get github.com/cloudflare/cfssl/cmd/mkbundle
  30. cert-info:
  31. cfssl certinfo -cert certs/out/weather.pem
  32. cert-info-remote:
  33. cfssl certinfo -domain weather.localdomain:8080
  34. curl-test:
  35. curl --cacert certs/out/ca.pem https://weather.localdomain:8080
  36. clean:
  37. rm -rf bin/*
  38. get-root-ca:
  39. cfssl info -remote rasp1.localdomain:444 -config certs/client-config.json | cfssljson -bare -stdout /dev/stdout | tee certs/out/ca.pem
  40. docker: docker-build-poller docker-build-weather
  41. docker-build-poller:
  42. docker build --force-rm -t docker.registry:5000/weather/poller:$(POLLER_VERSION) --build-arg POLLER_VERSION=$(POLLER_VERSION) -f DockerfilePoller .
  43. docker push docker.registry:5000/weather/poller:$(POLLER_VERSION)
  44. docker-build-weather:
  45. docker build --force-rm -t docker.registry:5000/weather/server:$(WEATHER_VERSION) --build-arg WEATHER_VERSION=$(WEATHER_VERSION) -f DockerfileWeather .
  46. docker push docker.registry:5000/weather/server:$(WEATHER_VERSION)
  47. change-log-level:
  48. curl https://127.0.0.1:8080/api/log -k -X PUT -d '{"level": "debug"}'