Skip to content

Commit e0e86f4

Browse files
committed
wip: add offline local ai support
1 parent e8b7696 commit e0e86f4

6 files changed

Lines changed: 154 additions & 10 deletions

File tree

tools/development/README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,14 @@ podman compose up -d
77

88
## Tools
99

10-
### [LibreTranslate](https://github.com/LibreTranslate/LibreTranslate) - [http://localhost:5000/](http://localhost:5000/)
10+
### [LibreTranslate](https://github.com/LibreTranslate/LibreTranslate) - [http://localhost:5100/](http://localhost:5100/)
1111

1212
Self-hosted Machine Translation API, used for sensitive content.
1313

14-
### [SpiderFoot](https://github.com/smicallef/spiderfoot) - [http://localhost:5001/](http://localhost:5001/)
14+
### [SpiderFoot](https://github.com/smicallef/spiderfoot) - [http://localhost:5200/](http://localhost:5200/)
1515

1616
SpiderFoot automates OSINT for threat intelligence and mapping your attack surface.
17+
18+
### [Cyberchef](https://github.com/gchq/CyberChef) - [http://localhost:5300/](http://localhost:5300/)
19+
20+
CyberChef is a simple, intuitive web app for carrying out all manner of "cyber" operations within a web browser. These operations include simple encoding like XOR and Base64, more complex encryption like AES, DES and Blowfish, creating binary and hexdumps, compression and decompression of data, calculating hashes and checksums, IPv6 and X.509 parsing, changing character encodings, and much more.
Lines changed: 48 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,61 @@
1-
version: "3.0"
2-
31
services:
42
libretranslate:
5-
container_name: libretranslate
63
image: libretranslate/libretranslate
7-
restart: always
4+
container_name: libretranslate
85
ports:
9-
- "5000:5000"
6+
- "5100:5000"
7+
restart: unless-stopped
8+
networks:
9+
- libretranslate
1010

1111
spiderfoot:
12+
image: ctdc/spiderfoot
13+
container_name: spiderfoot
1214
volumes:
1315
- spiderfoot-data:/var/lib/spiderfoot
14-
image: dtagdevsec/spiderfoot
15-
container_name: spiderfoot
1616
ports:
17-
- "5001:5001"
17+
- "5200:5001"
18+
restart: unless-stopped
19+
networks:
20+
- spiderfoot
21+
22+
cyberchef:
23+
image: ghcr.io/gchq/cyberchef
24+
container_name: cyberchef
25+
ports:
26+
- "5300:80"
27+
restart: unless-stopped
28+
networks:
29+
- cyberchef
30+
31+
# Vaultwarden
32+
vaultwarden:
33+
image: vaultwarden/server:latest
34+
networks:
35+
- vaultwarden
36+
container_name: vaultwarden
1837
restart: unless-stopped
38+
environment:
39+
DOMAIN: "https://vault.shinyapps.nl"
40+
SIGNUPS_ALLOWED: false
41+
volumes:
42+
- /opt/homelab/vaultwarden/vw-data/:/data/
43+
ports:
44+
- 4000:80
1945

2046
volumes:
2147
spiderfoot-data:
48+
49+
networks:
50+
libretranslate:
51+
name: libretranslate
52+
driver: bridge
53+
spiderfoot:
54+
name: spiderfoot
55+
driver: bridge
56+
cyberchef:
57+
name: cyberchef
58+
driver: bridge
59+
vaultwarden:
60+
name: vaultwarden
61+
driver: bridge

tools/development/stopAll.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
podman stop $(podman ps -a -q) && podman rm $(podman ps -a -q) && podman system prune

tools/llm/README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
## Services
2+
3+
### Ollama
4+
5+
http://localhost:11434
6+
7+
### Open WebUI
8+
9+
http://localhost:3000
10+
11+
### Run the stack
12+
13+
```
14+
podman compose up -d
15+
```
16+
17+
## Tips & Tricks
18+
19+
```
20+
podman exec -ti ollama /bin/bash
21+
22+
ollama pull llama3
23+
24+
podman stats --no-stream
25+
```
26+
27+
### Podman specifics
28+
29+
```
30+
podman machine stop
31+
podman machine set --cpus 4 --memory 8192
32+
podman machine start
33+
```
34+
35+
TODO:
36+
check if we can increase CPU count
37+
https://www.cpu-monkey.com/en/cpu-apple_m1_pro_10_cpu_16_gpu

tools/llm/docker-compose.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
services:
2+
ollama:
3+
image: ollama/ollama
4+
container_name: ollama
5+
restart: unless-stopped
6+
deploy:
7+
resources:
8+
limits:
9+
cpus: 8
10+
memory: 8G
11+
security_opt:
12+
- no-new-privileges
13+
cap_drop:
14+
- all
15+
cap_add:
16+
- SYS_NICE
17+
ports:
18+
- "11434:11434"
19+
volumes:
20+
- ollama:/root/.ollama
21+
networks:
22+
- ollama
23+
24+
openwebui:
25+
image: ghcr.io/open-webui/open-webui:main
26+
container_name: openwebui
27+
ports:
28+
- "3000:8080"
29+
volumes:
30+
- open-webui:/app/backend/data
31+
depends_on:
32+
- ollama
33+
restart: unless-stopped
34+
deploy:
35+
resources:
36+
limits:
37+
cpus: 1
38+
memory: 1G
39+
networks:
40+
- ollama
41+
42+
volumes:
43+
ollama:
44+
open-webui:
45+
46+
networks:
47+
ollama:
48+
name: ollama
49+
driver: bridge
50+
# todo: after install the model, we want to use offline to be sure it does not leak anything
51+
offline:
52+
name: offline
53+
driver: none

tools/llm/start.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# setup correct limits
2+
podman machine stop
3+
podman machine set --cpus 8 --memory 8192
4+
podman machine start
5+
6+
podman compose up -d
7+
podman exec -it ollama ollama pull llama3
8+
9+
# todo: stop ollama and start it again offline

0 commit comments

Comments
 (0)