-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathlaunch_fub.sh
More file actions
executable file
·35 lines (26 loc) · 811 Bytes
/
launch_fub.sh
File metadata and controls
executable file
·35 lines (26 loc) · 811 Bytes
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
#!/bin/sh
# Copy of launch_daphne.sh just with fub django settings
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
cd "$SCRIPT_DIR/snapmerge"
# Function to gracefully stop Daphne
graceful_shutdown() {
echo "Received SIGTERM, gracefully shutting down Daphne..."
kill -TERM "$PID"
wait "$PID"
echo "Daphne gracefully stopped."
exit 0
}
# Trap SIGTERM signal and call graceful_shutdown function
trap 'graceful_shutdown' SIGTERM
# compress files
echo "Compressing files..."
python manage.py compress --settings=config.settings_fub
# Run migrations
echo "Apply migrations..."
python manage.py migrate --settings=config.settings_fub
# Start Daphne
export DJANGO_SETTINGS_MODULE=config.settings_fub
daphne -p 8000 -b 0.0.0.0 config.asgi:application &
PID=$!
# Wait for PID to exit
wait "$PID"