Skip to content

Commit 1b0783d

Browse files
authored
Merge pull request #17 from codez0mb1e/ai-agents-setup
AI agents: local setup
2 parents 6fde582 + e3d3c80 commit 1b0783d

6 files changed

Lines changed: 200 additions & 9 deletions

File tree

ai-agents/.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
WEBUI_SECRET_KEY=your-very-secure-random-key-here

ai-agents/README.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# AI Agents Development
2+
3+
Scripts for local AI development.
4+
5+
- [Quick Start](#quick-start)
6+
- [Services](#services)
7+
- [Models](#models)
8+
- [Monitoring download](#monitoring-download)
9+
- [Configuration](#configuration)
10+
11+
12+
## Quick Start
13+
14+
```bash
15+
# 1. Start services (automatically downloads models)
16+
docker compose up -d
17+
18+
# 2. Monitor model downloading progress
19+
docker compose logs model-downloader -f
20+
21+
# 3. Access Open WebUI (after models are downloaded)
22+
open http://localhost:3000
23+
```
24+
25+
## Services
26+
27+
- **Ollama**: http://localhost:11434 (LLM inference)
28+
- **Open WebUI**: http://localhost:3000 (Chat interface)
29+
30+
## Models
31+
32+
The `download_models.sh` script automatically downloads:
33+
34+
- `llama3.2`: lightweight general purpose chat model
35+
- `deepseek-coder`: code generation and assistance
36+
- `gpt-oss`: SotA reasoning model
37+
38+
See all available models at [ollama.com/models](https://ollama.com/models).
39+
40+
### Monitoring download
41+
42+
```bash
43+
# Watch model download progress
44+
docker compose logs model-downloader -f
45+
46+
# Check Ollama service status
47+
docker compose logs ollama -f
48+
49+
# List downloaded models
50+
docker exec -it ollama ollama list
51+
52+
# Check if models are ready
53+
curl http://localhost:11434/api/tags
54+
```
55+
56+
## Configuration
57+
58+
Edit `.env` file:
59+
60+
```bash
61+
WEBUI_SECRET_KEY=your-secure-key-here
62+
```

ai-agents/agents.sh

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,11 @@
33
#
44
# AI agents development environment setup
55
#
6-
# This script sets up:
7-
# - Infra
8-
# - Frameworks
9-
# - Tools
10-
#
11-
# Note: will be decomposed into separate scripts later
12-
# Usage: ./agents.sh
13-
#
146

157

168
# 0. Install Ollama [1]
17-
# install
9+
# See compose.yml to run Ollama server in Docker
10+
# or install
1811
cd ~
1912
curl -fsSL https://ollama.com/install.sh | sh
2013

@@ -25,6 +18,9 @@ ollama -v
2518
ollama run llama3.2
2619
ollama run deepseek-coder
2720

21+
# uninstall Ollama
22+
# https://medium.com/@heartonbit/uninstalling-ollama-db78dd9545fa
23+
2824

2925
# Connect Ollama to Open-WebUI [2]
3026
docker network create ollama-net
@@ -47,6 +43,7 @@ uv sync --all-extras
4743

4844

4945
# 2. Install Playwright ----
46+
5047
playwright install
5148

5249

ai-agents/compose.yml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
networks:
2+
ai-agents-net:
3+
driver: bridge
4+
5+
services:
6+
ollama:
7+
image: ollama/ollama:latest
8+
container_name: ollama
9+
ports:
10+
- "11434:11434"
11+
volumes:
12+
- ollama:/root/.ollama
13+
networks:
14+
- ai-agents-net
15+
restart: unless-stopped
16+
environment:
17+
- OLLAMA_HOST=0.0.0.0
18+
- OLLAMA_NUM_PARALLEL=2
19+
healthcheck:
20+
test: ["CMD", "ollama", "list"]
21+
interval: 15s
22+
timeout: 10s
23+
retries: 3
24+
start_period: 10s
25+
deploy:
26+
resources:
27+
limits:
28+
cpus: '7.0'
29+
memory: 32G
30+
reservations:
31+
cpus: '4.0'
32+
memory: 16G
33+
34+
model-downloader:
35+
image: ollama/ollama:latest
36+
container_name: model-downloader
37+
volumes:
38+
- ollama:/root/.ollama
39+
- ./download_models.sh:/download_models.sh
40+
networks:
41+
- ai-agents-net
42+
depends_on:
43+
ollama:
44+
condition: service_healthy
45+
entrypoint: ["bash"]
46+
command: ["/download_models.sh"]
47+
restart: "no"
48+
environment:
49+
- OLLAMA_HOST=http://ollama:11434
50+
51+
open-webui:
52+
image: ghcr.io/open-webui/open-webui:main
53+
container_name: open-webui
54+
ports:
55+
- "3000:8080"
56+
volumes:
57+
- open-webui:/app/backend/data
58+
networks:
59+
- ai-agents-net
60+
depends_on:
61+
ollama:
62+
condition: service_healthy
63+
restart: unless-stopped
64+
env_file:
65+
- .env
66+
environment:
67+
- OLLAMA_BASE_URL=http://ollama:11434
68+
- WEBUI_SECRET_KEY=${WEBUI_SECRET_KEY}
69+
- WEBUI_AUTH=False # Set to True for authentication
70+
healthcheck:
71+
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
72+
interval: 30s
73+
timeout: 10s
74+
retries: 3
75+
start_period: 30s
76+
deploy:
77+
resources:
78+
limits:
79+
cpus: '2.0'
80+
memory: 4G
81+
reservations:
82+
cpus: '0.5'
83+
memory: 1G
84+
85+
volumes:
86+
ollama:
87+
driver: local
88+
open-webui:
89+
driver: local

ai-agents/download_models.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash
2+
3+
#
4+
# Download and setup Ollama models for AI agents development
5+
#
6+
7+
echo "🤖 Starting Ollama models download..."
8+
9+
# Wait for Ollama service to be ready
10+
echo "⏳ Waiting for Ollama service to be ready..."
11+
until ollama list >/dev/null 2>&1; do
12+
echo " Waiting for Ollama..."
13+
sleep 3
14+
done
15+
16+
echo "✅ Ollama service is ready!"
17+
18+
# Download models
19+
echo "📥 Downloading models..."
20+
21+
# Core models for development
22+
ollama pull llama3.2:3b
23+
echo "✅ Downloaded llama3.2"
24+
25+
ollama pull gpt-oss:20b
26+
echo "✅ Downloaded gpt-oss:20b"
27+
28+
ollama pull deepseek-coder:6.7b
29+
echo "✅ Downloaded deepseek-coder"
30+
31+
32+
echo "🎉 All models downloaded successfully!"
33+
34+
# List downloaded models
35+
echo "📋 Available models:"
36+
ollama list

ubuntu-os/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,12 @@ ssh-keygen -y -f $KEY_NAME | ssh $USR@$HOST 'cat >> .ssh/authorized_keys'
155155

156156
## Cookies
157157

158+
Generate random password:
159+
160+
```bash
161+
openssl rand -hex 32
162+
```
163+
158164
Matrix screensaver:
159165

160166
```bash

0 commit comments

Comments
 (0)