forked from transcom/mymove
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
1198 lines (988 loc) · 42.1 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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
DB_NAME_DEV = dev_db
DB_NAME_DEPLOYED_MIGRATIONS = deployed_migrations
DB_NAME_TEST = test_db
DB_DOCKER_CONTAINER_DEV = milmove-db-dev
DB_DOCKER_CONTAINER_DEPLOYED_MIGRATIONS = milmove-db-deployed-migrations
DB_DOCKER_CONTAINER_TEST = milmove-db-test
# The version of the postgres container should match production as closely
# as possible.
# https://github.com/transcom/transcom-infrasec-com/blob/c32c45078f29ea6fd58b0c246f994dbea91be372/transcom-com-legacy/app-prod/main.tf#L62
DB_DOCKER_CONTAINER_IMAGE = postgres:12.7
REDIS_DOCKER_CONTAINER_IMAGE = redis:5.0.6
REDIS_DOCKER_CONTAINER = milmove-redis
TASKS_DOCKER_CONTAINER = tasks
WEBHOOK_CLIENT_DOCKER_CONTAINER = webhook-client
export PGPASSWORD=mysecretpassword
# if S3 access is enabled, wrap webserver in aws-vault command
# to pass temporary AWS credentials to the binary.
ifeq ($(STORAGE_BACKEND),s3)
USE_AWS:=true
endif
ifeq ($(USE_AWS),true)
AWS_VAULT:=aws-vault exec $(AWS_PROFILE) --
endif
# Convenience for LDFLAGS
GIT_BRANCH ?= $(shell git branch | grep \* | cut -d ' ' -f2)
GIT_COMMIT ?= $(shell git rev-list -1 HEAD)
export GIT_BRANCH GIT_COMMIT
WEBSERVER_LDFLAGS=-X main.gitBranch=$(GIT_BRANCH) -X main.gitCommit=$(GIT_COMMIT)
GC_FLAGS=-trimpath=$(GOPATH)
DB_PORT_DEV=5432
DB_PORT_TEST=5433
DB_PORT_DEPLOYED_MIGRATIONS=5434
DB_PORT_DOCKER=5432
REDIS_PORT=6379
REDIS_PORT_DOCKER=6379
ifdef CIRCLECI
DB_PORT_DEV=5432
DB_PORT_TEST=5432
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
LDFLAGS=-linkmode external -extldflags -static
endif
endif
ifdef GOLAND
GOLAND_GC_FLAGS=all=-N -l
endif
SCHEMASPY_OUTPUT=./tmp/schemaspy
export DEVSEED_SUBSCENARIO
.PHONY: help
help: ## Print the help documentation
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
#
# ----- END PREAMBLE -----
#
#
# ----- START CHECK TARGETS -----
#
# This target ensures that the pre-commit hook is installed and kept up to date
# if pre-commit updates.
.PHONY: ensure_pre_commit
ensure_pre_commit: .git/hooks/pre-commit install_pre_commit ## Ensure pre-commit is installed
.git/hooks/pre-commit: /usr/local/bin/pre-commit
.PHONY: install_pre_commit
install_pre_commit: ## Installs pre-commit hooks
pre-commit install
pre-commit install-hooks
.PHONY: prereqs
prereqs: .prereqs.stamp ## Check that pre-requirements are installed, includes dependency scripts
.prereqs.stamp: scripts/prereqs scripts/check-aws-cli-version scripts/check-aws-vault-version scripts/check-bash-version scripts/check-chamber-version scripts/check-go-version scripts/check-gopath scripts/check-hosts-file scripts/check-node-version scripts/check-opensc-version
scripts/prereqs
touch .prereqs.stamp
.PHONY: check_hosts
check_hosts: .check_hosts.stamp ## Check that hosts are in the /etc/hosts file
.check_hosts.stamp: scripts/check-hosts-file
ifndef CIRCLECI
scripts/check-hosts-file
else
@echo "Not checking hosts on CircleCI."
endif
touch .check_hosts.stamp
.PHONY: check_go_version
check_go_version: .check_go_version.stamp ## Check that the correct Golang version is installed
.check_go_version.stamp: scripts/check-go-version
scripts/check-go-version
touch .check_go_version.stamp
.PHONY: check_gopath
check_gopath: .check_gopath.stamp ## Check that $GOPATH exists in $PATH
.check_gopath.stamp:
scripts/check-gopath
touch .check_gopath.stamp
.PHONY: check_bash_version
check_bash_version: .check_bash_version.stamp ## Check that the correct Bash version is installed
.check_bash_version.stamp: scripts/check-bash-version
ifndef CIRCLECI
scripts/check-bash-version
else
@echo "No need to check bash version on CircleCI"
endif
touch .check_bash_version.stamp
.PHONY: check_node_version
check_node_version: .check_node_version.stamp ## Check that the correct Node version is installed
.check_node_version.stamp: scripts/check-node-version
scripts/check-node-version
touch .check_node_version.stamp
.PHONY: check_docker_size
check_docker_size: ## Check the amount of disk space used by docker
scripts/check-docker-size
.PHONY: deps
deps: prereqs ensure_pre_commit deps_shared ## Run all checks and install all dependencies
.PHONY: deps_nix
deps_nix: install_pre_commit deps_shared ## Nix equivalent (kind of) of `deps` target.
.PHONY: deps_shared
deps_shared: client_deps redis_pull bin/rds-ca-2019-root.pem bin/rds-ca-us-gov-west-1-2017-root.pem ## install dependencies
.PHONY: test
test: client_test server_test e2e_test ## Run all tests
.PHONY: diagnostic
diagnostic: .prereqs.stamp check_docker_size ## Run diagnostic scripts on environment
.PHONY: check_log_dir
check_log_dir: ## Make sure we have a log directory
mkdir -p log
.PHONY: check_app
check_app: ## Make sure you're running the correct APP
@echo "Ensure that you're running the correct APPLICATION..."
./scripts/ensure-application app
#
# ----- END CHECK TARGETS -----
#
#
# ----- START CLIENT TARGETS -----
#
.PHONY: client_deps_update
client_deps_update: .check_node_version.stamp ## Update client dependencies
yarn upgrade
.PHONY: client_deps
client_deps: .check_hosts.stamp .check_node_version.stamp .client_deps.stamp ## Install client dependencies
.client_deps.stamp: yarn.lock
yarn install
scripts/copy-swagger-ui
touch .client_deps.stamp
.client_build.stamp: .check_node_version.stamp $(shell find src -type f)
yarn build
touch .client_build.stamp
.PHONY: client_build
client_build: .client_deps.stamp .client_build.stamp ## Build the client
build/index.html: ## milmove serve requires this file to boot, but it isn't used during local development
mkdir -p build
touch build/index.html
.PHONY: client_run
client_run: .client_deps.stamp ## Run MilMove Service Member client
HOST=milmovelocal yarn start
.PHONY: client_test
client_test: .client_deps.stamp ## Run client unit tests
yarn test
.PHONY: client_test_coverage
client_test_coverage : .client_deps.stamp ## Run client unit test coverage
yarn test:coverage
.PHONY: office_client_run
office_client_run: .client_deps.stamp ## Run MilMove Office client
HOST=officelocal yarn start
.PHONY: admin_client_run
admin_client_run: .client_deps.stamp ## Run MilMove Admin client
HOST=adminlocal yarn start
#
# ----- END CLIENT TARGETS -----
#
#
# ----- START BIN TARGETS -----
#
### Go Tool Targets
bin/gin: .check_go_version.stamp .check_gopath.stamp pkg/tools/tools.go
go build -ldflags "$(LDFLAGS)" -o bin/gin github.com/codegangsta/gin
bin/soda: .check_go_version.stamp .check_gopath.stamp pkg/tools/tools.go
go build -ldflags "$(LDFLAGS)" -o bin/soda github.com/gobuffalo/pop/v5/soda
# No static linking / $(LDFLAGS) because go-junit-report is only used for building the CirlceCi test report
bin/go-junit-report: .check_go_version.stamp .check_gopath.stamp pkg/tools/tools.go
go build -o bin/go-junit-report github.com/jstemmer/go-junit-report
# No static linking / $(LDFLAGS) because mockery is only used for testing
bin/mockery: .check_go_version.stamp .check_gopath.stamp pkg/tools/tools.go
go build -o bin/mockery github.com/vektra/mockery/v2
### Cert Targets
bin/rds-ca-2019-root.pem:
mkdir -p bin/
curl -sSo bin/rds-ca-2019-root.pem https://s3.amazonaws.com/rds-downloads/rds-ca-2019-root.pem
bin/rds-ca-us-gov-west-1-2017-root.pem:
mkdir -p bin/
curl -sSo bin/rds-ca-us-gov-west-1-2017-root.pem https://s3.us-gov-west-1.amazonaws.com/rds-downloads/rds-ca-us-gov-west-1-2017-root.pem
### MilMove Targets
bin/big-cat: cmd/big-cat
go build -ldflags "$(LDFLAGS)" -o bin/big-cat ./cmd/big-cat
bin/model-vet: cmd/model-vet
go build -ldflags "$(LDFLAGS)" -o bin/model-vet ./cmd/model-vet
bin/generate-deploy-notes: cmd/generate-deploy-notes
go build -ldflags "$(LDFLAGS)" -o bin/generate-deploy-notes ./cmd/generate-deploy-notes
bin/ecs-deploy: cmd/ecs-deploy
go build -ldflags "$(LDFLAGS)" -o bin/ecs-deploy ./cmd/ecs-deploy
bin/generate-access-codes: cmd/generate_access_codes
go build -ldflags "$(LDFLAGS)" -o bin/generate-access-codes ./cmd/generate_access_codes
bin/generate-shipment-summary: cmd/generate_shipment_summary
go build -ldflags "$(LDFLAGS)" -o bin/generate-shipment-summary ./cmd/generate_shipment_summary
bin/generate-test-data: cmd/generate-test-data
go build -ldflags "$(LDFLAGS)" -o bin/generate-test-data ./cmd/generate-test-data
bin/ghc-pricing-parser: cmd/ghc-pricing-parser
go build -ldflags "$(LDFLAGS)" -o bin/ghc-pricing-parser ./cmd/ghc-pricing-parser
bin/ghc-transit-time-parser: cmd/ghc-transit-time-parser
go build -ldflags "$(LDFLAGS)" -o bin/ghc-transit-time-parser ./cmd/ghc-transit-time-parser
bin/health-checker: cmd/health-checker
go build -ldflags "$(LDFLAGS)" -o bin/health-checker ./cmd/health-checker
bin/iws: cmd/iws
go build -ldflags "$(LDFLAGS)" -o bin/iws ./cmd/iws/iws.go
bin/milmove: cmd/milmove
go build -gcflags="$(GOLAND_GC_FLAGS) $(GC_FLAGS)" -asmflags=-trimpath=$(GOPATH) -ldflags "$(LDFLAGS) $(WEBSERVER_LDFLAGS)" -o bin/milmove ./cmd/milmove
bin/milmove-tasks: cmd/milmove-tasks
go build -ldflags "$(LDFLAGS) $(WEBSERVER_LDFLAGS)" -o bin/milmove-tasks ./cmd/milmove-tasks
bin/prime-api-client: cmd/prime-api-client
go build -ldflags "$(LDFLAGS)" -o bin/prime-api-client ./cmd/prime-api-client
bin/webhook-client: cmd/webhook-client
go build -ldflags "$(LDFLAGS)" -o bin/webhook-client ./cmd/webhook-client
bin/read-alb-logs: cmd/read-alb-logs
go build -ldflags "$(LDFLAGS)" -o bin/read-alb-logs ./cmd/read-alb-logs
bin/report-ecs: cmd/report-ecs
go build -ldflags "$(LDFLAGS)" -o bin/report-ecs ./cmd/report-ecs
bin/send-to-gex: pkg/gen/ cmd/send-to-gex
go build -ldflags "$(LDFLAGS)" -o bin/send-to-gex ./cmd/send-to-gex
bin/tls-checker: cmd/tls-checker
go build -ldflags "$(LDFLAGS)" -o bin/tls-checker ./cmd/tls-checker
bin/generate-payment-request-edi: cmd/generate-payment-request-edi
go build -ldflags "$(LDFLAGS)" -o bin/generate-payment-request-edi ./cmd/generate-payment-request-edi
pkg/assets/assets.go:
scripts/gen-assets
#
# ----- END BIN TARGETS -----
#
#
# ----- START SERVER TARGETS -----
#
.PHONY: check_swagger_generate
check_swagger_generate: .swagger_build.stamp ## Check that the build files haven't been manually edited to prevent overwrites
.swagger_build.stamp: $(shell find swagger -type f -name *.yaml)
ifneq ("$(wildcard .swagger_build.stamp)","")
@echo "Unexpected changes found in swagger build files. Code may be overwritten."
@read -p "Continue with rebuild? [y/N] : " ANS && test "$${ANS}" == "y" || (echo "Exiting rebuild."; false)
endif
.PHONY: swagger_generate
swagger_generate: .client_deps.stamp check_swagger_generate ## Bundles the API definition files into a complete specification
yarn build-redoc
touch .swagger_build.stamp
.PHONY: server_generate
server_generate: .check_go_version.stamp .check_gopath.stamp swagger_generate pkg/gen/ ## Generate golang server code from Swagger files
pkg/gen/: pkg/assets/assets.go $(shell find swagger -type f -name *.yaml)
scripts/gen-server
.PHONY: server_build
server_build: bin/milmove ## Build the server
# This command is for running the server by itself, it will serve the compiled frontend on its own
# Note: Don't double wrap with aws-vault because the pkg/cli/vault.go will handle it
server_run_standalone: check_log_dir server_build client_build db_dev_run redis_run
./bin/milmove serve 2>&1 | tee -a log/dev.log
# This command will rebuild the swagger go code and rerun server on any changes
server_run:
find ./swagger-def -type f | entr -c -r make server_run_default
# This command runs the server behind gin, a hot-reload server
# Note: Gin is not being used as a proxy so assigning odd port and laddr to keep in IPv4 space.
# Note: The INTERFACE envar is set to configure the gin build, milmove_gin, local IP4 space with default port GIN_PORT.
server_run_default: .check_hosts.stamp .check_go_version.stamp .check_gopath.stamp .check_node_version.stamp check_log_dir bin/gin build/index.html server_generate db_dev_run redis_run
INTERFACE=localhost \
./bin/gin \
--build ./cmd/milmove \
--bin /bin/milmove_gin \
--laddr 127.0.0.1 --port "$(GIN_PORT)" \
--excludeDir node_modules \
--immediate \
--buildArgs "-i -ldflags=\"$(WEBSERVER_LDFLAGS)\"" \
serve \
2>&1 | tee -a log/dev.log
.PHONY: server_run_debug
server_run_debug: .check_hosts.stamp .check_go_version.stamp .check_gopath.stamp .check_node_version.stamp check_log_dir build/index.html server_generate db_dev_run redis_run ## Debug the server
scripts/kill-process-on-port 8080
scripts/kill-process-on-port 9443
DISABLE_AWS_VAULT_WRAPPER=1 \
AWS_REGION=us-gov-west-1 \
aws-vault exec transcom-gov-dev -- \
dlv debug cmd/milmove/*.go -- serve 2>&1 | tee -a log/dev.log
.PHONY: build_tools
build_tools: bin/gin \
bin/mockery \
bin/rds-ca-2019-root.pem \
bin/rds-ca-us-gov-west-1-2017-root.pem \
bin/big-cat \
bin/generate-deploy-notes \
bin/ecs-deploy \
bin/generate-access-codes \
bin/generate-test-data \
bin/ghc-pricing-parser \
bin/ghc-transit-time-parser \
bin/health-checker \
bin/iws \
bin/milmove-tasks \
bin/model-vet \
bin/prime-api-client \
bin/read-alb-logs \
bin/report-ecs \
bin/send-to-gex \
bin/tls-checker ## Build all tools
.PHONY: build
build: server_build build_tools client_build ## Build the server, tools, and client
# acceptance_test runs a few acceptance tests against a local or remote environment.
# This can help identify potential errors before deploying a container.
.PHONY: acceptance_test
acceptance_test: bin/rds-ca-2019-root.pem bin/rds-ca-us-gov-west-1-2017-root.pem ## Run acceptance tests
ifndef TEST_ACC_ENV
@echo "Running acceptance tests for webserver using local environment."
@echo "* Use environment XYZ by setting environment variable to TEST_ACC_ENV=XYZ."
TEST_ACC_CWD=$(PWD) \
SERVE_ADMIN=true \
SERVE_SDDC=true \
SERVE_ORDERS=true \
SERVE_DPS=true \
SERVE_API_INTERNAL=true \
SERVE_API_GHC=true \
MUTUAL_TLS_ENABLED=true \
go test -v -count 1 -short $$(go list ./... | grep \\/cmd\\/milmove)
else
ifndef CIRCLECI
@echo "Running acceptance tests for webserver with environment $$TEST_ACC_ENV."
TEST_ACC_CWD=$(PWD) \
DISABLE_AWS_VAULT_WRAPPER=1 \
aws-vault exec $(AWS_PROFILE) -- \
chamber -r $(CHAMBER_RETRIES) exec app-$(TEST_ACC_ENV) -- \
go test -v -count 1 -short $$(go list ./... | grep \\/cmd\\/milmove)
else
go build -ldflags "$(LDFLAGS)" -o bin/chamber github.com/segmentio/chamber/v2
@echo "Running acceptance tests for webserver with environment $$TEST_ACC_ENV."
TEST_ACC_CWD=$(PWD) \
bin/chamber -r $(CHAMBER_RETRIES) exec app-$(TEST_ACC_ENV) -- \
go test -v -count 1 -short $$(go list ./... | grep \\/cmd\\/milmove)
endif
endif
.PHONY: mocks_generate
mocks_generate: bin/mockery ## Generate mockery mocks for tests
go generate $$(go list ./... | grep -v \\/pkg\\/gen\\/ | grep -v \\/cmd\\/)
.PHONY: server_test_setup
server_test_setup: db_test_reset db_test_migrate redis_reset db_test_truncate
.PHONY: server_test
server_test: server_test_setup server_test_standalone ## Run server unit tests
.PHONY: server_test_standalone
server_test_standalone: ## Run server unit tests with no deps
NO_DB=1 scripts/run-server-test
.PHONY: server_test_build
server_test_build:
NO_DB=1 DRY_RUN=1 scripts/run-server-test
.PHONY: server_test_all
server_test_all: db_dev_reset db_dev_migrate redis_reset ## Run all server unit tests
# Like server_test but runs extended tests that may hit external services.
LONG_TEST=1 scripts/run-server-test
.PHONY: server_test_coverage_generate
server_test_coverage_generate: db_test_reset db_test_migrate redis_reset server_test_coverage_generate_standalone ## Run server unit test coverage
.PHONY: server_test_coverage_generate_standalone
server_test_coverage_generate_standalone: ## Run server unit tests with coverage and no deps
# Add coverage tracker via go cover
NO_DB=1 SERVER_REPORT=1 COVERAGE=1 scripts/run-server-test
.PHONY: server_test_coverage
server_test_coverage: db_test_reset db_test_migrate redis_reset server_test_coverage_generate ## Run server unit test coverage with html output
DB_PORT=$(DB_PORT_TEST) go tool cover -html=coverage.out
#
# ----- END SERVER TARGETS -----
#
#
# ----- START REDIS TARGETS -----
#
.PHONY: redis_pull
redis_pull: ## Pull redis image
docker pull $(REDIS_DOCKER_CONTAINER_IMAGE)
.PHONY: redis_destroy
redis_destroy: ## Destroy Redis
@echo "Destroying the ${REDIS_DOCKER_CONTAINER} docker redis container..."
docker rm -f $(REDIS_DOCKER_CONTAINER) || echo "No Redis container"
.PHONY: redis_run
redis_run: ## Run Redis
ifndef CIRCLECI
@echo "Stopping the Redis brew service in case it's running..."
brew services stop redis 2> /dev/null || true
endif
@echo "Starting the ${REDIS_DOCKER_CONTAINER} docker redis container..."
docker start $(REDIS_DOCKER_CONTAINER) || \
docker run -d --name $(REDIS_DOCKER_CONTAINER) \
-p $(REDIS_PORT):$(REDIS_PORT_DOCKER) \
$(REDIS_DOCKER_CONTAINER_IMAGE)
.PHONY: redis_reset
redis_reset: redis_destroy redis_run ## Reset Redis
#
# ----- END REDIS TARGETS -----
#
#
# ----- START DB_DEV TARGETS -----
#
.PHONY: db_pull
db_pull: ## Pull db image
docker pull $(DB_DOCKER_CONTAINER_IMAGE)
.PHONY: db_dev_destroy
db_dev_destroy: ## Destroy Dev DB
ifndef CIRCLECI
@echo "Destroying the ${DB_DOCKER_CONTAINER_DEV} docker database container..."
docker rm -f $(DB_DOCKER_CONTAINER_DEV) || echo "No database container"
rm -fr mnt/db_dev # delete mount directory if exists
else
@echo "Relying on CircleCI's database setup to destroy the DB."
endif
.PHONY: db_dev_start
db_dev_start: ## Start Dev DB
ifndef CIRCLECI
brew services stop postgresql 2> /dev/null || true
endif
@echo "Starting the ${DB_DOCKER_CONTAINER_DEV} docker database container..."
# If running do nothing, if not running try to start, if can't start then run
docker start $(DB_DOCKER_CONTAINER_DEV) || \
docker run -d --name $(DB_DOCKER_CONTAINER_DEV) \
-e POSTGRES_PASSWORD=$(PGPASSWORD) \
-p $(DB_PORT_DEV):$(DB_PORT_DOCKER)\
$(DB_DOCKER_CONTAINER_IMAGE)
.PHONY: db_dev_create
db_dev_create: ## Create Dev DB
@echo "Create the ${DB_NAME_DEV} database..."
DB_NAME=postgres scripts/wait-for-db && DB_NAME=postgres psql-wrapper "CREATE DATABASE $(DB_NAME_DEV);" || true
.PHONY: db_dev_run
db_dev_run: db_dev_start db_dev_create ## Run Dev DB (start and create)
.PHONY: db_dev_reset
db_dev_reset: db_dev_destroy db_dev_run ## Reset Dev DB (destroy and run)
.PHONY: db_dev_migrate_standalone ## Migrate Dev DB directly
db_dev_migrate_standalone: bin/milmove
@echo "Migrating the ${DB_NAME_DEV} database..."
DB_DEBUG=0 bin/milmove migrate -p "file://migrations/${APPLICATION}/secure;file://migrations/${APPLICATION}/schema" -m "migrations/${APPLICATION}/migrations_manifest.txt"
.PHONY: db_dev_migrate
db_dev_migrate: db_dev_migrate_standalone ## Migrate Dev DB
.PHONY: db_dev_psql
db_dev_psql: ## Open PostgreSQL shell for Dev DB
scripts/psql-dev
.PHONY: db_dev_fresh
db_dev_fresh: check_app db_dev_reset db_dev_migrate ## Recreate dev db from scratch and populate with devseed data
@echo "Populate the ${DB_NAME_DEV} database..."
go run github.com/transcom/mymove/cmd/generate-test-data --named-scenario="dev_seed" --db-env="development" --named-sub-scenario="${DEVSEED_SUBSCENARIO}"
.PHONY: db_dev_truncate
db_dev_truncate: ## Truncate dev db
@echo "Truncate the ${DB_NAME_DEV} database..."
psql postgres://postgres:$(PGPASSWORD)@localhost:$(DB_PORT_DEV)/$(DB_NAME_DEV)?sslmode=disable -c 'TRUNCATE users CASCADE; TRUNCATE uploads CASCADE; TRUNCATE webhook_subscriptions CASCADE; TRUNCATE traffic_distribution_lists CASCADE'
.PHONY: db_dev_e2e_populate
db_dev_e2e_populate: check_app db_dev_migrate db_dev_truncate ## Migrate dev db and populate with devseed data
@echo "Populate the ${DB_NAME_DEV} database..."
go run github.com/transcom/mymove/cmd/generate-test-data --named-scenario="dev_seed" --db-env="development" --named-sub-scenario="${DEVSEED_SUBSCENARIO}"
## Alias for db_dev_bandwidth_up
## We started with `db_bandwidth_up`, which some folks are already using, and
## then renamed it to `db_dev_bandwidth_up`. To allow folks to keep using the
## name they're familiar with, we've added this alias to the renamed command.
.PHONY: db_bandwidth_up
db_bandwidth_up: db_dev_bandwidth_up
.PHONY: db_dev_bandwidth_up
db_dev_bandwidth_up: check_app bin/generate-test-data db_dev_truncate ## Truncate Dev DB and Generate data for bandwidth tests
@echo "Populate the ${DB_NAME_DEV} database..."
DB_PORT=$(DB_PORT_DEV) go run github.com/transcom/mymove/cmd/generate-test-data --named-scenario="bandwidth" --db-env="development"
#
# ----- END DB_DEV TARGETS -----
#
#
# ----- START DB_DEPLOYED_MIGRATIONS TARGETS -----
#
.PHONY: db_deployed_migrations_destroy
db_deployed_migrations_destroy: ## Destroy Deployed Migrations DB
ifndef CIRCLECI
@echo "Destroying the ${DB_DOCKER_CONTAINER_DEPLOYED_MIGRATIONS} docker database container..."
docker rm -f $(DB_DOCKER_CONTAINER_DEPLOYED_MIGRATIONS) || echo "No database container"
rm -fr mnt/db_deployed_migrations # delete mount directory if exists
else
@echo "Relying on CircleCI's database setup to destroy the DB."
endif
.PHONY: db_deployed_migrations_start
db_deployed_migrations_start: ## Start Deployed Migrations DB
ifndef CIRCLECI
brew services stop postgresql 2> /dev/null || true
endif
@echo "Starting the ${DB_DOCKER_CONTAINER_DEPLOYED_MIGRATIONS} docker database container..."
# If running do nothing, if not running try to start, if can't start then run
docker start $(DB_DOCKER_CONTAINER_DEPLOYED_MIGRATIONS) || \
docker run -d --name $(DB_DOCKER_CONTAINER_DEPLOYED_MIGRATIONS) \
-e POSTGRES_PASSWORD=$(PGPASSWORD) \
-p $(DB_PORT_DEPLOYED_MIGRATIONS):$(DB_PORT_DOCKER)\
$(DB_DOCKER_CONTAINER_IMAGE)
.PHONY: db_deployed_migrations_create
db_deployed_migrations_create: ## Create Deployed Migrations DB
@echo "Create the ${DB_NAME_DEPLOYED_MIGRATIONS} database..."
DB_NAME=postgres DB_PORT=$(DB_PORT_DEPLOYED_MIGRATIONS) scripts/wait-for-db && \
createdb -p $(DB_PORT_DEPLOYED_MIGRATIONS) -h localhost -U postgres $(DB_NAME_DEPLOYED_MIGRATIONS) || true
.PHONY: db_deployed_migrations_run
db_deployed_migrations_run: db_deployed_migrations_start db_deployed_migrations_create ## Run Deployed Migrations DB (start and create)
.PHONY: db_deployed_migrations_reset
db_deployed_migrations_reset: db_deployed_migrations_destroy db_deployed_migrations_run ## Reset Deployed Migrations DB (destroy and run)
.PHONY: db_deployed_migrations_migrate_standalone
db_deployed_migrations_migrate_standalone: bin/milmove ## Migrate Deployed Migrations DB with local secure migrations
@echo "Migrating the ${DB_NAME_DEPLOYED_MIGRATIONS} database..."
DB_DEBUG=0 DB_PORT=$(DB_PORT_DEPLOYED_MIGRATIONS) DB_NAME=$(DB_NAME_DEPLOYED_MIGRATIONS) bin/milmove migrate -p "file://migrations/${APPLICATION}/secure;file://migrations/${APPLICATION}/schema" -m "migrations/${APPLICATION}/migrations_manifest.txt"
.PHONY: db_deployed_migrations_migrate
db_deployed_migrations_migrate: db_deployed_migrations_migrate_standalone ## Migrate Deployed Migrations DB
.PHONY: db_deployed_psql
db_deployed_psql: ## Open PostgreSQL shell for Deployed Migrations DB
scripts/psql-deployed-migrations
#
# ----- END DB_DEPLOYED_MIGRATIONS TARGETS -----
#
#
# ----- START DB_TEST TARGETS -----
#
.PHONY: db_test_destroy
db_test_destroy: ## Destroy Test DB
ifndef CIRCLECI
@echo "Destroying the ${DB_DOCKER_CONTAINER_TEST} docker database container..."
docker rm -f $(DB_DOCKER_CONTAINER_TEST) || \
echo "No database container"
else
@echo "Relying on CircleCI's database setup to destroy the DB."
psql postgres://postgres:$(PGPASSWORD)@localhost:$(DB_PORT_TEST)?sslmode=disable -c 'DROP DATABASE IF EXISTS $(DB_NAME_TEST);'
endif
.PHONY: db_test_start
db_test_start: ## Start Test DB
ifndef CIRCLECI
brew services stop postgresql 2> /dev/null || true
@echo "Starting the ${DB_DOCKER_CONTAINER_TEST} docker database container..."
docker start $(DB_DOCKER_CONTAINER_TEST) || \
docker run --name $(DB_DOCKER_CONTAINER_TEST) \
-e \
POSTGRES_PASSWORD=$(PGPASSWORD) \
-d \
-p $(DB_PORT_TEST):$(DB_PORT_DOCKER)\
--mount type=tmpfs,destination=/var/lib/postgresql/data \
$(DB_DOCKER_CONTAINER_IMAGE)
else
@echo "Relying on CircleCI's database setup to start the DB."
endif
.PHONY: db_test_create
db_test_create: ## Create Test DB
ifndef CIRCLECI
@echo "Create the ${DB_NAME_TEST} database..."
DB_NAME=postgres DB_PORT=$(DB_PORT_TEST) scripts/wait-for-db && \
createdb -p $(DB_PORT_TEST) -h localhost -U postgres $(DB_NAME_TEST) || true
else
@echo "Relying on CircleCI's database setup to create the DB."
psql postgres://postgres:$(PGPASSWORD)@localhost:$(DB_PORT_TEST)?sslmode=disable -c 'CREATE DATABASE $(DB_NAME_TEST);'
endif
.PHONY: db_test_run
db_test_run: db_test_start db_test_create ## Run Test DB
.PHONY: db_test_reset
db_test_reset: db_test_destroy db_test_run ## Reset Test DB (destroy and run)
.PHONY: db_test_truncate
db_test_truncate:
@echo "Truncating ${DB_NAME_TEST} database..."
DB_PORT=$(DB_PORT_TEST) DB_NAME=$(DB_NAME_TEST) ./scripts/db-truncate
.PHONY: db_e2e_test_truncate
db_e2e_test_truncate:
@echo "Truncating ${DB_NAME_TEST} database for e2e tests..."
psql postgres://postgres:$(PGPASSWORD)@localhost:$(DB_PORT_TEST)/$(DB_NAME_TEST)?sslmode=disable -c 'TRUNCATE users CASCADE; TRUNCATE uploads CASCADE; TRUNCATE webhook_subscriptions CASCADE; TRUNCATE traffic_distribution_lists CASCADE'
.PHONY: db_test_migrate_standalone
db_test_migrate_standalone: bin/milmove ## Migrate Test DB directly
ifndef CIRCLECI
@echo "Migrating the ${DB_NAME_TEST} database..."
DB_DEBUG=0 DB_NAME=$(DB_NAME_TEST) DB_PORT=$(DB_PORT_TEST) bin/milmove migrate -p "file://migrations/${APPLICATION}/secure;file://migrations/${APPLICATION}/schema" -m "migrations/${APPLICATION}/migrations_manifest.txt"
else
@echo "Migrating the ${DB_NAME_TEST} database..."
DB_DEBUG=0 DB_NAME=$(DB_NAME_TEST) DB_PORT=$(DB_PORT_DEV) bin/milmove migrate -p "file://migrations/${APPLICATION}/secure;file://migrations/${APPLICATION}/schema" -m "migrations/${APPLICATION}/migrations_manifest.txt"
endif
.PHONY: db_test_migrate
db_test_migrate: db_test_migrate_standalone ## Migrate Test DB
.PHONY: db_test_migrations_build
db_test_migrations_build: .db_test_migrations_build.stamp ## Build Test DB Migrations Docker Image
.db_test_migrations_build.stamp:
@echo "Build the docker migration container..."
docker build -f Dockerfile.migrations_local --tag e2e_migrations:latest .
.PHONY: db_test_psql
db_test_psql: ## Open PostgreSQL shell for Test DB
scripts/psql-test
#
# ----- END DB_TEST TARGETS -----
#
#
# ----- START E2E TARGETS -----
#
.PHONY: e2e_test
e2e_test: db_test_migrate db_e2e_up ## Run e2e (end-to-end) integration tests
$(AWS_VAULT) ./scripts/run-e2e-test
.PHONY: e2e_test_fresh ## Build everything from scratch before running tests
e2e_test_fresh: bin/gin server_generate server_build client_build db_e2e_init
$(AWS_VAULT) ./scripts/run-e2e-test
.PHONY: e2e_mtls_test_docker
e2e_mtls_test_docker: ## Run e2e (end-to-end) integration tests with docker
$(AWS_VAULT) ./scripts/run-e2e-mtls-test-docker
.PHONY: e2e_test_docker
e2e_test_docker: ## Run e2e (end-to-end) integration tests with docker
$(AWS_VAULT) ./scripts/run-e2e-test-docker
.PHONY: e2e_test_docker_mymove
e2e_test_docker_mymove: ## Run e2e (end-to-end) Service Member integration tests with docker
$(AWS_VAULT) SPEC=cypress/integration/mymove/**/* ./scripts/run-e2e-test-docker
.PHONY: e2e_test_docker_office
e2e_test_docker_office: ## Run e2e (end-to-end) Office integration tests with docker
$(AWS_VAULT) SPEC=cypress/integration/office/**/* ./scripts/run-e2e-test-docker
.PHONY: e2e_test_docker_api
e2e_test_docker_api: ## Run e2e (end-to-end) API integration tests with docker
$(AWS_VAULT) SPEC=cypress/integration/api/**/* ./scripts/run-e2e-test-docker
.PHONY: e2e_clean
e2e_clean: ## Clean e2e (end-to-end) files and docker images
rm -f .*_linux.stamp
rm -rf cypress/results
rm -rf cypress/screenshots
rm -rf cypress/videos
rm -rf cypress/reports
docker rm -f cypress || true
.PHONY: db_e2e_up
db_e2e_up: check_app bin/generate-test-data db_e2e_test_truncate ## Truncate Test DB and Generate e2e (end-to-end) data
@echo "Populate the ${DB_NAME_TEST} database..."
DB_PORT=$(DB_PORT_TEST) go run github.com/transcom/mymove/cmd/generate-test-data --named-scenario="e2e_basic" --db-env="test"
.PHONY: rerun_e2e_tests_with_new_data
rerun_e2e_tests_with_new_data: db_e2e_up
$(AWS_VAULT) ./scripts/run-e2e-test
.PHONY: db_e2e_init
db_e2e_init: db_test_reset db_test_migrate redis_reset db_e2e_up ## Initialize e2e (end-to-end) DB (reset, migrate, up)
.PHONY: db_dev_e2e_backup
db_dev_e2e_backup: ## Backup Dev DB as 'e2e_dev'
DB_NAME=$(DB_NAME_DEV) DB_PORT=$(DB_PORT_DEV) ./scripts/db-backup e2e_dev
.PHONY: db_dev_e2e_restore
db_dev_e2e_restore: ## Restore Dev DB from 'e2e_dev'
DB_NAME=$(DB_NAME_DEV) DB_PORT=$(DB_PORT_DEV) ./scripts/db-restore e2e_dev
.PHONY: db_dev_e2e_cleanup
db_dev_e2e_cleanup: ## Clean up Dev DB backup `e2e_dev`
./scripts/db-cleanup e2e_dev
.PHONY: db_test_e2e_backup
db_test_e2e_backup: ## Backup Test DB as 'e2e_test'
DB_NAME=$(DB_NAME_TEST) DB_PORT=$(DB_PORT_TEST) ./scripts/db-backup e2e_test
.PHONY: db_test_e2e_restore
db_test_e2e_restore: ## Restore Test DB from 'e2e_test'
DB_NAME=$(DB_NAME_TEST) DB_PORT=$(DB_PORT_TEST) ./scripts/db-restore e2e_test
.PHONY: db_test_e2e_cleanup
db_test_e2e_cleanup: ## Clean up Test DB backup `e2e_test`
./scripts/db-cleanup e2e_test
#
# ----- END E2E TARGETS -----
#
#
# ----- START SCHEDULED TASK TARGETS -----
#
.PHONY: tasks_clean
tasks_clean: ## Clean Scheduled Task files and docker images
rm -f .db_test_migrations_build.stamp
docker rm -f tasks || true
.PHONY: tasks_build
tasks_build: server_generate bin/milmove-tasks ## Build Scheduled Task dependencies
.PHONY: tasks_build_docker
tasks_build_docker: server_generate bin/milmove-tasks ## Build Scheduled Task dependencies and Docker image
@echo "Build the docker scheduled tasks container..."
docker build -f Dockerfile.tasks --tag $(TASKS_DOCKER_CONTAINER):latest .
.PHONY: tasks_build_linux_docker
tasks_build_linux_docker: ## Build Scheduled Task binaries (linux) and Docker image (local)
@echo "Build the docker scheduled tasks container..."
docker build -f Dockerfile.tasks_local --tag $(TASKS_DOCKER_CONTAINER):latest .
.PHONY: tasks_connect_to_gex_via_sftp
tasks_connect_to_gex_via_sftp: tasks_build_linux_docker ## Run connect-to-gex-via-sftp from inside docker container
@echo "Connecting to GEX via SFTP with docker command..."
DB_NAME=$(DB_NAME_DEV) DB_DOCKER_CONTAINER=$(DB_DOCKER_CONTAINER_DEV) scripts/wait-for-db-docker
docker run \
-t \
-e DB_HOST="database" \
-e DB_NAME \
-e DB_PORT \
-e DB_USER \
-e DB_PASSWORD \
-e GEX_SFTP_HOST \
-e GEX_SFTP_HOST_KEY \
-e GEX_SFTP_IP_ADDRESS \
-e GEX_SFTP_PASSWORD \
-e GEX_SFTP_PORT \
-e GEX_SFTP_USER_ID \
--link="$(DB_DOCKER_CONTAINER_DEV):database" \
--rm \
$(TASKS_DOCKER_CONTAINER):latest \
milmove-tasks connect-to-gex-via-sftp
.PHONY: tasks_process_edis
tasks_process_edis: tasks_build_linux_docker ## Run process-edis from inside docker container
@echo "Processing EDIs with docker command..."
DB_NAME=$(DB_NAME_DEV) DB_DOCKER_CONTAINER=$(DB_DOCKER_CONTAINER_DEV) scripts/wait-for-db-docker
docker run \
-t \
-e DB_HOST="database" \
-e DB_NAME \
-e DB_PORT \
-e DB_USER \
-e DB_PASSWORD \
--link="$(DB_DOCKER_CONTAINER_DEV):database" \
--rm \
$(TASKS_DOCKER_CONTAINER):latest \
milmove-tasks process-edis
.PHONY: tasks_save_ghc_fuel_price_data
tasks_save_ghc_fuel_price_data: tasks_build_linux_docker ## Run save-ghc-fuel-price-data from inside docker container
@echo "Saving the fuel price data to the ${DB_NAME_DEV} database with docker command..."
DB_NAME=$(DB_NAME_DEV) DB_DOCKER_CONTAINER=$(DB_DOCKER_CONTAINER_DEV) scripts/wait-for-db-docker
docker run \
-t \
-e DB_HOST="database" \
-e DB_NAME \
-e DB_PORT \
-e DB_USER \
-e DB_PASSWORD \
-e EIA_KEY \
-e EIA_URL \
--link="$(DB_DOCKER_CONTAINER_DEV):database" \
--rm \
$(TASKS_DOCKER_CONTAINER):latest \
milmove-tasks save-ghc-fuel-price-data
tasks_send_post_move_survey: tasks_build_linux_docker ## Run send-post-move-survey from inside docker container
@echo "sending post move survey with docker command..."
DB_NAME=$(DB_NAME_DEV) DB_DOCKER_CONTAINER=$(DB_DOCKER_CONTAINER_DEV) scripts/wait-for-db-docker
docker run \
-t \
-e DB_HOST="database" \
-e DB_NAME \
-e DB_PORT \
-e DB_USER \
-e DB_PASSWORD \
--link="$(DB_DOCKER_CONTAINER_DEV):database" \
--rm \
$(TASKS_DOCKER_CONTAINER):latest \
milmove-tasks send-post-move-survey
tasks_send_payment_reminder: tasks_build_linux_docker ## Run send-payment-reminder from inside docker container
@echo "sending payment reminder with docker command..."
DB_NAME=$(DB_NAME_DEV) DB_DOCKER_CONTAINER=$(DB_DOCKER_CONTAINER_DEV) scripts/wait-for-db-docker
docker run \
-t \
-e DB_HOST="database" \
-e DB_NAME \
-e DB_PORT \
-e DB_USER \
-e DB_PASSWORD \
--link="$(DB_DOCKER_CONTAINER_DEV):database" \
--rm \
$(TASKS_DOCKER_CONTAINER):latest \
milmove-tasks send-payment-reminder
tasks_post_file_to_gex: tasks_build_linux_docker ## Run post-file-to-gex from inside docker container
@echo "sending payment reminder with docker command..."
DB_NAME=$(DB_NAME_DEV) DB_DOCKER_CONTAINER=$(DB_DOCKER_CONTAINER_DEV) scripts/wait-for-db-docker
docker run \
-t \
-e DB_HOST="database" \
-e DB_NAME \
-e DB_PORT \
-e DB_USER \
-e DB_PASSWORD \
--link="$(DB_DOCKER_CONTAINER_DEV):database" \
--rm \
$(TASKS_DOCKER_CONTAINER):latest \
milmove-tasks post-file-to-gex
#
# ----- END SCHEDULED TASK TARGETS -----
#
#
# ----- START Deployed MIGRATION TARGETS -----
#
.PHONY: run_prd_migrations
run_prd_migrations: bin/milmove db_deployed_migrations_reset ## Run GovCloud prd migrations against Deployed Migrations DB
@echo "Migrating the prd-migrations database with prd migrations..."
MIGRATION_PATH="s3://transcom-gov-milmove-prd-app-us-gov-west-1/secure-migrations;file://migrations/$(APPLICATION)/schema" \
DB_HOST=localhost \
DB_PORT=$(DB_PORT_DEPLOYED_MIGRATIONS) \
DB_NAME=$(DB_NAME_DEPLOYED_MIGRATIONS) \
DB_DEBUG=0 \
DISABLE_AWS_VAULT_WRAPPER=1 \
AWS_REGION=us-gov-west-1 \
aws-vault exec transcom-gov-milmove-prd \
bin/milmove migrate
.PHONY: run_stg_migrations
run_stg_migrations: bin/milmove db_deployed_migrations_reset ## Run GovCloud stg migrations against Deployed Migrations DB
@echo "Migrating the stg-migrations database with stg migrations..."
MIGRATION_PATH="s3://transcom-gov-milmove-stg-app-us-gov-west-1/secure-migrations;file://migrations/$(APPLICATION)/schema" \
DB_HOST=localhost \
DB_PORT=$(DB_PORT_DEPLOYED_MIGRATIONS) \
DB_NAME=$(DB_NAME_DEPLOYED_MIGRATIONS) \
DB_DEBUG=0 \
DISABLE_AWS_VAULT_WRAPPER=1 \
AWS_REGION=us-gov-west-1 \
aws-vault exec transcom-gov-milmove-stg \
bin/milmove migrate
.PHONY: run_exp_migrations
run_exp_migrations: bin/milmove db_deployed_migrations_reset ## Run GovCloud exp migrations against Deployed Migrations DB
@echo "Migrating the exp-migrations database with exp migrations..."
MIGRATION_PATH="s3://transcom-gov-milmove-exp-app-us-gov-west-1/secure-migrations;file://migrations/$(APPLICATION)/schema" \
DB_HOST=localhost \
DB_PORT=$(DB_PORT_DEPLOYED_MIGRATIONS) \
DB_NAME=$(DB_NAME_DEPLOYED_MIGRATIONS) \
DB_DEBUG=0 \
DISABLE_AWS_VAULT_WRAPPER=1 \
AWS_REGION=us-gov-west-1 \
aws-vault exec transcom-gov-milmove-exp \
bin/milmove migrate
.PHONY: run_demo_migrations
run_demo_migrations: bin/milmove db_deployed_migrations_reset ## Run GovCloud demo migrations against Deployed Migrations DB
@echo "Migrating the demo-migrations database with demo migrations..."
MIGRATION_PATH="s3://transcom-gov-milmove-demo-app-us-gov-west-1/secure-migrations;file://migrations/$(APPLICATION)/schema" \
DB_HOST=localhost \
DB_PORT=$(DB_PORT_DEPLOYED_MIGRATIONS) \
DB_NAME=$(DB_NAME_DEPLOYED_MIGRATIONS) \
DB_DEBUG=0 \
DISABLE_AWS_VAULT_WRAPPER=1 \
AWS_REGION=us-gov-west-1 \
aws-vault exec transcom-gov-milmove-demo \
bin/milmove migrate
#
# ----- END PROD_MIGRATION TARGETS -----
#
#
# ----- START WEBHOOK CLIENT TARGETS -----
#
.PHONY: webhook_client_docker
webhook_client_docker:
docker build -f Dockerfile.webhook_client_local -t $(WEBHOOK_CLIENT_DOCKER_CONTAINER):latest .
.PHONY: webhook_client_start_reset_db
webhook_client_start_reset_db: db_dev_e2e_populate webhook_client_start
.PHONY: webhook_client_start
webhook_client_start:
@echo "Starting the webhook client..."
# Note regarding the use of 172.17.0.1: the default network bridge in Docker is 172.17.0.1
# according to https://docs.docker.com/network/network-tutorial-standalone/. Based on Internet
# searches, this IP address seems to be fairly static. Therefore, this address can be used to
# serve as the IP address for various local hostnames used during testing. If this stops
# working some day, dynamic resolution may be required to look up the host.docker.internal IP.