forked from totallylegitco/fighthealthinsurance
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_local.sh
executable file
·78 lines (61 loc) · 2.05 KB
/
run_local.sh
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
#!/bin/bash
JS_PATH=fighthealthinsurance/static/js
python -c 'import configurations' 2>&1>/dev/null
python_dep_check=$?
pushd "${JS_PATH}"
npm ls 2>&1>/dev/null
npm_dep_check=$?
popd
if [ ${python_dep_check} != 0 ]; then
set +x
printf 'Python dependencies may be missing. Please install dependencies via:\n' >/dev/stderr
printf 'pip install -r requirements.txt\n' >/dev/stderr
exit 1
fi
set -ex
python min_version.py
package_command=''
# Are we sort of connected to the backend?
if kubectl get service -n totallylegitco vllm-health-svc; then
export HEALTH_BACKEND_PORT=4280
export HEALTH_BACKEND_HOST=localhost
kubectl port-forward -n totallylegitco service/vllm-health-svc 4280:80 &
else
echo 'No connection to kube vllm health svc'
fi
echo "Setup to use $HEALTH_BACKEND_HOST:$HEALTH_BACKEND_PORT"
if command -v apt-get; then
package_command="apt-get install -y"
elif command -v brew; then
package_command="brew install"
fi
install_package() {
package_name=$1
${package_command} ${package_name} || sudo ${package_command} ${package_name} || \
(printf 'Can not install %s. Please install it manually.\n' ${package_name} >/dev/stderr && \
exit 1)
}
if ! command -v tesseract &> /dev/null; then
# We need either the tesseract-ocr package OR easyocr
install_package tesseract-ocr || pip install easyocr
fi
if [ ! -f "cert.pem" ]; then
if ! command -v mkcert &> /dev/null; then
install_package mkcert
fi
mkcert -cert-file cert.pem -key-file key.pem localhost 127.0.0.1
fi
pushd "${JS_PATH}"
if [ ${npm_dep_check} != 0 ]; then
npm i || echo "Can't install?" >/dev/stderr
fi
npm run build
popd
python manage.py migrate
python manage.py loaddata initial
python manage.py loaddata followup
python manage.py loaddata plan_source
# Make sure we have an admin user so folks can test the admin view
FIGHT_HEALTH_ADMIN_USER="admin" FIGHT_HEALTH_ADMIN_PASSWORD="admin" python manage.py ensure_adminuser --no-input
RECAPTCHA_TESTING=true OAUTHLIB_RELAX_TOKEN_SCOPE=1 \
python manage.py runserver_plus --cert-file cert.pem --key-file key.pem $@