forked from RedHatInsights/vmaas
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentrypoint.sh
More file actions
executable file
·45 lines (39 loc) · 1.45 KB
/
entrypoint.sh
File metadata and controls
executable file
·45 lines (39 loc) · 1.45 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
#!/bin/sh
public_port () {
python3.12 -c "import os;import app_common_python as a;print(a.LoadedConfig.publicPort or os.getenv('BIND_PUBLIC_PORT', '8000'))"
}
private_port () {
python3.12 -c "import os;import app_common_python as a;print(a.LoadedConfig.privatePort or os.getenv('BIND_PRIVATE_PORT', '10000'))"
}
if [[ "$#" == "0" ]]; then
echo "Please specify service name as the first argument."
exit 1
fi
cd "$(dirname "$0")"
if [[ "$1" == "database-upgrade" ]]; then
set -e
python3.12 -m vmaas.common.wait_for_services python3.12 -m vmaas.reposcan.database.upgrade
shift
fi
if [[ ! -z $1 ]]; then
if [[ "$1" == "webapp" ]]; then
cd vmaas/webapp
port=$(public_port)
[[ ! -z $QE_BUILD ]] && cmd="sleep infinity" || cmd="uvicorn --host 0.0.0.0 --port $port --no-access-log main:app"
exec python3.12 -m vmaas.common.wait_for_services $cmd
elif [[ "$1" == "webapp-go" ]]; then
cd go/src/vmaas
exec ./main webapp
elif [[ "$1" == "reposcan" ]]; then
cd vmaas/reposcan
port=$(private_port)
cat nginx.conf.template | sed "s/_PORT_/$port/g" > /tmp/nginx.conf
nginx -c /tmp/nginx.conf
port=$(public_port)
exec python3.12 -m vmaas.common.wait_for_services uvicorn --host 0.0.0.0 --port $port --no-access-log main:app
elif [[ "$1" == "sleep" ]]; then
# "developer" mode
echo "Sleeping ..."
exec sleep infinity
fi
fi