-
Notifications
You must be signed in to change notification settings - Fork 1
/
entry.sh
41 lines (36 loc) · 1.27 KB
/
entry.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
#!/bin/bash
# This script is the entrypoint for the Tapis Pods Service containers.
# api, health, and spawner. If any of these break, the script will sleep for 60 and exit
# with a non-zero exit code. This will cause the container to restart in Kubernetes.
# Set DEBUG_SLEEP_LOOP to "true" to keep the container running for debugging.
if [ $PODS_COMPONENT = "api" ]; then
# Write openapi.json to /home/tapis/docs/
python3 -u /home/tapis/service/auto_openapi_writer.py
# Set up stores during init.
python3 -u /home/tapis/service/stores.py
# Start API
cd /home/tapis/service; uvicorn api:api --reload --host 0.0.0.0 --port 8000
# prod - https://www.uvicorn.org/deployment/
# gunicorn uvicorn.worker stuff
elif [ $PODS_COMPONENT = "health" ]; then
# Start health
python3 -u /home/tapis/service/health.py
elif [ $PODS_COMPONENT = "health-central" ]; then
# Start health
python3 -u /home/tapis/service/health_central.py
elif [ $PODS_COMPONENT = "spawner" ]; then
# Start spawner
python3 -u /home/tapis/service/spawner.py
else
echo "entry.sh requires PODS_COMPONENT env var to be set, could not find component match."
fi
if [ "$DEBUG_SLEEP_LOOP" == "true" ]
then
while true
do
sleep 86400
done
else
sleep 60
exit 1
fi