Skip to content

Commit d202864

Browse files
Improve Vacation Planner Implementation (#93)
* Improve Vacation Planner Implementation * Add gunicorn.conf.py to zip file
1 parent 3ef4102 commit d202864

19 files changed

Lines changed: 100 additions & 28 deletions

File tree

samples/web-app-cosmosdb-mongodb-api/python/bicep/deploy.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ fi
134134

135135
# Create the zip package of the web app
136136
echo "Creating zip package of the web app..."
137-
zip -r "$ZIPFILE" app.py mongodb.py static templates requirements.txt
137+
zip -r "$ZIPFILE" app.py mongodb.py gunicorn.conf.py static templates requirements.txt
138138

139139
# Deploy the web app
140140
# Deploy the web app

samples/web-app-cosmosdb-mongodb-api/python/scripts/deploy.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -919,7 +919,7 @@ fi
919919

920920
# Create the zip package of the web app
921921
echo "Creating zip package of the web app..."
922-
zip -r "$ZIPFILE" app.py mongodb.py static templates requirements.txt
922+
zip -r "$ZIPFILE" app.py mongodb.py gunicorn.conf.py static templates requirements.txt
923923

924924
# List the contents of the zip package
925925
echo "Contents of the zip package [$ZIPFILE]:"
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import os
2+
3+
4+
def worker_int(worker):
5+
# SIGINT (Ctrl+C) default path raises SystemExit inside the worker's recv()
6+
# loop, dumping a traceback through gunicorn's HTTP parser frames. os._exit
7+
# short-circuits the unwind for a clean foreground stop. SIGTERM (graceful)
8+
# is unaffected — it goes through a different code path.
9+
os._exit(0)
10+
11+
12+
def worker_abort(worker):
13+
# SIGABRT is what the arbiter sends when a worker misses its heartbeat
14+
# ([CRITICAL] WORKER TIMEOUT). The default handler does sys.exit(1), which
15+
# unwinds through the same recv() stack as SIGINT and prints a misleading
16+
# traceback. The WORKER TIMEOUT log line above it is the real diagnostic;
17+
# exit at the C level to suppress the spurious trace.
18+
os._exit(1)
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Flask==3.1.3
2-
azure-identity==1.25.1
3-
pymongo==4.15.3
4-
gunicorn==23.0.0
5-
python-dotenv==1.2.2
2+
azure-identity==1.25.3
3+
pymongo==4.17.0
4+
gunicorn==26.0.0
5+
python-dotenv==1.2.2

samples/web-app-cosmosdb-mongodb-api/python/terraform/deploy.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ fi
6161

6262
# Create the zip package of the web app
6363
echo "Creating zip package of the web app..."
64-
zip -r "$ZIPFILE" app.py mongodb.py static templates requirements.txt
64+
zip -r "$ZIPFILE" app.py mongodb.py gunicorn.conf.py static templates requirements.txt
6565

6666
# Deploy the web app
6767
# Deploy the web app

samples/web-app-cosmosdb-nosql-api/python/scripts/deploy.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ fi
108108

109109
# Create the zip package of the web app
110110
echo "Creating zip package of the web app..."
111-
zip -r "$ZIPFILE" app.py cosmosdb_client.py static templates requirements.txt
111+
zip -r "$ZIPFILE" app.py cosmosdb_client.py gunicorn.conf.py static templates requirements.txt
112112

113113
# Deploy the web app
114114
echo "Deploying web app [$WEB_APP_NAME] with zip file [$ZIPFILE]..."
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import os
2+
3+
4+
def worker_int(worker):
5+
# SIGINT (Ctrl+C) default path raises SystemExit inside the worker's recv()
6+
# loop, dumping a traceback through gunicorn's HTTP parser frames. os._exit
7+
# short-circuits the unwind for a clean foreground stop. SIGTERM (graceful)
8+
# is unaffected — it goes through a different code path.
9+
os._exit(0)
10+
11+
12+
def worker_abort(worker):
13+
# SIGABRT is what the arbiter sends when a worker misses its heartbeat
14+
# ([CRITICAL] WORKER TIMEOUT). The default handler does sys.exit(1), which
15+
# unwinds through the same recv() stack as SIGINT and prints a misleading
16+
# traceback. The WORKER TIMEOUT log line above it is the real diagnostic;
17+
# exit at the C level to suppress the spurious trace.
18+
os._exit(1)
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Flask==3.1.3
2-
azure-mgmt-cosmosdb==9.8.0
3-
azure-cosmos==4.7.0
4-
gunicorn==22.0.0
2+
azure-mgmt-cosmosdb==9.9.0
3+
azure-cosmos==4.15.0
4+
gunicorn==26.0.0
55
python-dotenv==1.2.2
6-
setuptools==79.0.1
6+
setuptools==82.0.1

samples/web-app-managed-identity/python/bicep/deploy.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ fi
129129

130130
# Create the zip package of the web app
131131
echo "Creating zip package of the web app..."
132-
zip -r "$ZIPFILE" app.py requirements.txt static templates
132+
zip -r "$ZIPFILE" app.py gunicorn.conf.py requirements.txt static templates
133133

134134
# Deploy the web app
135135
echo "Deploying web app [$WEB_APP_NAME] with zip file [$ZIPFILE]..."

samples/web-app-managed-identity/python/scripts/system-assigned.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ fi
248248

249249
# Create the zip package of the web app
250250
echo "Creating zip package of the web app..."
251-
zip -r "$ZIPFILE" app.py requirements.txt static templates
251+
zip -r "$ZIPFILE" app.py gunicorn.conf.py requirements.txt static templates
252252

253253
# Deploy the web app
254254
echo "Deploying web app [$WEB_APP_NAME] with zip file [$ZIPFILE]..."

0 commit comments

Comments
 (0)