1+ services :
2+ ray-head :
3+ build : .
4+ container_name : ray-head
5+ ports :
6+ - " 8000:8000" # FastAPI backend
7+ - " 8501:8501" # Streamlit frontend
8+ - " 6379:6379" # Ray head port
9+ environment :
10+ - RAY_DISABLE_IMPORT_WARNING=1
11+ - STREAMLIT_SERVER_PORT=8501
12+ - RAY_ENABLE_AUTO_RECONNECT=1
13+ - RAY_OBJECT_STORE_ALLOW_SLOW_STORAGE=1
14+ - RAY_HEAD_NODE=true
15+ - RAY_ADDRESS=localhost:6379
16+ - RAY_DISABLE_RUNTIME_ENV_LOG_TO_DRIVER=1
17+ - RAY_DISABLE_RUNTIME_ENV=1
18+ shm_size : ' 3gb'
19+ mem_limit : 6g
20+ ulimits :
21+ nofile :
22+ soft : 65536
23+ hard : 65536
24+ healthcheck :
25+ test : ["CMD", "ray", "status", "--address=localhost:6379"]
26+ interval : 15s
27+ timeout : 10s
28+ retries : 10
29+ start_period : 60s
30+ command : >
31+ sh -c "
32+ echo 'Starting minimal Ray head node...' &&
33+ ray start --head --port=6379 --disable-usage-stats --no-monitor --include-dashboard=false --disable-runtime-env --object-store-memory=800000000 --num-cpus=2 --memory=3000000000 --temp-dir=/tmp/ray &&
34+ echo 'Ray head started, waiting for stability...' &&
35+ sleep 30 &&
36+ echo 'Verifying Ray cluster status...' &&
37+ ray status --address=localhost:6379 &&
38+ echo 'Starting application services...' &&
39+ uvicorn inicio:app --host 0.0.0.0 --port 8000 --reload &
40+ streamlit run streamlit_fronted.py --server.port=8501 --server.address=0.0.0.0 --server.headless=true
41+ "
42+ networks :
43+ - ray-net
44+
45+ ray_worker :
46+ build : .
47+ depends_on :
48+ ray-head :
49+ condition : service_healthy
50+ environment :
51+ - RAY_DISABLE_IMPORT_WARNING=1
52+ - RAY_ENABLE_AUTO_RECONNECT=1
53+ - RAY_OBJECT_STORE_ALLOW_SLOW_STORAGE=1
54+ - RAY_DISABLE_RUNTIME_ENV_LOG_TO_DRIVER=1
55+ - RAY_DISABLE_RUNTIME_ENV=1
56+ shm_size : ' 2gb'
57+ mem_limit : 4g
58+ ulimits :
59+ nofile :
60+ soft : 65536
61+ hard : 65536
62+ command : >
63+ sh -c "
64+ echo 'Waiting for Ray head to be ready...' &&
65+ sleep 45 &&
66+ echo 'Checking Ray head connectivity...' &&
67+ for i in {1..60}; do
68+ if ray status --address=ray-head:6379 >/dev/null 2>&1; then
69+ echo 'Ray head is ready, starting worker...'
70+ break
71+ else
72+ echo 'Ray head not ready yet, attempt $i/60, waiting 5 seconds...'
73+ sleep 5
74+ fi
75+ if [ $i -eq 60 ]; then
76+ echo 'Failed to connect to Ray head after 5 minutes'
77+ exit 1
78+ fi
79+ done &&
80+ ray start --address=ray-head:6379 --disable-runtime-env --object-store-memory=500000000 --memory=2000000000 &&
81+ echo 'Ray worker started successfully' &&
82+ ray status --address=ray-head:6379 &&
83+ tail -f /dev/null
84+ "
85+ networks :
86+ - ray-net
87+
88+ networks :
89+ ray-net :
90+ driver : bridge
0 commit comments