-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathstart_server.sh
More file actions
executable file
·80 lines (75 loc) · 2.4 KB
/
start_server.sh
File metadata and controls
executable file
·80 lines (75 loc) · 2.4 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/bin/bash
# 20-questions server startup script with improved logging
# Set environment variables for better logging
export LOG_LEVEL=${LOG_LEVEL:-INFO}
export COLOR_LOGS=${COLOR_LOGS:-1}
export LOG_FILE=${LOG_FILE:-}
# Set up logging format for gunicorn
export PYTHONUNBUFFERED=1
echo "Starting 20-questions server with enhanced logging..."
echo "Log level: $LOG_LEVEL"
echo "Color logs: $COLOR_LOGS"
echo "Log file: ${LOG_FILE:-'(stdout/stderr only)'}"
# Start gunicorn with configuration file
exec gunicorn main:app \
--config gunicorn.conf.py \
--log-config-dict '{
"version": 1,
"disable_existing_loggers": false,
"formatters": {
"default": {
"format": "%(asctime)s [%(levelname)s] %(name)s:%(funcName)s:%(lineno)d - %(message)s"
},
"access": {
"format": "%(asctime)s [%(levelname)s] %(name)s - %(message)s"
}
},
"handlers": {
"console": {
"class": "logging.StreamHandler",
"formatter": "default",
"stream": "ext://sys.stdout"
},
"access_console": {
"class": "logging.StreamHandler",
"formatter": "access",
"stream": "ext://sys.stdout"
}
},
"loggers": {
"gunicorn": {
"level": "'$LOG_LEVEL'",
"handlers": ["console"],
"propagate": false
},
"gunicorn.access": {
"level": "'$LOG_LEVEL'",
"handlers": ["access_console"],
"propagate": false
},
"gunicorn.error": {
"level": "'$LOG_LEVEL'",
"handlers": ["console"],
"propagate": false
},
"uvicorn": {
"level": "'$LOG_LEVEL'",
"handlers": ["console"],
"propagate": false
},
"uvicorn.access": {
"level": "'$LOG_LEVEL'",
"handlers": ["access_console"],
"propagate": false
},
"uvicorn.error": {
"level": "'$LOG_LEVEL'",
"handlers": ["console"],
"propagate": false
}
},
"root": {
"level": "'$LOG_LEVEL'",
"handlers": ["console"]
}
}'