-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathMakefile
212 lines (176 loc) · 9.02 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
.PHONY:build
build:
docker buildx build -t imranq2/node-fhir-server-mongo:local .
.PHONY:build_all
build_all:
docker buildx build --platform=linux/amd64,linux/arm64 -t imranq2/node-fhir-server-mongo:local .
.PHONY:publish
publish:
docker push imranq2/node-fhir-server-mongo:latest
.PHONY:up
up:
docker compose -f docker-compose.yml -p fhir-dev build --parallel && \
docker compose -p fhir-dev -f docker-compose.yml up --detach && \
echo "\nwaiting for Mongo server to become healthy" && \
while [ "`docker inspect --format {{.State.Health.Status}} fhir-dev-mongo-1`" != "healthy" ] && [ "`docker inspect --format {{.State.Health.Status}} fhir-dev-mongo-1`" != "unhealthy" ] && [ "`docker inspect --format {{.State.Status}} fhir-dev-mongo-1`" != "restarting" ]; do printf "." && sleep 2; done && \
if [ "`docker inspect --format {{.State.Health.Status}} fhir-dev-mongo-1`" != "healthy" ]; then docker ps && docker logs fhir-dev-mongo-1 && printf "========== ERROR: fhir-dev-mongo-1 did not start. Run docker logs fhir-dev-mongo-1 =========\n" && exit 1; fi
echo "\nwaiting for FHIR server to become healthy" && \
while [ "`docker inspect --format {{.State.Health.Status}} fhir-dev-fhir-1`" != "healthy" ] && [ "`docker inspect --format {{.State.Health.Status}} fhir-dev-fhir-1`" != "unhealthy" ] && [ "`docker inspect --format {{.State.Status}} fhir-dev-fhir-1`" != "restarting" ]; do printf "." && sleep 2; done && \
if [ "`docker inspect --format {{.State.Health.Status}} fhir-dev-fhir-1`" != "healthy" ]; then docker ps && docker logs fhir-dev-fhir-1 && printf "========== ERROR: fhir-dev-mongo-1 did not start. Run docker logs fhir-dev-fhir-1 =========\n" && exit 1; fi
echo FHIR server GraphQL: http://localhost:3000/\$$graphql && \
echo FHIR server Metrics: http://localhost:3000/metrics && \
echo Kafka UI: http://localhost:9000 && \
echo HAPI UI: http://localhost:3001/fhir/ && \
echo OpenSearch: http://admin:admin@localhost:9200/fhir_summaries/_search?pretty && \
echo FHIR server: http://localhost:3000
.PHONY:up-offline
up-offline:
docker compose -p fhir-dev -f docker-compose.yml up --detach && \
echo "\nwaiting for Mongo server to become healthy" && \
while [ "`docker inspect --format {{.State.Health.Status}} fhir-dev-mongo-1`" != "healthy" ] && [ "`docker inspect --format {{.State.Health.Status}} fhir-dev-mongo-1`" != "unhealthy" ] && [ "`docker inspect --format {{.State.Status}} fhir-dev-mongo-1`" != "restarting" ]; do printf "." && sleep 2; done && \
if [ "`docker inspect --format {{.State.Health.Status}} fhir-dev-mongo-1`" != "healthy" ]; then docker ps && docker logs fhir-dev-mongo-1 && printf "========== ERROR: fhir-dev-mongo-1 did not start. Run docker logs fhir-dev-mongo-1 =========\n" && exit 1; fi
echo "\nwaiting for FHIR server to become healthy" && \
while [ "`docker inspect --format {{.State.Health.Status}} fhir-dev-fhir-1`" != "healthy" ] && [ "`docker inspect --format {{.State.Health.Status}} fhir-dev-fhir-1`" != "unhealthy" ] && [ "`docker inspect --format {{.State.Status}} fhir-dev-fhir-1`" != "restarting" ]; do printf "." && sleep 2; done && \
if [ "`docker inspect --format {{.State.Health.Status}} fhir-dev-fhir-1`" != "healthy" ]; then docker ps && docker logs fhir-dev-fhir-1 && printf "========== ERROR: fhir-dev-mongo-1 did not start. Run docker logs fhir-dev-fhir-1 =========\n" && exit 1; fi
echo FHIR server GraphQL: http://localhost:3000/\$$graphql && \
echo FHIR server Metrics: http://localhost:3000/metrics && \
echo Kafka UI: http://localhost:9000 && \
echo HAPI UI: http://localhost:3001/fhir/ && \
echo OpenSearch: http://admin:admin@localhost:9200/fhir_summaries/_search?pretty && \
echo FHIR server: http://localhost:3000
.PHONY:down
down:
docker compose -p fhir-dev -f docker-compose.yml down && \
docker system prune -f
.PHONY:clean
clean: down
docker image rm imranq2/node-fhir-server-mongo -f
docker image rm node-fhir-server-mongo_fhir -f
docker volume rm fhir-dev_mongo_data -f
ifneq ($(shell docker volume ls | grep "fhir-dev"| awk '{print $$2}'),)
docker volume ls | grep "fhir-dev" | awk '{print $$2}' | xargs docker volume rm
endif
.PHONY:init
init:
brew update # update brew
#brew upgrade # upgrade all installed packages
brew install yarn
brew install kompose
#brew install nvm
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.39.1/install.sh | zsh
nvm install
make update
.PHONY:update
update:down
. ${NVM_DIR}/nvm.sh && nvm use && \
npm install --location=global yarn && \
rm -f yarn.lock && \
yarn install --no-optional
# https://www.npmjs.com/package/npm-check-updates
.PHONY:upgrade_packages
upgrade_packages:down
. ${NVM_DIR}/nvm.sh && nvm use && \
yarn install --no-optional && \
ncu -u --reject @sentry/node
.PHONY:tests
tests:
. ${NVM_DIR}/nvm.sh && nvm use && \
npm run test
.PHONY:test_shards
test_shards:
. ${NVM_DIR}/nvm.sh && nvm use && \
npm run test_shards
.PHONY:coverage
coverage:
. ${NVM_DIR}/nvm.sh && nvm use && \
npm run coverage
.PHONY:failed_tests
failed_tests:
. ${NVM_DIR}/nvm.sh && nvm use && \
npm run test:failed
.PHONY:specific_tests
specific_tests:
. ${NVM_DIR}/nvm.sh && nvm use && \
npm run test:specific
.PHONY:tests_integration
tests_integration:
. ${NVM_DIR}/nvm.sh && nvm use && \
npm run test:integration
.PHONY:tests_everything
tests_everything:
. ${NVM_DIR}/nvm.sh && nvm use && \
npm run test:everything
.PHONY:tests_graphql
tests_graphql:
. ${NVM_DIR}/nvm.sh && nvm use && \
npm run test:graphql
.PHONY:tests_search
tests_search:
. ${NVM_DIR}/nvm.sh && nvm use && \
npm run test:search
.PHONY:lint
lint:
. ${NVM_DIR}/nvm.sh && nvm use && \
npm run lint
.PHONY:fix-lint
fix-lint:
. ${NVM_DIR}/nvm.sh && nvm use && \
npm run fix_lint && \
npm run lint
.PHONY:generate
generate:
docker run --rm -it --name pythongenerator --mount type=bind,source="${PWD}"/src,target=/src python:3.8-slim-buster sh -c "pip install lxml jinja2 && python3 src/services/generate_services.py"
.PHONY:shell
shell: ## Brings up the bash shell in dev docker
docker compose -p fhir-dev -f docker-compose.yml run --rm --name fhir fhir /bin/sh
.PHONY:clean-pre-commit
clean-pre-commit: ## removes pre-commit hook
rm -f .git/hooks/pre-commit
.PHONY:setup-pre-commit
setup-pre-commit:
cp ./pre-commit-hook ./.git/hooks/pre-commit
.PHONY:run-pre-commit
run-pre-commit: setup-pre-commit
./.git/hooks/pre-commit
.PHONY:graphql
graphql:
. ${NVM_DIR}/nvm.sh && nvm use && \
docker run --rm -it --name pythongenerator --mount type=bind,source="${PWD}"/src,target=/src python:3.8-slim-buster sh -c "pip install lxml jinja2 && python3 src/fhir/generator/generate_graphql_classes.py" && \
graphql-schema-linter src/graphql/**/*.graphql && \
eslint --fix "src/graphql/**/*.js"
.PHONY:graphqlv2
graphqlv2:
. ${NVM_DIR}/nvm.sh && nvm use && \
docker run --rm -it --name pythongenerator --mount type=bind,source="${PWD}"/src,target=/src python:3.8-slim-buster sh -c "pip install lxml jinja2 && python3 src/fhir/generator/generate_graphqlv2_classes.py" && \
graphql-schema-linter src/graphqlv2/**/*.graphql && \
eslint --fix "src/graphqlv2/**/*.js"
.PHONY:classes
classes:
. ${NVM_DIR}/nvm.sh && nvm use && \
docker run --rm -it --name pythongenerator --mount type=bind,source="${PWD}"/src,target=/src python:3.8-slim-buster sh -c "pip install lxml jinja2 && python3 src/fhir/generator/generate_classes.py" && \
docker run --rm -it --name pythongenerator --mount type=bind,source="${PWD}"/src,target=/src python:3.8-slim-buster sh -c "pip install lxml jinja2 && python3 src/fhir/generator/generate_classes_index.py" && \
eslint --fix "src/fhir/classes/**/*.js"
.PHONY:searchParameters
searchParameters:
docker run --rm -it --name pythongenerator --mount type=bind,source="${PWD}"/src,target=/src python:3.8-slim-buster sh -c "pip install lxml jinja2 && python3 src/searchParameters/generate_search_parameters.py" && \
eslint --fix "src/middleware/fhir/resources/**/*.js" && \
eslint --fix "src/searchParameters/*.js"
.PHONY:audit_fix
audit_fix:
. ${NVM_DIR}/nvm.sh && nvm use && \
npm audit fix
.PHONY:qodana
qodana:
docker run --rm -it --name qodana --mount type=bind,source="${PWD}",target=/data/project -p 8080:8080 jetbrains/qodana-js:2022.3-eap --show-report
.PHONY:schema
schema:
docker run --rm -it --name pythongenerator --mount type=bind,source="${PWD}"/src,target=/src python:3.8-slim-buster sh -c "pip install lxml && python3 src/fhir/generator/generate_schema.py"
.PHONY:nonClinicalResourceFields
nonClinicalResourceFields:
docker run --rm -it --name pythongenerator --mount type=bind,source="${PWD}"/src,target=/src python:3.8-slim-buster sh -c "pip install lxml && python3 src/fhir/generator/generate_non_clinical_fields.py"
.PHONY:resourceFieldTypes
resourceFieldTypes:
docker run --rm -it --name pythongenerator --mount type=bind,source="${PWD}"/src,target=/src python:3.8-slim-buster sh -c "pip install lxml && python3 src/fhir/generator/generate_resource_fields_type.py"
.PHONY:dbSchema
dbSchema:
docker run --rm -it --name pythongenerator --mount type=bind,source="${PWD}"/src,target=/src python:3.8-slim-buster sh -c "pip install lxml && python3 src/fhir/generator/generate_db_schema.py"