-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-entrypoint.sh
executable file
·38 lines (33 loc) · 1.1 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
#!/bin/sh
set -e
# Wait for required services based on Cuckoo's configuration files
/check_required_services.py
if [ "$?" -eq 1 ]; then
exit 1
fi
# Incredibly, Cuckoo has a race condition when it creates the database template:
# https://github.com/cuckoosandbox/cuckoo/issues/1516
# We must make sure Cuckoo daemon ends its stuff before launching Web and API services
/check_resultserver.py
if [ "$?" -eq 1 ]; then
exit 1
fi
# Change the ownership of /cuckoo to cuckoo, but exclude configuration files
chown -R cuckoo:cuckoo $(ls /cuckoo/ | awk '{if($1 != "conf"){ print $1 }}') /tmp/ && chown cuckoo:cuckoo /cuckoo
# Launch the actual stuff
case "$1" in
web )
/usr/sbin/uwsgi --socket 127.0.0.1:${PORT:=8001} \
--master --enable-threads \
--processes ${UWSGI_PROCESSES:=1} \
--threads ${UWSGI_THREADS:=1} \
--ini /etc/uwsgi/apps-enabled/cuckoo-web.ini
;;
api )
/usr/sbin/uwsgi --socket 127.0.0.1:${PORT:=8002} \
--master --enable-threads \
--processes ${UWSGI_PROCESSES:=1} \
--threads ${UWSGI_THREADS:=1} \
--ini /etc/uwsgi/apps-enabled/cuckoo-api.ini
;;
esac