This repository has been archived by the owner on Aug 27, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
98 lines (70 loc) · 2.52 KB
/
makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
SHELL := /bin/bash
export PROJECT = asperitas-backend
# ==============================================================================
# Testing running system
# // To generate a private/public key PEM file.
# openssl genpkey -algorithm RSA -out private.pem -pkeyopt rsa_keygen_bits:2048
# openssl rsa -pubout -in private.pem -out public.pem
# ./asperitas-admin genkey
# curl --user "[email protected]:gophers" http://localhost:3000/v1/users/token/54bb2165-71e1-41a6-af3e-7da4a0e1e2c1
# export TOKEN="COPY TOKEN STRING FROM LAST CALL"
# curl -H "Authorization: Bearer ${TOKEN}" http://localhost:3000/v1/users/1/2
# hey -m GET -c 100 -n 10000 -H "Authorization: Bearer ${TOKEN}" http://localhost:3000/v1/users/1/2
# zipkin: http://localhost:9411
# expvarmon -ports=":4000" -vars="build,requests,goroutines,errors,mem:memstats.Alloc"
# ==============================================================================
# Building containers
all: asperitas
asperitas:
docker build \
-f zarf/docker/dockerfile.asperitas-api \
-t asperitas-api-amd64:1.0 \
--build-arg VCS_REF=`git rev-parse HEAD` \
--build-arg BUILD_DATE=`date -u +”%Y-%m-%dT%H:%M:%SZ”` \
.
# ==============================================================================
# Running from within docker compose
run: up seed
up:
docker-compose -f zarf/compose/compose.yaml -f zarf/compose/compose-config.yaml up --detach --remove-orphans
down:
docker-compose -f zarf/compose/compose.yaml down --remove-orphans
logs:
docker-compose -f zarf/compose/compose.yaml logs -f
# ==============================================================================
# Administration
migrate:
go run app/asperitas-admin/main.go migrate
seed: migrate
go run app/asperitas-admin/main.go seed
# ==============================================================================
# Running tests within the local computer
test:
go test ./... -count=1
staticcheck ./...
# ==============================================================================
# Modules support
deps-reset:
git checkout -- go.mod
go mod tidy
go mod vendor
tidy:
go mod tidy
go mod vendor
deps-upgrade:
# go get $(go list -f '{{if not (or .Main .Indirect)}}{{.Path}}{{end}}' -m all)
go get -u -t -d -v ./...
go mod tidy
go mod vendor
deps-cleancache:
go clean -modcache
# ==============================================================================
# Docker support
FILES := $(shell docker ps -aq)
down-local:
docker stop $(FILES)
docker rm $(FILES)
clean:
docker system prune -f
logs-local:
docker logs -f $(FILES)