-
Notifications
You must be signed in to change notification settings - Fork 39
/
Makefile
168 lines (132 loc) · 4.98 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
#!make
#========================================================================#
# MDS Project Makefile
# Synopsis: This makefile acts as the main entrypoint for working with MDS
# Run 'make help' to start
#========================================================================#
# Determine OS
ifneq ($(OS),Windows_NT)
POSIXSHELL := 1
else
POSIXSHELL :=
endif
export ARCH:=$(shell uname -m)
ifeq ($(ARCH), arm64)
DC_FILE:=-f docker-compose.M1.yaml
else
DC_FILE:=-f docker-compose.yaml
endif
valid:
@echo "+\n++ Checking your development environment is valid ...\n+"
ifneq ($(POSIXSHELL),)
@./bin/validate.sh posix
else
@./bin/validate.sh windows
endif
lite:
@echo "+\n++ Building minimum topology for local dev ...\n+"
@docker compose $(DC_FILE) up -d frontend
rebuild:
@echo "+\n++ Rebuilding your current in-use containers ...\n+"
@./bin/rebuild.sh
all:
@echo "+\n++ Performing project build ...\n+"
@docker compose $(DC_FILE) build --force-rm --no-cache --parallel
@docker compose $(DC_FILE) up -d
be-rebuild:
@echo "+\n++ Rebuilding backend container ...\n+"
@docker compose $(DC_FILE) build --force-rm --no-cache --parallel backend
@docker compose $(DC_FILE) up -d backend
EXTRA_SERVICES?=
be-minimal:
@echo "+\n++ Starting minimal backend ...\n+"
@docker compose $(DC_FILE) up -d --no-deps postgres redis flyway document_manager_migrate $(EXTRA_SERVICES)
@docker compose $(DC_FILE) up -d --no-deps backend document_manager_backend
be:
@echo "+\n++ Starting backend ...\n+"
@docker compose $(DC_FILE) up -d backend
keycloak:
@docker compose $(DC_FILE) up -d keycloak
run-cypress-core:
cd services/core-web && npx cypress open
testbe:
@echo "+\n++ Running tests in backend container ...\n+"
@docker compose $(DC_FILE) exec backend pytest
testbe_folder:
@echo "+\n++ Running $f tests in backend container ...\n+"
@docker compose $(DC_FILE) exec backend pytest -s --disable-warnings tests/$f
testfe:
@echo "+\n++ Running tests in frontend container ...\n+"
@docker compose $(DC_FILE) exec frontend yarn test
testms:
@echo "+\n++ Running tests in minespace container ...\n+"
@docker compose $(DC_FILE) exec minespace yarn test
ms:
@echo "+\n++ Building minespace ...\n+"
@docker compose $(DC_FILE) up -d minespace
permits:
@echo "+\n++ Running Permit Service ...\n+"
@docker compose $(DC_FILE) up -d haystack haystack_celery
extra:
@echo "+\n++ Building tertiary services ...\n+"
@docker compose $(DC_FILE) up -d docgen-api filesystem_provider
# Simply for legacy support, this command will be retired shortly
fe:
@echo "+\n++ Removing frontend docker container and building local dev version ...\n+"
@docker compose $(DC_FILE) rm -f -v -s frontend
@rm -rf ./services/core-web/node_modules/
@cd ./services/core-web/; yarn; yarn serve; cd ..
db:
@echo "+\n++ Performing postgres build ...\n+"
@docker compose $(DC_FILE) up -d postgres flyway
cleandb:
@echo "+\n++ Cleaning database ...\n+"
@docker compose $(DC_FILE) stop postgres flyway
@docker compose $(DC_FILE) rm -f -v -s postgres flyway
@docker rmi -f mds_postgres mds_flyway
@docker volume rm mds_postgres_data -f
@docker compose $(DC_FILE) up -d postgres flyway
reglogin:
@echo "+\n++ Initiating Openshift registry login...\n+"
@./bin/registry-login.sh
mig:
@echo "+\n++ Applying migrations...\n+"
@docker compose $(DC_FILE) stop flyway
@docker compose $(DC_FILE) build --force-rm --no-cache flyway
@docker compose $(DC_FILE) up --always-recreate-deps --force-recreate -d flyway
ENTRIES?=2500
#TODO: unstable command - need to review relationship checks among factories
seeddb:
@echo "+\n++ Seeding db with factory data... # Entries: ${ENTRIES}\n+"
@docker compose $(DC_FILE) exec backend bash -c "flask create-data ${ENTRIES};"
env:
@echo "+\n++ Creating boilerplate local dev .env files...\n+"
@./bin/setenv.sh
stop:
@echo "+\n++ Stopping all containers...\n+"
@docker compose $(DC_FILE) down
clean: stop |
@echo "+\n++ Cleaning ...\n+"
@docker compose $(DC_FILE) rm -f -v -s
@docker rmi -f mds_postgres mds_backend mds_frontend mds_flyway
@docker volume rm mds_postgres_data -f
# Generates a migration file to support versioning of the specified table
# Usage: make generate_history_table_migration TABLE=<table_name>
generate_history_table_migration:
@echo "+\n++ Generating history table migration ...\n+"
@docker compose $(DC_FILE) exec backend bash -c "flask generate_history_table_migration $(TABLE)"
# Generates a migration file for the specified table
# Usage: make generate_migration TABLE=<table_name>
generate_table_migration:
@echo "+\n++ Generating history table migration ...\n+"
@docker compose $(DC_FILE) exec backend bash -c "flask generate_table_migration $(TABLE)"
# initial project setup for local/codespaces development
init:
@./bin/setup_codespaces.sh
# builds BE & serves up FE in background
# CODESPACES NOTE: Currently in codespaces, if the containers are running
# but the CS has been paused, must run `make stop` before `make be` or `make restart`
restart:
@./bin/restart_codespaces.sh
help:
@./bin/help.sh