-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Expand file tree
/
Copy pathentrypoint.sh
More file actions
36 lines (31 loc) · 1.1 KB
/
entrypoint.sh
File metadata and controls
36 lines (31 loc) · 1.1 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
#!/bin/bash
# Crawl4AI Docker Entrypoint
# Handles conditional embedded Redis startup based on CRAWL4AI_DISABLE_EMBEDDED_REDIS
set -e
# If CRAWL4AI_DISABLE_EMBEDDED_REDIS is set to true, modify supervisord.conf
# to remove the Redis program section
if [ "${CRAWL4AI_DISABLE_EMBEDDED_REDIS}" = "true" ]; then
echo "External Redis mode: Disabling embedded Redis server"
# Create a modified supervisord.conf without Redis
cat > /tmp/supervisord.conf << 'EOF'
[supervisord]
nodaemon=true
logfile=/dev/null
logfile_maxbytes=0
[program:gunicorn]
command=/usr/local/bin/gunicorn --bind 0.0.0.0:11235 --workers 1 --threads 4 --timeout 1800 --graceful-timeout 30 --keep-alive 300 --log-level info --worker-class uvicorn.workers.UvicornWorker server:app
directory=/app
user=appuser
autorestart=true
priority=20
environment=PYTHONUNBUFFERED=1
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
EOF
exec supervisord -c /tmp/supervisord.conf
else
# Default: use the original supervisord.conf with embedded Redis
exec supervisord -c supervisord.conf
fi