-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvps-to-ai-homeserver.sh
74 lines (57 loc) · 1.96 KB
/
vps-to-ai-homeserver.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
## wireguard, caddy, ollama, open-webui, ufw, podman, cuda
## https://blog.fuzzymistborn.com/vps-reverse-proxy-tunnel/
#### vps #############################################################
## setup wireguard
## /etc/wireguard/conf.d/wg0.conf
```
[Interface]
Address = 10.10.10.1/24
ListenPort = 51820
PrivateKey = PRIVATE_VPS_KEY
[Peer]
PublicKey = PUBLIC_DMZ_KEY
AllowedIPs = 10.10.10.10/32
```
## start wireguard
systemctl enable --now wg-quick@wg0
## setup caddy
## /etc/caddy/Caddyfile
## redirects https/443 traffic to open-webui listening on port 8080
```
# https://<domain-name>
# reverse-proxy 10.10.10.10:8080
https://<domain-name> {
reverse-proxy 10.10.10.10:3000
}
```
## start caddy
systemctl disable --now nginx
systemctl enable --now caddy
## allow https (443)
ufw allow 443
#### homeserver/DMZ #####################################################
## setup wireguard
## /etc/wireguard/conf.d/wg0.conf
```
[Interface]
Address = 10.10.10.10/32
PrivateKey = PRIVATE_DMZ_KEY
# DNS = 9.9.9.9, 149.112.112.112
[Peer]
PublicKey = PUBLIC_VPS_KEY
Endpoint = VPS_IP_ADDRESS:51820
AllowedIPs = 10.10.10.1/32
PersistentKeepalive = 25
```
## setup ollama
ollama run llama3
## setup open-webui with podman
# docker run -d --gpus all --network=host -e OLLAMA_BASE_URL=http://127.0.0.1:11434 --add-host=host.docker.internal:host-gateway -v open-webui:/app/backend/data --name open-webui --restart always ghcr.io/open-webui/open-webui:cuda
# -p 3000:8080
####################
## improved
## https://github.com/open-webui/open-webui/discussions/4376#discussioncomment-10245922
## gpu version
docker run -d -e PORT=3000 --gpus all --network=host -e OLLAMA_BASE_URL=http://127.0.0.1:11434 -v open-webui:/app/backend/data --name open-webui --restart always ghcr.io/open-webui/open-webui:cuda
## cpu version
docker run -d -e PORT=3000 --network=host -e OLLAMA_BASE_URL=http://127.0.0.1:11434 -v open-webui:/app/backend/data --name open-webui --restart always ghcr.io/open-webui/open-webui