-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
165 lines (127 loc) · 4.75 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
SHELL := /bin/bash
SRC = ./src
OUTPUT = ../../build
.phony all:
all: build
# Build Commands
.phony build:
build: build-web build-transaction build-audit build-generator build-quote-mock build-quote-cache build-watchdog
.phony build-web:
build-web:
cd $(SRC)/web && go build -o $(OUTPUT)/web.exe
.phony build-transaction:
build-transaction:
cd $(SRC)/transaction && go build -o $(OUTPUT)/transaction.exe
.phony build-audit:
build-audit:
cd $(SRC)/audit && go build -o $(OUTPUT)/audit.exe
.phony build-generator:
build-generator:
cd $(SRC)/generator && go build -o $(OUTPUT)/generator.exe
.phony build-quote-mock:
build-quote-mock:
cd $(SRC)/quote-mock && go build -o $(OUTPUT)/quote-mock.exe
.phony build-quote-cache:
build-quote-cache:
cd $(SRC)/quote-cache && go build -o $(OUTPUT)/quote-cache.exe
.phony build-watchdog:
build-watchdog:
cd $(SRC)/watchdog && go build -o $(OUTPUT)/watchdog.exe
.phony format:
format:
gofmt -w ./src
# Test Commands
.phony test-e2e-all:
test-e2e-all:
cd $(SRC)/test/end-to-end && CLIENT_SSL_CERT_LOCATION=../../../ssl/cert.pem URLS_FILE=../../urls.yml go test -v
# Test only a specific end to end test file
# Example: make f=data_validation_test.go test-e2e-indiv
.phony test-e2e-indiv:
test-e2e-indiv:
cd $(SRC)/test/end-to-end && CLIENT_SSL_CERT_LOCATION=../../../ssl/cert.pem URLS_FILE=../../urls.yml go test -v main_test.go util.go $(f)
# Docker Developer Deployment Commands
# set shortcut: doskey dcdev=docker-compose -f docker-compose.yml -f docker-compose.local.yml -f docker-compose.dev.yml --compatibility $*
.phony docker-deploy-dev:
docker-deploy-dev:
docker-compose -f docker-compose.yml -f docker-compose.local.yml -f docker-compose.dev.yml up --build
.phony docker-deploy-dev-load-testing:
docker-deploy-dev-load-testing:
docker-compose -f docker-compose.yml -f docker-compose.local.yml -f docker-compose.dev.yml --compatibility up --build -d
.phony docker-redeploy-dev:
docker-redeploy:
docker-compose -f docker-compose.yml -f docker-compose.local.yml -f docker-compose.dev.yml --compatibility up --build --force-recreate --no-deps -d $(c)
# Docker Local Deployment Commands
.phony docker-deploy-local:
docker-deploy-local:
docker-compose -f docker-compose.yml -f docker-compose.local.yml up --build -d
# Docker Lab Deployment Commands
LAB_DEPLOY = docker-compose -f docker-compose.yml -f docker-compose.lab.yml up --build -d
.phony docker-deploy-lab-all:
docker-deploy-lab: build
$(LAB_DEPLOY)
.phony docker-deploy-lab-web:
docker-deploy-lab-web: build
$(LAB_DEPLOY) load web web2
.phony docker-deploy-lab-transaction:
docker-deploy-lab-transaction: build
$(LAB_DEPLOY) transaction dataDB quote-cache
.phony docker-deploy-lab-audit:
docker-deploy-lab-audit: build
$(LAB_DEPLOY) audit auditDB
# Docker Lab Dev Deployment Commands
LAB_DEV_DEPLOY = docker-compose -f docker-compose.yml -f docker-compose.lab.yml -f docker-compose.dev-lab.yml up --build
.phony docker-deploy-dev-lab-all:
docker-deploy-dev-lab-all: build
$(LAB_DEV_DEPLOY)
.phony docker-deploy-dev-lab-web:
docker-deploy-dev-lab-web: build
$(LAB_DEV_DEPLOY) load web web2
.phony docker-deploy-dev-lab-transaction:
docker-deploy-dev-lab-transaction: build
$(LAB_DEV_DEPLOY) transaction dataDB quote-cache
.phony docker-deploy-dev-lab-audit:
docker-deploy-dev-lab-audit: build
$(LAB_DEV_DEPLOY) audit auditDB
# Docker Cleanup
.phony docker-teardown:
docker-teardown:
docker-compose down --remove-orphans -v
.phony docker-clean:
docker-clean:
docker system prune && docker volume prune
# Docker Container Commands
.phony docker-list:
docker-list:
docker ps
# Container Specific Commmands
# Example: make c=CONTAINER_NAME docker-shell
.phony docker-shell:
docker-shell:
docker exec -it $(c) bash
.phony mongo-shell:
mongo-shell:
docker exec -it $(c) bash -c "mongo -u admin -p admin"
.phony docker-stop:
docker-stop:
docker stop $(c)
.phony docker-start:
docker-start:
docker start $(c)
.phony docker-remove:
docker-remove:
docker rm $(c)
# Utility Commands
.phony reset-mongo:
reset-mongo:
docker exec audit-mongodb /bin/sh -c "mongo audit -u user -p user --eval 'db.logs.drop()'" && \
docker exec data-mongodb /bin/sh -c "mongo extremeworkload -u user -p user --eval 'db.users.drop();db.triggers.drop()'" && \
docker restart transaction-server transaction-server2 audit-server
.phony exec-generator-local:
exec-generator-local: build-generator
URLS_FILE=./src/urls.yml CLIENT_SSL_CERT_LOCATION=./ssl/cert.pem ./build/generator.exe -f $(f)
.phony exec-generator-lab:
exec-generator-lab: build-generator
URLS_FILE=./src/urls.yml CLIENT_SSL_CERT_LOCATION=./ssl/cert.pem ENV=LAB ./build/generator.exe -f $(f)
.phony cert-generate:
cert-generate:
cd ./ssl && sudo openssl req -newkey rsa:2048 -nodes -keyout key.pem -x509 -days 365 -out cert.pem -subj '/CN=localhost'