contentserver/Makefile
Stefan Martinov 0e44ca809d
Deterministic Log Messaging & Refactoring (#26)
* feat: remove apex log from dependency list & upgrade deps

* chore: remove commented out code

* chore: remove high cardinality metric labels

* chore: add stack trace to failed repo requests

* chore: remove logging and return error instead

* chore: change log messages for contentserver

* chore: add constistent messages to content update routine

* feat: add runtime id, and multierr validator

* chore: rename history

* chore: golint fixes

* chore: simplify (golinter)

* chore: update go version

* chore: remove unused dependencies for new go

* chore: move content update to else statement

* chore: remove go-spew

* chore: bump go version to 1.18

* chore: remove alpine dep for updated deps

* chore: update go version and improve build

* chore: minor reformatting
2022-05-26 15:09:11 +02:00

92 lines
2.1 KiB
Makefile

SHELL := /bin/bash
TAG?=latest
IMAGE=foomo/contentserver
# Utils
all: build test
tag:
echo $(TAG)
clean:
rm -fv bin/contentserve*
# Build
build: clean
go build -o bin/contentserver
build-arch: clean
GOOS=linux GOARCH=amd64 go build -o bin/contentserver-linux-amd64
GOOS=darwin GOARCH=amd64 go build -o bin/contentserver-darwin-amd64
build-docker: clean build-arch
curl https://curl.haxx.se/ca/cacert.pem > .cacert.pem
docker build -q . > .image_id
docker tag `cat .image_id` $(IMAGE):$(TAG)
echo "# tagged container `cat .image_id` as $(IMAGE):$(TAG)"
rm -vf .image_id .cacert.pem
build-testclient:
go build -o bin/testclient -i github.com/foomo/contentserver/testing/client
build-testserver:
go build -o bin/testserver -i github.com/foomo/contentserver/testing/server
package: build
pkg/build.sh
# Docker
docker-build:
DOCKER_BUILDKIT=1 docker build -t $(IMAGE):$(TAG) --platform linux/amd64 --progress=plain .
docker-push:
docker push $(IMAGE):$(TAG)
# Testing / benchmarks
test:
go test -v ./...
bench:
go test -run=none -bench=. ./...
run-testserver:
bin/testserver -json-file var/cse-globus-stage-b-with-main-section.json
run-contentserver:
contentserver -var-dir var -webserver-address :9191 -address :9999 http://127.0.0.1:1234
run-contentserver-freeosmem:
contentserver -var-dir var -webserver-address :9191 -address :9999 -free-os-mem 1 http://127.0.0.1:1234
run-prometheus:
prometheus --config.file=prometheus/prometheus.yml
clean-var:
rm var/contentserver-repo-2019*
# Profiling
test-cpu-profile:
go test -cpuprofile=cprof-client github.com/foomo/contentserver/client
go tool pprof --text client.test cprof-client
go test -cpuprofile=cprof-repo github.com/foomo/contentserver/repo
go tool pprof --text repo.test cprof-repo
test-gctrace:
GODEBUG=gctrace=1 go test ./...
test-malloctrace:
GODEBUG=allocfreetrace=1 go test ./...
trace:
curl http://localhost:6060/debug/pprof/trace?seconds=60 > cs-trace
go tool trace cs-trace
pprof-heap-web:
go tool pprof -http=":8081" http://localhost:6060/debug/pprof/heap
pprof-cpu-web:
go tool pprof -http=":8081" http://localhost:6060/debug/pprof/profile