-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathdocker-entrypoint.sh
More file actions
executable file
Β·44 lines (36 loc) Β· 1.25 KB
/
Copy pathdocker-entrypoint.sh
File metadata and controls
executable file
Β·44 lines (36 loc) Β· 1.25 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
#!/bin/bash
set -e # exit as soon as a command fails
# 1. Conditionally start local Redis only if REDIS_URL is not set.
if [ -z "$REDIS_URL" ]; then
echo "π₯ Starting local Redis (no REDIS_URL detected)."
redis-server --daemonize yes
else
echo "REDIS_URL is set ($REDIS_URL). Skipping local Redis."
fi
cd backend
# Activate your virtual environment
source .venv/bin/activate
echo "πββοΈ Running migrations"
python -m alembic upgrade head
echo "β΅οΈ Launching Arq worker"
arq app.tasks.worker.WorkerSettings &
# 3. Check for Home Assistant Ingress
if [ -n "$HASSIO_TOKEN" ]; then
echo "π¦ Detected HASSIO_TOKEN -> Running two uvicorns: public (8989) + ingress (8990)"
# Public server on port 8989 in background
echo "π Launching HASSIO_RUN_MODE=public uvicorn on port 8989"
HASSIO_RUN_MODE="public" uvicorn app.fastapi:app \
--host 0.0.0.0 \
--port 8989 &
# Ingress server on port 8990 in foreground
echo "π Launching HASSIO_RUN_MODE=ingress uvicorn on port 8990"
HASSIO_RUN_MODE="ingress" uvicorn app.fastapi:app \
--host 0.0.0.0 \
--port 8990
else
# No Ingress: single server on port 8989
echo "π¦ Launching uvicorn on port 8989"
uvicorn app.fastapi:app \
--host 0.0.0.0 \
--port 8989
fi