Lei Wai Lun
commited on
Commit
·
65429e7
1
Parent(s):
5567c09
fix: add start up
Browse files- .gitignore +3 -0
- app/startup.sh +47 -0
.gitignore
CHANGED
|
@@ -36,6 +36,9 @@ MANIFEST
|
|
| 36 |
pip-log.txt
|
| 37 |
pip-delete-this-directory.txt
|
| 38 |
|
|
|
|
|
|
|
|
|
|
| 39 |
# Unit test / coverage reports
|
| 40 |
htmlcov/
|
| 41 |
.tox/
|
|
|
|
| 36 |
pip-log.txt
|
| 37 |
pip-delete-this-directory.txt
|
| 38 |
|
| 39 |
+
#VS Code
|
| 40 |
+
.history/*
|
| 41 |
+
|
| 42 |
# Unit test / coverage reports
|
| 43 |
htmlcov/
|
| 44 |
.tox/
|
app/startup.sh
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
set -e
|
| 3 |
+
|
| 4 |
+
echo "=== Custom Startup Script ==="
|
| 5 |
+
echo "Working directory: $(pwd)"
|
| 6 |
+
echo "Contents of /home/site/wwwroot:"
|
| 7 |
+
ls -la /home/site/wwwroot
|
| 8 |
+
|
| 9 |
+
# Navigate to the app directory where your code actually is
|
| 10 |
+
cd /home/site/wwwroot/app || {
|
| 11 |
+
echo "ERROR: Cannot cd to /home/site/wwwroot/app"
|
| 12 |
+
echo "Directory structure:"
|
| 13 |
+
find /home/site/wwwroot -type d -maxdepth 2
|
| 14 |
+
exit 1
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
echo "Now in: $(pwd)"
|
| 18 |
+
echo "Contents:"
|
| 19 |
+
ls -la
|
| 20 |
+
|
| 21 |
+
# Verify packages are installed
|
| 22 |
+
echo "Checking for gunicorn and uvicorn..."
|
| 23 |
+
python -c "import gunicorn; print('gunicorn:', gunicorn.__version__)" || {
|
| 24 |
+
echo "ERROR: gunicorn not installed"
|
| 25 |
+
exit 1
|
| 26 |
+
}
|
| 27 |
+
python -c "import uvicorn; print('uvicorn:', uvicorn.__version__)" || {
|
| 28 |
+
echo "ERROR: uvicorn not installed"
|
| 29 |
+
exit 1
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
# Verify the app module exists
|
| 33 |
+
python -c "import app; print('app module found')" || {
|
| 34 |
+
echo "ERROR: Cannot import app module"
|
| 35 |
+
exit 1
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
echo "Starting gunicorn with uvicorn workers..."
|
| 39 |
+
exec gunicorn -k uvicorn.workers.UvicornWorker \
|
| 40 |
+
-w 2 \
|
| 41 |
+
-b 0.0.0.0:8000 \
|
| 42 |
+
--timeout 120 \
|
| 43 |
+
--graceful-timeout 120 \
|
| 44 |
+
--max-requests 1000 \
|
| 45 |
+
--max-requests-jitter 100 \
|
| 46 |
+
--preload \
|
| 47 |
+
app:app
|