Skip to content

Commit cfc57fb

Browse files
authored
Working docker-compose example (#167)
* Working docker-compose example * add persistence examples and update docker compose file
1 parent 0bb5e1f commit cfc57fb

File tree

3 files changed

+87
-56
lines changed

3 files changed

+87
-56
lines changed

README.md

+51-13
Original file line numberDiff line numberDiff line change
@@ -103,21 +103,28 @@ You can pull the prebuilt Docker images for Ahnlich:
103103

104104
#### Example Docker Compose
105105

106-
Below is an example `docker-compose.yaml` configuration to run both `ahnlich-db` and `ahnlich-ai`:
106+
Below is an example `docker-compose.yaml` configuration to run both `ahnlich-db` and `ahnlich-ai` with tracing:
107107

108108
```yaml
109-
services:
110-
ahnlich_db:
111-
image: ghcr.io/deven96/ahnlich-db:latest
112-
command: "ahnlich-db run --host 0.0.0.0 --enable-tracing --otel-endpoint http://jaeger:4317'"
113-
ports:
114-
- "1369:1369"
115-
116-
ahnlich_ai:
117-
image: ghcr.io/deven96/ahnlich-ai:latest
118-
command: "ahnlich-ai run --db-host ahnlich_db --host 0.0.0.0 -supported-models all-minilm-l6-v2,resnet-50 --enable-tracing ---otel-endpoint http://jaeger:4317'"
119-
ports:
120-
- "1370:1370"
109+
services:
110+
ahnlich_db:
111+
image: ghcr.io/deven96/ahnlich-db:latest
112+
command: >
113+
"ahnlich-db run --host 0.0.0.0 \
114+
--enable-tracing \
115+
--otel-endpoint http://jaeger:4317"
116+
ports:
117+
- "1369:1369"
118+
119+
ahnlich_ai:
120+
image: ghcr.io/deven96/ahnlich-ai:latest
121+
command: >
122+
"ahnlich-ai run --db-host ahnlich_db --host 0.0.0.0 \
123+
--supported-models all-minilm-l6-v2,resnet-50 \
124+
--enable-tracing \
125+
--otel-endpoint http://jaeger:4317"
126+
ports:
127+
- "1370:1370"
121128

122129
# optional jaeger service whenever --enable-tracing and
123130
# --otel-endpoint is used
@@ -132,6 +139,37 @@ services:
132139
- "4318:4318" # otlp http
133140
```
134141
142+
Below is an example `docker-compose.yaml` configuration with persistence:
143+
144+
```yaml
145+
146+
services:
147+
ahnlich_db:
148+
image: ghcr.io/deven96/ahnlich-db:latest
149+
command: >
150+
"ahnlich-db run --host 0.0.0.0 \
151+
--enable-persistence --persist-location /root/.ahnlich/data/db.dat \
152+
--persistence-interval 300"
153+
ports:
154+
- "1369:1369"
155+
volumes:
156+
- "./data/:/root/.ahnlich/data" # Persistence Location
157+
158+
ahnlich_ai:
159+
image: ghcr.io/deven96/ahnlich-ai:latest
160+
command: >
161+
"ahnlich-ai run --db-host ahnlich_db --host 0.0.0.0 \
162+
--supported-models all-minilm-l6-v2,resnet-50 \
163+
--enable-persistence --persist-location /root/.ahnlich/data/ai.dat \
164+
--persistence-interval 300"
165+
ports:
166+
- "1370:1370"
167+
volumes:
168+
- "./ahnlich_ai_model_cache:/root/.ahnlich/models" # Model cache storage
169+
- "./data/:/root/.ahnlich/data" # Persistence Location
170+
171+
```
172+
135173
### Contributing
136174

137175
View [contribution guide](CONTRIBUTING.md)

docker-compose.yml

+20-30
Original file line numberDiff line numberDiff line change
@@ -11,39 +11,29 @@ services:
1111
environment:
1212
- LOG_LEVEL=debug
1313
- COLLECTOR_OTLP_ENABLED=true
14-
networks:
15-
- jaeger-example
1614

1715
ahnlich_db:
18-
build:
19-
context: ./ahnlich/
20-
args:
21-
- AHNLICH_BIN=ahnlich-db
22-
depends_on:
23-
jaeger:
24-
condition: service_started
25-
command: "'ahnlich-db run --host 0.0.0.0 --enable-tracing --otel-endpoint http://jaeger:4317'"
26-
networks:
27-
- jaeger-example
16+
image: ghcr.io/deven96/ahnlich-db:latest
17+
command: >
18+
"ahnlich-db run --host 0.0.0.0 \
19+
--enable-persistence --persist-location /root/.ahnlich/data/db.dat \
20+
--persistence-interval 30000 --enable-tracing \
21+
--otel-endpoint http://jaeger:4317"
2822
ports:
29-
- 1369:1369
23+
- "1369:1369"
24+
volumes:
25+
- "./data/:/root/.ahnlich/data" # Persistence Location
3026

3127
ahnlich_ai:
32-
build:
33-
context: ./ahnlich/
34-
args:
35-
- AHNLICH_BIN=ahnlich-ai
36-
depends_on:
37-
jaeger:
38-
condition: service_started
39-
ahnlich_db:
40-
condition: service_started
41-
command: "'ahnlich-ai run --db-host ahnlich_db --host 0.0.0.0 --port 8880 --enable-tracing --otel-endpoint http://jaeger:4317 --supported-models all-minilm-l6-v2,resnet-50'"
42-
43-
networks:
44-
- jaeger-example
28+
image: ghcr.io/deven96/ahnlich-ai:latest
29+
command: >
30+
"ahnlich-ai run --db-host ahnlich_db --host 0.0.0.0 \
31+
--supported-models all-minilm-l6-v2,resnet-50 \
32+
--enable-persistence --persist-location /root/.ahnlich/data/ai.dat \
33+
--persistence-interval 30000 \
34+
--enable-tracing --otel-endpoint http://jaeger:4317"
4535
ports:
46-
- 1370:1370
47-
48-
networks:
49-
jaeger-example:
36+
- "1370:1370"
37+
volumes:
38+
- "./ahnlich_ai_model_cache:/root/.ahnlich/models" # Model cache storage
39+
- "./data/:/root/.ahnlich/data" # Persistence Location

web/ahnlich-web/src/app/page.tsx

+16-13
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,21 @@ export default function Home() {
88
const wget = `wget https://github.com/deven96/ahnlich/releases/download/bin%2Fdb%2F0.0.0/aarch64-darwin-ahnlich-db.tar.gz`;
99

1010
const dockerCompose = `
11-
services:
12-
ahnlich_db:
13-
image: ghcr.io/deven96/ahnlich-db:latest
14-
command: "'ahnlich-db run --host 0.0.0.0'"
15-
ports:
16-
- "1369:1369"
17-
18-
ahnlich_ai:
19-
image: ghcr.io/deven96/ahnlich-ai:latest
20-
command: "'ahnlich-ai run --db-host ahnlich_db --host 0.0.0.0 --supported-models all-minilm-l6-v2,resnet-50'"
21-
ports:
22-
- "1370:1370"
11+
services:
12+
ahnlich_db:
13+
image: ghcr.io/deven96/ahnlich-db:latest
14+
command: >
15+
"ahnlich-db run --host 0.0.0.0"
16+
ports:
17+
- "1369:1369"
18+
19+
ahnlich_ai:
20+
image: ghcr.io/deven96/ahnlich-ai:latest
21+
command: >
22+
"ahnlich-ai run --db-host ahnlich_db --host 0.0.0.0 \
23+
--supported-models all-minilm-l6-v2,resnet-50"
24+
ports:
25+
- "1370:1370"
2326
`
2427

2528
return (
@@ -48,7 +51,7 @@ export default function Home() {
4851
</li>
4952
</ul>
5053
<p>
51-
<code className="native-code">ahnlich-db</code>, <code className="native-code">ahnlich-ai</code> and <code className="native-code">ahnlich-cli</code>
54+
<code className="native-code">ahnlich-db</code>, <code className="native-code">ahnlich-ai</code> and <code className="native-code">ahnlich-cli</code>
5255
are packaged and released as <a href="https://github.com/deven96/ahnlich/releases" className="mr-1">binaries</a>
5356
for multiple platforms alongside <a href="https://github.com/deven96?tab=packages&repo_name=ahnlich">docker images</a>. <br />
5457
The DB can be used without the AI proxy for more fine grained control of the generated vector embeddings as all clients support both.

0 commit comments

Comments
 (0)