-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-entrypoint.sh
More file actions
46 lines (41 loc) Β· 1.39 KB
/
docker-entrypoint.sh
File metadata and controls
46 lines (41 loc) Β· 1.39 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
46
#!/bin/bash
set -e
echo "π₯ Starting Life-as-Code Unified Web Portal"
echo "============================================"
echo
echo "π Checking database connection..."
python -c "
from src.database import check_db_connection, init_db
if check_db_connection():
print('β
Database connection successful')
init_db()
print('β
Database tables ready')
else:
print('β Database connection failed!')
exit(1)
"
echo "π Bootstrapping default admin user..."
python src/bootstrap_admin.py
echo
echo "π Starting unified web portal on http://0.0.0.0:8080"
echo "π‘ Access the dashboard in your browser at http://localhost:8080"
echo "π Use the sync buttons in the app to update your health data"
echo
# Start the web application with gunicorn (production WSGI server)
# Memory optimization:
# --workers 2: Reduced from 4 to halve memory footprint (~250MB saved)
# --threads 4: Maintain 8 concurrent requests capacity
# --max-requests 1000: Restart workers after 1000 requests to prevent memory leaks
# --max-requests-jitter 100: Randomize restart to avoid simultaneous worker restarts
# --preload: Load app once before fork, share memory via copy-on-write
exec gunicorn \
--bind 0.0.0.0:8080 \
--workers 2 \
--threads 4 \
--timeout 120 \
--max-requests 1000 \
--max-requests-jitter 100 \
--preload \
--access-logfile - \
--error-logfile - \
"src.app:server"