forked from mozilla-services/server-syncstorage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-entrypoint.sh
executable file
·68 lines (55 loc) · 1.62 KB
/
docker-entrypoint.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
#!/bin/sh
cd $(dirname $0)
case "$1" in
server)
shift
_SETTINGS_FILE=${SYNC_SETTINGS_FILE:-"/app/example.ini"}
if [ ! -e $_SETTINGS_FILE ]; then
echo "Could not find ini file: $_SETTINGS_FILE"
exit 1
fi
echo "Starting gunicorn with config: $_SETTINGS_FILE"
exec gunicorn \
--paste "$_SETTINGS_FILE" \
--bind "${HOST-127.0.0.1}:${PORT-8000}" \
--worker-class "${WORKER_CLASS-sync}" \
--timeout "${SYNC_TIMEOUT-600}" \
--workers "${WEB_CONCURRENCY-1}" \
--graceful-timeout "${SYNC_GRACEFUL_TIMEOUT-660}" \
--max-requests "${SYNC_MAX_REQUESTS-5000}" \
--log-config "$_SETTINGS_FILE" \
"$@"
;;
test_all)
$0 test_flake8
$0 test_nose
$0 test_functional
;;
test_flake8)
echo "test - flake8"
flake8 syncstorage
;;
test_nose)
echo "test - nose"
nosetests --verbose --nocapture syncstorage/tests
;;
test_functional)
echo "test - functional"
# run functional tests
export MOZSVC_SQLURI=sqlite:///:memory:
gunicorn --paste ./syncstorage/tests/tests.ini \
--workers 1 \
--worker-class mozsvc.gunicorn_worker.MozSvcGeventWorker &
SERVER_PID=$!
sleep 2
$0 test_endpoint http://localhost:5000
kill $SERVER_PID
;;
test_endpoint)
exec python syncstorage/tests/functional/test_storage.py $2
;;
*)
echo "Unknown CMD, $1"
exit 1
;;
esac