-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
106 lines (86 loc) · 4.79 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
XXXdoc: clean_doc
echo 'building docs…'
cd docs && sphinx-apidoc --force -M -P -e -o source/ ../enqueue
cd docs && make html
XXXclean_doc:
echo 'cleaning docs…'
cd docs && rm -f source/enqueue
cd docs && rm -f source/enqueue*.rst
dependencies:
pip3 install --upgrade pip
pip3 install --requirement requirements.txt
testDependencies:
pip3 install --upgrade pip
pip3 install --requirement test_requirements.txt
dependenciesTest:
pip3 install --upgrade pip
pip3 install --requirement test_requirements.txt
# NOTE: The following environment variables are expected to be set for testing:
# AWS_ACCESS_KEY_ID
# AWS_SECRET_ACCESS_KEY
checkEnvVariables:
@ if [ -z "${AWS_ACCESS_KEY_ID}" ]; then \
echo "Need to set AWS_ACCESS_KEY_ID"; \
exit 1; \
fi
@ if [ -z "${AWS_SECRET_ACCESS_KEY}" ]; then \
echo "Need to set AWS_SECRET_ACCESS_KEY"; \
exit 1; \
fi
# NOTE: The following environment variables are optional:
# REDIS_URL (can be omitted for testing if a local instance is running)
# DEBUG_MODE (can be set to any non-blank string to run in debug mode for testing)
# GRAPHITE_HOSTNAME (defaults to localhost if missing)
# QUEUE_PREFIX (defaults to '', set to dev- for testing)
test:
# You should have already installed the testDependencies before this
# To do individual tests:
# discover -s = start directory
# discover -p = filename pattern
# TEST_MODE="TEST" python3 -m unittest discover -s tests/linter_tests
# TEST_MODE="TEST" python3 -m unittest discover -p testXXX.py
TEST_MODE="TEST" python3 -m unittest discover -s tests/
info:
# Runs the rq info display with a one-second refresh
rq info --interval 1
runDev: checkEnvVariables
# This runs the rq job handler
# which removes and then processes jobs from the local redis dev- queue
QUEUE_PREFIX="dev-" rq worker --config rq_settings --name tX_Dev_Job_Handler
runDevDebug: checkEnvVariables
# This runs the rq job handler
# which removes and then processes jobs from the local redis dev- queue
# Without docker:
# QUEUE_PREFIX="dev-" REDIS_URL="redis://127.0.0.1:6379" DEBUG_MODE="true" rq worker --config rq_settings --name tX_Dev_Job_Handler
docker run -e QUEUE_PREFIX="dev-" -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY -e DEBUG_MODE=true -e REDIS_URL="redis://door43-enqueue-job_redis_1:6379" -e DCS_USER_TOKEN -v ${PWD}:/scripts --name tX_Dev_Job_Handler --rm --network "tx-net" python:3 /bin/bash -c "cd /scripts; pip install -r requirements.txt; rq worker --config rq_settings --name tX_Dev_Job_Handler"
runDevDebugPDF: checkEnvVariables
# This runs the rq job handler
# which removes and then processes jobs from the local redis dev- queue
# Without docker:
# QUEUE_PREFIX="dev-" REDIS_URL="redis://127.0.0.1:6379" DEBUG_MODE="true" rq worker --config rq_settings --name tX_Dev_HTML_Job_Handler
docker run -e QUEUE_PREFIX="dev-" -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY -e DEBUG_MODE=true -e REDIS_URL="redis://door43-enqueue-job_redis_1:6379" -e DCS_USER_TOKEN -v ${PWD}:/scripts --name tX_Dev_PDF_Job_Handler --rm --network "tx-net" python:3 /bin/bash -c "cd /scripts; pip install -r requirements.txt; rq worker --config rq_settings_pdf --name tX_Dev_PDF_Job_Handler"
run:
# This runs the rq job handler
# which removes and then processes jobs from the production redis queue
# TODO: Can the AWS redis url go in here (i.e., is it public)?
REDIS_URL="dadada" rq worker --config rq_settings --name tX_Job_Handler
imageDev:
docker build --file Dockerfile-developBranch --tag unfoldingword/tx_job_handler:develop .
imageMaster:
docker build --file Dockerfile-masterBranch --tag unfoldingword/tx_job_handler:master .
pushDevImage:
# Expects to be already logged into Docker, e.g., docker login -u $(DOCKER_USERNAME)
docker push unfoldingword/tx_job_handler:develop
pushMasterImage:
# Expects to be already logged into Docker, e.g., docker login -u $(DOCKER_USERNAME)
docker push unfoldingword/tx_job_handler:master
# NOTE: To test the container (assuming that the confidential environment variables are already set in the current environment) use:
# docker run --env AWS_ACCESS_KEY_ID --env AWS_SECRET_ACCESS_KEY --env QUEUE_PREFIX=dev- --env DEBUG_MODE=True --env REDIS_URL=<redis_url> --net="host" --name tx_job_handler --rm tx_job_handler
# NOTE: To run the container in production use with the desired values:
# docker run --env AWS_ACCESS_KEY_ID=<access_key> --env AWS_SECRET_ACCESS_KEY=<sa_key> --env GRAPHITE_HOSTNAME=<graphite_hostname> --env REDIS_URL=<redis_url> --net="host" --name tx_job_handler --rm tx_job_handler
connect:
# Gives a shell on the running container -- Note: no bash shell available
docker exec -it `docker inspect --format="{{.Id}}" tx_job_handler` sh
connectDev:
# Gives a shell on the running container
docker exec -it `docker inspect --format="{{.Id}}" tX_Dev_HTML_Job_Handler` bash