-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
136 lines (111 loc) · 5.97 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
REG=100225593120.dkr.ecr.us-east-1.amazonaws.com
TAG=latest
ifdef ENV_FILE
include ${ENV_FILE}
else
ENV_FILE=.env
endif
ifndef ALEMBIC_COMMENT
ALEMBIC_COMMENT=""
endif
login-ecr:
docker run -v ~/.aws/credentials:/root/.aws/credentials --rm -it amazon/aws-cli ecr get-login-password | docker login --username AWS --password-stdin ${REG}
build:
docker compose build
run-flake8:
docker-compose --env-file .env.test down -v
docker-compose --env-file .env.test run -v ${PWD}:/workdir test_runner /bin/bash -c "python3 -m flake8 agr_literature_service"
docker-compose --env-file .env.test down -v
run-local-flake8:
python3 -m flake8 .
run-mypy:
docker-compose --env-file .env.test down -v
docker-compose --env-file .env.test run -v ${PWD}:/workdir test_runner /bin/bash -c "mypy --config-file mypy.config agr_literature_service"
docker-compose --env-file .env.test down -v
run-local-mypy:
mypy --config-file mypy.config .
run-dev-bash:
docker-compose --env-file .env.test up -d postgres
docker-compose --env-file .env.test run --service-ports --rm dev_app /bin/bash
run-dev-zsh:
docker-compose --env-file .env.test up -d postgres
docker-compose --env-file .env.test run --service-ports --rm -v "${HOME}/.vimrc:/root/.vimrc:rw" -v "${HOME}/.zshrc:/root/.zshrc:rw" -v ${PWD}:/workdir dev_app /bin/zsh
docker-compose-up:
docker run -itd --env-file=.env -v /var/run/docker.sock:/var/run/docker.sock -v /home/core/.docker:/root/.docker -v ${PWD}:/var/tmp/ docker/compose:1.24.1 -f /var/tmp/docker-compose.yaml up -d
docker-compose-down:
docker run -itd --env-file=.env -v /var/run/docker.sock:/var/run/docker.sock -v /home/core/.docker:/root/.docker -v ${PWD}:/var/tmp/ docker/compose:1.24.1 -f /var/tmp/docker-compose.yaml down
run-test-bash:
docker-compose --env-file .env.test down
docker-compose --env-file .env.test rm -svf elasticsearch
docker-compose --env-file .env.test up -d postgres
sleep 5
docker compose --env-file .env.test build test_runner
docker compose --env-file .env.test build dev_app
docker compose --env-file .env.test run --rm dev_app sh tests/init_test_db.sh
docker compose --env-file .env.test up -d elasticsearch
sleep 10
-docker-compose --env-file .env.test run -v ${PWD}:/workdir test_runner ./run_tests.sh > pytest.out
#doing here after shutdown of database
python3 check_tests.py
docker compose --env-file .env.test down
run-functest:
docker compose --env-file .env.test down
docker compose --env-file .env.test up -d postgres
sleep 5
docker compose --env-file .env.test build test_runner
docker compose --env-file .env.test build dev_app
docker compose --env-file .env.test run --rm dev_app sh tests/init_test_db.sh
docker compose --env-file .env.test run test_runner python3 agr_literature_service/lit_processing/tests/functional_tests.py
docker compose --env-file .env.test down
restart-debezium-local:
docker-compose --env-file ${ENV_FILE} rm -svf dbz_connector dbz_kafka dbz_zookeeper dbz_ksql_server
docker-compose --env-file ${ENV_FILE} up -d postgres
sleep 5
docker-compose --env-file ${ENV_FILE} up -d elasticsearch
sleep 10
docker-compose --env-file ${ENV_FILE} up -d dbz_zookeeper dbz_kafka dbz_connector
sleep 10
docker-compose --env-file ${ENV_FILE} exec dbz_connector bash -c "/kafka/bin/kafka-topics.sh --create --topic 'abc.public.obsolete_reference_curie' --partitions 1 --replication-factor 1 --bootstrap-server dbz_kafka:9092"
sleep 5
docker-compose --env-file ${ENV_FILE} up -d dbz_ksql_server
sleep 20
docker-compose --env-file ${ENV_FILE} up -d --build dbz_setup
restart-debezium-aws:
docker-compose --env-file ${ENV_FILE} rm -svf dbz_connector dbz_kafka dbz_zookeeper dbz_ksql_server dbz_setup
docker-compose --env-file ${ENV_FILE} up -d dbz_zookeeper dbz_kafka dbz_connector
sleep 10
docker-compose --env-file ${ENV_FILE} exec dbz_connector bash -c "/kafka/bin/kafka-topics.sh --create --topic 'abc.public.obsolete_reference_curie' --partitions 1 --replication-factor 1 --bootstrap-server dbz_kafka:9092"
sleep 5
docker-compose --env-file ${ENV_FILE} up -d dbz_ksql_server
sleep 20
docker-compose --env-file ${ENV_FILE} up -d --build dbz_setup
stop-debezium:
docker-compose --env-file ${ENV_FILE} rm -svf dbz_connector dbz_kafka dbz_zookeeper dbz_ksql_server dbz_setup
restart-api:
docker-compose --env-file ${ENV_FILE} build --no-cache api
docker-compose --env-file ${ENV_FILE} rm -s -f api
docker-compose --env-file ${ENV_FILE} up -d api
restart-api-and-automated-scripts:
docker-compose --env-file ${ENV_FILE} build --no-cache api
docker-compose --env-file ${ENV_FILE} rm -s -f api
docker-compose --env-file ${ENV_FILE} up -d api
docker-compose --env-file ${ENV_FILE} build --no-cache automated_scripts
docker-compose --env-file ${ENV_FILE} rm -s -f automated_scripts
docker-compose --env-file ${ENV_FILE} up --build -d automated_scripts
alembic-create-migration:
docker-compose --env-file ${ENV_FILE} run --service-ports --rm dev_app alembic revision --autogenerate -m "${ALEMBIC_COMMENT}"
docker-compose --env-file ${ENV_FILE} run --service-ports --rm dev_app bash -c "chmod -R o+w alembic/versions"
alembic-apply-latest-migration:
docker-compose --env-file ${ENV_FILE} rm -svf dbz_connector dbz_kafka dbz_zookeeper dbz_ksql_server dbz_setup
docker-compose --env-file ${ENV_FILE} rm -s -f api
docker-compose --env-file ${ENV_FILE} build dev_app
docker-compose --env-file ${ENV_FILE} run --service-ports --rm dev_app alembic upgrade head
$(MAKE) ENV_FILE=${ENV_FILE} restart-api-and-automated-scripts
$(MAKE) ENV_FILE=${ENV_FILE} restart-debezium-aws
restart-automated-scripts:
docker-compose --env-file ${ENV_FILE} rm -s -f automated_scripts
docker-compose --env-file ${ENV_FILE} up --build -d automated_scripts
bulk_upload_reference_files:
docker-compose --env-file ${ENV_FILE} run --rm -v $(local_folder):/usr/files_to_upload/ file_uploader upload_files $(mod_abbreviation)
dump_prod_locally:
docker-compose --env-file ${ENV_FILE} run --service-ports --rm dev_app python3 agr_literature_service/lit_processing/data_export/dump_database.py -t ondemand