Skip to content

Commit d6de274

Browse files
committed
bad
1 parent a5623a1 commit d6de274

10 files changed

+633
-48
lines changed

docker-compose-local.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
services:
2+
ml-platform:
3+
build: .
4+
container_name: ml-platform
5+
ports:
6+
- "8000:8000" # FastAPI backend
7+
- "8501:8501" # Streamlit frontend
8+
environment:
9+
- RAY_DISABLE_IMPORT_WARNING=1
10+
- STREAMLIT_SERVER_PORT=8501
11+
- RAY_LOCAL_MODE=true
12+
shm_size: '4gb'
13+
mem_limit: 8g
14+
ulimits:
15+
nofile:
16+
soft: 65536
17+
hard: 65536
18+
command: >
19+
sh -c "
20+
echo 'Starting ML Platform with Ray in local mode...' &&
21+
uvicorn inicio:app --host 0.0.0.0 --port 8000 --reload &
22+
streamlit run streamlit_fronted.py --server.port=8501 --server.address=0.0.0.0 --server.headless=true
23+
"
24+
networks:
25+
- ml-net
26+
27+
networks:
28+
ml-net:
29+
driver: bridge

docker-compose-minimal.yml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
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

docker-compose-nodashboard.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
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+
shm_size: '3gb'
18+
mem_limit: 6g
19+
ulimits:
20+
nofile:
21+
soft: 65536
22+
hard: 65536
23+
healthcheck:
24+
test: ["CMD", "ray", "status", "--address=localhost:6379"]
25+
interval: 15s
26+
timeout: 10s
27+
retries: 10
28+
start_period: 60s
29+
command: >
30+
sh -c "
31+
echo 'Starting Ray head node without dashboard...' &&
32+
ray start --head --port=6379 --disable-usage-stats --no-monitor --include-dashboard=false --object-store-memory=800000000 --num-cpus=2 --memory=3000000000 --temp-dir=/tmp/ray &&
33+
echo 'Ray head started, waiting for stability...' &&
34+
sleep 30 &&
35+
echo 'Verifying Ray cluster status...' &&
36+
ray status --address=localhost:6379 &&
37+
echo 'Starting application services...' &&
38+
python start_services.py
39+
"
40+
networks:
41+
- ray-net
42+
43+
ray_worker:
44+
build: .
45+
depends_on:
46+
ray-head:
47+
condition: service_healthy
48+
environment:
49+
- RAY_DISABLE_IMPORT_WARNING=1
50+
- RAY_ENABLE_AUTO_RECONNECT=1
51+
- RAY_OBJECT_STORE_ALLOW_SLOW_STORAGE=1
52+
- RAY_DISABLE_RUNTIME_ENV_LOG_TO_DRIVER=1
53+
shm_size: '2gb'
54+
mem_limit: 4g
55+
ulimits:
56+
nofile:
57+
soft: 65536
58+
hard: 65536
59+
command: >
60+
sh -c "
61+
echo 'Waiting for Ray head to be ready...' &&
62+
sleep 45 &&
63+
echo 'Checking Ray head connectivity...' &&
64+
for i in {1..60}; do
65+
if ray status --address=ray-head:6379 >/dev/null 2>&1; then
66+
echo 'Ray head is ready, starting worker...'
67+
break
68+
else
69+
echo 'Ray head not ready yet, attempt $i/60, waiting 5 seconds...'
70+
sleep 5
71+
fi
72+
if [ $i -eq 60 ]; then
73+
echo 'Failed to connect to Ray head after 5 minutes'
74+
exit 1
75+
fi
76+
done &&
77+
ray start --address=ray-head:6379 --object-store-memory=500000000 --memory=2000000000 &&
78+
echo 'Ray worker started successfully' &&
79+
ray status --address=ray-head:6379 &&
80+
tail -f /dev/null
81+
"
82+
networks:
83+
- ray-net
84+
85+
networks:
86+
ray-net:
87+
driver: bridge

docker-compose-simple.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
services:
2+
ray-head:
3+
build: .
4+
container_name: ray-head
5+
ports:
6+
- "8265:8265" # Ray dashboard
7+
- "6379:6379" # Ray head port
8+
environment:
9+
- RAY_DISABLE_IMPORT_WARNING=1
10+
- RAY_ENABLE_AUTO_RECONNECT=1
11+
- RAY_OBJECT_STORE_ALLOW_SLOW_STORAGE=1
12+
shm_size: '2gb'
13+
mem_limit: 4g
14+
command: >
15+
sh -c "
16+
echo 'Starting Ray head node...' &&
17+
ray start --head --port=6379 --disable-usage-stats --dashboard-host=0.0.0.0 --dashboard-port=8265 --object-store-memory=500000000 --num-cpus=2 --memory=2000000000 --temp-dir=/tmp/ray &&
18+
echo 'Ray head started successfully' &&
19+
tail -f /dev/null
20+
"
21+
networks:
22+
- ray-net
23+
24+
ray_worker:
25+
build: .
26+
depends_on:
27+
- ray-head
28+
environment:
29+
- RAY_DISABLE_IMPORT_WARNING=1
30+
- RAY_ENABLE_AUTO_RECONNECT=1
31+
- RAY_OBJECT_STORE_ALLOW_SLOW_STORAGE=1
32+
shm_size: '1.5gb'
33+
mem_limit: 3g
34+
command: >
35+
sh -c "
36+
echo 'Waiting for Ray head to be ready...' &&
37+
sleep 30 &&
38+
echo 'Checking Ray head connectivity...' &&
39+
for i in {1..60}; do
40+
if ray status --address=ray-head:6379 >/dev/null 2>&1; then
41+
echo 'Ray head is ready, starting worker...'
42+
break
43+
else
44+
echo 'Ray head not ready yet, attempt $i/60, waiting 5 seconds...'
45+
sleep 5
46+
fi
47+
if [ $i -eq 60 ]; then
48+
echo 'Failed to connect to Ray head after 5 minutes'
49+
exit 1
50+
fi
51+
done &&
52+
ray start --address=ray-head:6379 --object-store-memory=300000000 --memory=1500000000 &&
53+
echo 'Ray worker started successfully' &&
54+
ray status --address=ray-head:6379 &&
55+
tail -f /dev/null
56+
"
57+
networks:
58+
- ray-net
59+
60+
api-server:
61+
build: .
62+
container_name: api-server
63+
ports:
64+
- "8000:8000" # FastAPI backend
65+
- "8501:8501" # Streamlit frontend
66+
depends_on:
67+
- ray-head
68+
environment:
69+
- RAY_DISABLE_IMPORT_WARNING=1
70+
- RAY_ENABLE_AUTO_RECONNECT=1
71+
- RAY_OBJECT_STORE_ALLOW_SLOW_STORAGE=1
72+
- RAY_ADDRESS=ray-head:6379
73+
command: >
74+
sh -c "
75+
echo 'Waiting for Ray cluster to be ready...' &&
76+
sleep 60 &&
77+
echo 'Starting FastAPI and Streamlit...' &&
78+
uvicorn inicio:app --host 0.0.0.0 --port 8000 --reload &
79+
streamlit run streamlit_fronted.py --server.port=8501 --server.address=0.0.0.0 --server.headless=true
80+
"
81+
networks:
82+
- ray-net
83+
84+
networks:
85+
ray-net:
86+
driver: bridge

0 commit comments

Comments
 (0)