-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
90 lines (65 loc) · 2.55 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
GOFILES := $(shell find . -name '*.go' -not -path "./vendor/*" -not -path "./tests/*" | egrep -v "^\./\.go" | grep -v _test.go)
DEPS_HASHICORP = hashicorp hashicorp-agent
DEPS_HASHICORP_TLS = hashicorp-tls hashicorp-agent-tls
DEPS_POSTGRES = postgres
DEPS_POSTGRES_TLS = postgres-ssl
PACKAGES ?= $(shell go list ./... | egrep -v "tests|e2e|mocks|mock" )
KEY_MANAGER_SERVICES = key-manager
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
OPEN = xdg-open
endif
ifeq ($(UNAME_S),Darwin)
OPEN = open
endif
ifneq (,$(wildcard ./.env))
include .env
export
endif
.PHONY: all lint lint-ci integration-tests swagger-tool
hashicorp:
@docker-compose -f deps/hashicorp/docker-compose.yml up --build -d $(DEPS_HASHICORP)
@sleep 2 # Sleep couple seconds to wait token to be created
hashicorp-tls:
@docker-compose -f deps/hashicorp/docker-compose.yml up --build -d $(DEPS_HASHICORP_TLS)
@sleep 2 # Sleep couple seconds to wait token to be created
hashicorp-down:
@docker-compose -f deps/hashicorp/docker-compose.yml down --volumes --timeout 0
networks:
@docker network create --driver=bridge hashicorp || true
@docker network create --driver=bridge --subnet=172.16.237.0/24 besu || true
@docker network create --driver=bridge --subnet=172.16.238.0/24 quorum || true
down-networks:
@docker network rm quorum || true
@docker network rm besu || true
@docker network rm hashicorp || true
postgres:
@docker-compose -f deps/docker-compose.yml up -d $(DEPS_POSTGRES)
postgres-tls:
@docker-compose -f deps/docker-compose.yml up -d $(DEPS_POSTGRES_TLS)
postgres-down:
@docker-compose -f deps/docker-compose.yml down --volumes --timeout 0
deps: networks hashicorp postgres
deps-tls: networks hashicorp-tls postgres-tls
down-deps: postgres-down hashicorp-down down-networks
gobuild:
@GOOS=linux GOARCH=amd64 go build -o ./build/bin/key-manager
gobuild-dbg:
CGO_ENABLED=1 go build -gcflags=all="-N -l" -i -o ./build/bin/key-manager
qkm: gobuild
@docker-compose -f ./docker-compose.dev.yml up --force-recreate --build -d $(KEY_MANAGER_SERVICES)
dev: deps qkm
up-tls: deps-tls gobuild
@docker-compose -f ./docker-compose.dev.yml up --build -d $(KEY_MANAGER_SERVICES)
down-dev:
@docker-compose -f ./docker-compose.dev.yml down --volumes --timeout 0
run: gobuild
@./build/bin/key-manager run
run-dbg: gobuild-dbg
@dlv --listen=:2345 --headless=true --api-version=2 --accept-multiclient exec ./build/bin/key-manager run
sync: gobuild
@docker-compose -f ./docker-compose.dev.yml up sync
deploy-remote-env:
@bash ./scripts/deploy-remote-env.sh
run-server-dev:
go run main.go run