-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·64 lines (52 loc) · 1.04 KB
/
run.sh
File metadata and controls
executable file
·64 lines (52 loc) · 1.04 KB
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
#!/usr/bin/env bash
set -e
export PYTHONPATH=$PYTHONPATH:$(pwd)
run_uvicorn() {
set -x
# Uvicorn (ASGI)
exec uvicorn --host 0.0.0.0 --port $WEATHER_SRV_PORT 'src.main:create_app'
}
unittest() {
set -x
echo "Running unittests"
pytest --cov=src/ tests -vvv
rm -rf testing.sqlite
}
prodinit() {
set -x
echo "Production instance"
run_uvicorn
}
SELF="$0"
USAGE="$SELF <command>
Main entrypoint for operations and processes inside docker
container.
Commands:
Set up environment according to <profile>. Possible values for profile are:
prod:
- set environment variables
- run app with production server
test:
- set environment variables
- run unittests
"
CMD="$1"
if [ -n "$CMD" ]; then
shift
fi
case "$CMD" in
prod)
prodinit
;;
test)
unittest
;;
help|--help|-h)
echo "$USAGE"
;;
*)
echo "$USAGE" >&2
echo "Wrong invocation" >&2
exit 1
;;
esac