Refactor docker-compose setup
Browse files
docker-compose.yml
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
services:
|
2 |
+
app:
|
3 |
+
build:
|
4 |
+
context: .
|
5 |
+
dockerfile: docker/Dockerfile
|
6 |
+
image: synthetic-data-generator:app
|
7 |
+
ports:
|
8 |
+
- "7860:7860"
|
9 |
+
env_file:
|
10 |
+
- .env
|
11 |
+
networks:
|
12 |
+
- app-network
|
13 |
+
|
14 |
+
networks:
|
15 |
+
app-network:
|
16 |
+
name: synthetic-data-network
|
17 |
+
driver: bridge
|
docker/Dockerfile
CHANGED
@@ -17,6 +17,11 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
17 |
curl \
|
18 |
build-essential \
|
19 |
cmake \
|
|
|
|
|
|
|
|
|
|
|
20 |
&& rm -rf /var/lib/apt/lists/*
|
21 |
|
22 |
# Install pdm
|
|
|
17 |
curl \
|
18 |
build-essential \
|
19 |
cmake \
|
20 |
+
libgl1-mesa-glx \
|
21 |
+
libglib2.0-0 \
|
22 |
+
libsm6 \
|
23 |
+
libxext6 \
|
24 |
+
libxrender-dev \
|
25 |
&& rm -rf /var/lib/apt/lists/*
|
26 |
|
27 |
# Install pdm
|
docker/{compose.full.yml → argilla/compose.yml}
RENAMED
@@ -1,60 +1,17 @@
|
|
1 |
services:
|
2 |
-
# Base application
|
3 |
app:
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
image: synthetic-data-generator:app
|
8 |
-
ports:
|
9 |
-
- "7860:7860"
|
10 |
-
env_file:
|
11 |
-
- ../.env
|
12 |
-
environment:
|
13 |
-
- HF_TOKEN=${HF_TOKEN}
|
14 |
-
networks:
|
15 |
-
- app-network
|
16 |
depends_on:
|
17 |
argilla:
|
18 |
-
condition: service_started
|
19 |
-
required: false
|
20 |
-
ollama:
|
21 |
condition: service_healthy
|
22 |
required: false
|
23 |
-
|
24 |
-
# Ollama service
|
25 |
-
ollama:
|
26 |
-
image: ollama/ollama:${OLLAMA_HARDWARE:-latest}
|
27 |
-
profiles:
|
28 |
-
- with-ollama
|
29 |
-
ports:
|
30 |
-
- "11434:11434"
|
31 |
-
command: serve
|
32 |
-
env_file:
|
33 |
-
- ../.env
|
34 |
environment:
|
35 |
-
-
|
36 |
-
volumes:
|
37 |
-
- ollama_data:/root/.ollama
|
38 |
-
networks:
|
39 |
-
- app-network
|
40 |
-
deploy:
|
41 |
-
resources:
|
42 |
-
reservations:
|
43 |
-
devices:
|
44 |
-
- driver: nvidia
|
45 |
-
count: all
|
46 |
-
capabilities: [gpu]
|
47 |
-
healthcheck:
|
48 |
-
test: ["CMD", "curl", "-f", "http://localhost:11434/api/health"]
|
49 |
-
interval: 30s
|
50 |
-
timeout: 10s
|
51 |
-
retries: 3
|
52 |
|
53 |
-
# Elasticsearch service for Argilla
|
54 |
elasticsearch:
|
55 |
image: docker.elastic.co/elasticsearch/elasticsearch:8.17.0
|
56 |
-
profiles:
|
57 |
-
- with-argilla
|
58 |
environment:
|
59 |
- ES_JAVA_OPTS=-Xms512m -Xmx512m
|
60 |
- node.name=elasticsearch
|
@@ -82,11 +39,8 @@ services:
|
|
82 |
timeout: 10s
|
83 |
retries: 3
|
84 |
|
85 |
-
# PostgreSQL service for Argilla
|
86 |
postgres:
|
87 |
image: postgres:14
|
88 |
-
profiles:
|
89 |
-
- with-argilla
|
90 |
environment:
|
91 |
POSTGRES_USER: postgres
|
92 |
POSTGRES_PASSWORD: postgres
|
@@ -96,19 +50,13 @@ services:
|
|
96 |
volumes:
|
97 |
- postgres_data:/var/lib/postgresql/data
|
98 |
|
99 |
-
# Redis service for Argilla
|
100 |
redis:
|
101 |
image: redis
|
102 |
-
profiles:
|
103 |
-
- with-argilla
|
104 |
networks:
|
105 |
- app-network
|
106 |
|
107 |
-
# Argilla service
|
108 |
argilla:
|
109 |
image: argilla/argilla-server:latest
|
110 |
-
profiles:
|
111 |
-
- with-argilla
|
112 |
ports:
|
113 |
- "6900:6900"
|
114 |
healthcheck:
|
@@ -117,7 +65,7 @@ services:
|
|
117 |
timeout: 10s
|
118 |
retries: 3
|
119 |
env_file:
|
120 |
-
-
|
121 |
environment:
|
122 |
- ARGILLA_HOME_PATH=/var/lib/argilla
|
123 |
- ARGILLA_ELASTICSEARCH=http://elasticsearch:9200
|
@@ -139,13 +87,10 @@ services:
|
|
139 |
redis:
|
140 |
condition: service_started
|
141 |
|
142 |
-
# Argilla Worker
|
143 |
worker:
|
144 |
image: argilla/argilla-server:latest
|
145 |
-
profiles:
|
146 |
-
- with-argilla
|
147 |
env_file:
|
148 |
-
-
|
149 |
environment:
|
150 |
- ARGILLA_HOME_PATH=/var/lib/argilla
|
151 |
- ARGILLA_ELASTICSEARCH=http://elasticsearch:9200
|
@@ -164,16 +109,10 @@ services:
|
|
164 |
- redis
|
165 |
command: sh -c 'python -m argilla_server worker --num-workers $${BACKGROUND_NUM_WORKERS}'
|
166 |
|
167 |
-
networks:
|
168 |
-
app-network:
|
169 |
-
driver: bridge
|
170 |
-
|
171 |
volumes:
|
172 |
es_data:
|
173 |
-
|
174 |
argilla_data:
|
175 |
-
|
176 |
-
ollama_data:
|
177 |
-
driver: local
|
178 |
postgres_data:
|
179 |
-
|
|
|
1 |
services:
|
|
|
2 |
app:
|
3 |
+
extends:
|
4 |
+
file: docker-compose.yml
|
5 |
+
service: app
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
depends_on:
|
7 |
argilla:
|
|
|
|
|
|
|
8 |
condition: service_healthy
|
9 |
required: false
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
environment:
|
11 |
+
- ARGILLA_API_URL=http://argilla:6900
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
|
|
13 |
elasticsearch:
|
14 |
image: docker.elastic.co/elasticsearch/elasticsearch:8.17.0
|
|
|
|
|
15 |
environment:
|
16 |
- ES_JAVA_OPTS=-Xms512m -Xmx512m
|
17 |
- node.name=elasticsearch
|
|
|
39 |
timeout: 10s
|
40 |
retries: 3
|
41 |
|
|
|
42 |
postgres:
|
43 |
image: postgres:14
|
|
|
|
|
44 |
environment:
|
45 |
POSTGRES_USER: postgres
|
46 |
POSTGRES_PASSWORD: postgres
|
|
|
50 |
volumes:
|
51 |
- postgres_data:/var/lib/postgresql/data
|
52 |
|
|
|
53 |
redis:
|
54 |
image: redis
|
|
|
|
|
55 |
networks:
|
56 |
- app-network
|
57 |
|
|
|
58 |
argilla:
|
59 |
image: argilla/argilla-server:latest
|
|
|
|
|
60 |
ports:
|
61 |
- "6900:6900"
|
62 |
healthcheck:
|
|
|
65 |
timeout: 10s
|
66 |
retries: 3
|
67 |
env_file:
|
68 |
+
- .env
|
69 |
environment:
|
70 |
- ARGILLA_HOME_PATH=/var/lib/argilla
|
71 |
- ARGILLA_ELASTICSEARCH=http://elasticsearch:9200
|
|
|
87 |
redis:
|
88 |
condition: service_started
|
89 |
|
|
|
90 |
worker:
|
91 |
image: argilla/argilla-server:latest
|
|
|
|
|
92 |
env_file:
|
93 |
+
- .env
|
94 |
environment:
|
95 |
- ARGILLA_HOME_PATH=/var/lib/argilla
|
96 |
- ARGILLA_ELASTICSEARCH=http://elasticsearch:9200
|
|
|
109 |
- redis
|
110 |
command: sh -c 'python -m argilla_server worker --num-workers $${BACKGROUND_NUM_WORKERS}'
|
111 |
|
|
|
|
|
|
|
|
|
112 |
volumes:
|
113 |
es_data:
|
114 |
+
name: synthetic-data-es
|
115 |
argilla_data:
|
116 |
+
name: synthetic-data-argilla
|
|
|
|
|
117 |
postgres_data:
|
118 |
+
name: synthetic-data-postgres
|
docker/{compose.basic.yml → ollama/compose.yml}
RENAMED
@@ -1,35 +1,26 @@
|
|
1 |
services:
|
2 |
-
# Base application
|
3 |
app:
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
image: synthetic-data-generator:app
|
8 |
-
ports:
|
9 |
-
- "7860:7860"
|
10 |
-
env_file:
|
11 |
-
- ../.env
|
12 |
-
environment:
|
13 |
-
- HF_TOKEN=${HF_TOKEN}
|
14 |
-
networks:
|
15 |
-
- app-network
|
16 |
depends_on:
|
17 |
ollama:
|
18 |
condition: service_healthy
|
19 |
required: true
|
|
|
|
|
20 |
|
21 |
-
# Ollama service
|
22 |
ollama:
|
23 |
image: ollama/ollama:${OLLAMA_HARDWARE:-latest}
|
24 |
ports:
|
25 |
- "11434:11434"
|
26 |
-
command: serve
|
27 |
env_file:
|
28 |
-
-
|
29 |
environment:
|
30 |
- OLLAMA_BASE_URL=${OLLAMA_BASE_URL:-}
|
31 |
volumes:
|
32 |
- ollama_data:/root/.ollama
|
|
|
33 |
networks:
|
34 |
- app-network
|
35 |
deploy:
|
@@ -39,16 +30,20 @@ services:
|
|
39 |
- driver: nvidia
|
40 |
count: all
|
41 |
capabilities: [gpu]
|
|
|
|
|
|
|
42 |
healthcheck:
|
43 |
-
test:
|
44 |
-
|
|
|
|
|
|
|
|
|
45 |
timeout: 10s
|
46 |
-
retries:
|
47 |
-
|
48 |
-
networks:
|
49 |
-
app-network:
|
50 |
-
driver: bridge
|
51 |
|
52 |
volumes:
|
53 |
ollama_data:
|
54 |
-
|
|
|
1 |
services:
|
|
|
2 |
app:
|
3 |
+
extends:
|
4 |
+
file: docker-compose.yml
|
5 |
+
service: app
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
depends_on:
|
7 |
ollama:
|
8 |
condition: service_healthy
|
9 |
required: true
|
10 |
+
environment:
|
11 |
+
- OLLAMA_BASE_URL=http://ollama:11434
|
12 |
|
|
|
13 |
ollama:
|
14 |
image: ollama/ollama:${OLLAMA_HARDWARE:-latest}
|
15 |
ports:
|
16 |
- "11434:11434"
|
|
|
17 |
env_file:
|
18 |
+
- .env
|
19 |
environment:
|
20 |
- OLLAMA_BASE_URL=${OLLAMA_BASE_URL:-}
|
21 |
volumes:
|
22 |
- ollama_data:/root/.ollama
|
23 |
+
- ./docker/ollama/entrypoint.sh:/entrypoint.sh
|
24 |
networks:
|
25 |
- app-network
|
26 |
deploy:
|
|
|
30 |
- driver: nvidia
|
31 |
count: all
|
32 |
capabilities: [gpu]
|
33 |
+
tty: true
|
34 |
+
#restart: always
|
35 |
+
entrypoint: ["/usr/bin/bash", "/entrypoint.sh"]
|
36 |
healthcheck:
|
37 |
+
test:
|
38 |
+
- "CMD-SHELL"
|
39 |
+
- |
|
40 |
+
test -f /tmp/ollama_ready && \
|
41 |
+
bash -c '</dev/tcp/localhost/11434'
|
42 |
+
interval: 10s
|
43 |
timeout: 10s
|
44 |
+
retries: 100
|
45 |
+
start_period: 10s
|
|
|
|
|
|
|
46 |
|
47 |
volumes:
|
48 |
ollama_data:
|
49 |
+
name: synthetic-data-ollama
|