forked from pSpitzner/beets-flask
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentrypoint_dev.sh
executable file
·54 lines (40 loc) · 1.51 KB
/
entrypoint_dev.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
#!/bin/sh
whoami
id
pwd
cd /repo/frontend
# npm install
# npm run build:dev &
npm run dev &
# npm run build:watch &
cd /repo
NUM_WORKERS_PREVIEW=$(yq e '.gui.num_workers_preview' /home/beetle/.config/beets/config.yaml)
if ! [[ "$NUM_WORKERS_PREVIEW" =~ ^[0-9]+$ ]]; then
NUM_WORKERS_PREVIEW=4
fi
mkdir -p /repo/log
rm /repo/log/for_web.log >/dev/null 2>&1
rm /repo/frontend/vite.config.ts.timestamp-*.mjs >/dev/null 2>&1
export FLASK_ENV=development
export FLASK_DEBUG=1
# ------------------------------------------------------------------------------------ #
# start backend #
# ------------------------------------------------------------------------------------ #
# running the server from inside the backend dir makes imports and redis easier
cd /repo/backend
redis-server --daemonize yes
for i in $(seq 1 $NUM_WORKERS_PREVIEW)
do
rq worker preview --log-format "Preview worker $i: %(message)s" > /dev/null &
done
# imports are fast, because they use previously fetched previews. one worker should be enough.
NUM_WORKERS_IMPORT=1
for i in $(seq 1 $NUM_WORKERS_IMPORT)
do
rq worker import --log-format "Import worker $i: %(message)s" > /dev/null &
done
redis-cli FLUSHALL
# we need to run with one worker for socketio to work (but need at lesat threads for SSEs)
gunicorn --worker-class eventlet -w 1 --threads 32 --bind 0.0.0.0:5001 --reload 'main:create_app()'
# if we need to debug the continaer without running the webserver:
# tail -f /dev/null