Skip to content

Commit 6226c68

Browse files
committed
fix: update Homebrew formula SHA256 checksum for v0.1.0
1 parent d935791 commit 6226c68

10 files changed

Lines changed: 567 additions & 7 deletions

File tree

DOCKER_SETUP.md

Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
# Docker Setup for Open WebUI
2+
3+
This Docker Compose setup provides a complete local AI environment with Ollama and Open WebUI that can be used with commitron's custom provider feature.
4+
5+
## Prerequisites
6+
7+
- Docker and Docker Compose installed
8+
- At least 4GB of available RAM (8GB recommended)
9+
- At least 10GB of available disk space
10+
11+
## Quick Start
12+
13+
### Option 1: Automated Setup (Recommended)
14+
15+
1. **Clone the repository and navigate to the project directory:**
16+
```bash
17+
cd commitron
18+
```
19+
20+
2. **Run the setup command:**
21+
```bash
22+
make docker-setup
23+
```
24+
25+
The command will automatically:
26+
- Check prerequisites (Docker, Docker Compose)
27+
- Create the environment file
28+
- Start the services
29+
- Provide next steps
30+
31+
### Option 2: Manual Setup
32+
33+
1. **Clone the repository and navigate to the project directory:**
34+
```bash
35+
cd commitron
36+
```
37+
38+
2. **Copy the environment file:**
39+
```bash
40+
cp docker-compose.env.example .env
41+
```
42+
43+
3. **Start the services:**
44+
```bash
45+
docker-compose up -d
46+
```
47+
48+
4. **Access Open WebUI:**
49+
- Open your browser and go to `http://localhost:3000`
50+
- The default port can be changed by modifying the `OPEN_WEBUI_PORT` variable in `.env`
51+
52+
5. **Pull a model in Ollama:**
53+
```bash
54+
# Pull a model using make command
55+
make docker-pull-model MODEL=mistral:latest
56+
57+
# Or pull other models
58+
make docker-pull-model MODEL=llama2:latest
59+
make docker-pull-model MODEL=codellama:latest
60+
61+
# List available models
62+
make docker-list-models
63+
```
64+
65+
## Configure commitron to use Open WebUI
66+
67+
Once Open WebUI is running, you can configure commitron to use it as a custom provider:
68+
69+
1. **Create or edit your commitron configuration:**
70+
```bash
71+
commitron init
72+
```
73+
74+
2. **Update the configuration file (`~/.commitronrc`):**
75+
```yaml
76+
ai:
77+
provider: custom
78+
api_endpoint: http://localhost:3000/v1/chat/completions
79+
model: mistral:latest # Use the model name as configured in Open WebUI
80+
api_key: "" # Usually not required for local instances
81+
temperature: 0.7
82+
max_tokens: 1000
83+
```
84+
85+
3. **Test the setup:**
86+
```bash
87+
# Stage some files
88+
git add .
89+
90+
# Generate a commit message using the custom provider
91+
commitron generate
92+
```
93+
94+
## Available Make Commands
95+
96+
The project includes several Make commands to simplify Docker operations:
97+
98+
| Command | Description |
99+
|---------|-------------|
100+
| `make docker-setup` | Complete setup (env file + start services) |
101+
| `make docker-up` | Start services only |
102+
| `make docker-down` | Stop services |
103+
| `make docker-pull-model MODEL=name` | Pull a model in Ollama |
104+
| `make docker-list-models` | List available models |
105+
| `make docker-status` | Show service status |
106+
| `make docker-logs` | Show all logs |
107+
| `make docker-logs-ollama` | Show Ollama logs only |
108+
| `make docker-logs-webui` | Show Open WebUI logs only |
109+
| `make docker-clean` | Stop and remove all data |
110+
111+
## Environment Variables
112+
113+
| Variable | Default | Description |
114+
|----------|---------|-------------|
115+
| `OLLAMA_DOCKER_TAG` | `latest` | Ollama Docker image tag |
116+
| `WEBUI_DOCKER_TAG` | `main` | Open WebUI Docker image tag |
117+
| `OPEN_WEBUI_PORT` | `3000` | Port for Open WebUI web interface |
118+
| `WEBUI_SECRET_KEY` | (empty) | Secret key for Open WebUI (optional) |
119+
120+
## Available Models
121+
122+
You can use any model that's compatible with Ollama. Some popular models for code-related tasks:
123+
124+
- `mistral:latest` - Good general-purpose model
125+
- `codellama:latest` - Specialized for code generation
126+
- `llama2:latest` - Meta's Llama 2 model
127+
- `neural-chat:latest` - Intel's optimized model
128+
129+
To see all available models:
130+
```bash
131+
docker exec -it ollama ollama list
132+
```
133+
134+
## Troubleshooting
135+
136+
### Port already in use
137+
If port 3000 is already in use, change the `OPEN_WEBUI_PORT` in your `.env` file:
138+
```bash
139+
OPEN_WEBUI_PORT=3001
140+
```
141+
142+
### Out of memory
143+
If you encounter memory issues:
144+
1. Pull smaller models (e.g., `mistral:7b` instead of `mistral:latest`)
145+
2. Increase Docker memory limits in Docker Desktop settings
146+
3. Close other memory-intensive applications
147+
148+
### Services not starting
149+
Check the logs:
150+
```bash
151+
make docker-logs
152+
# Or check specific services:
153+
make docker-logs-ollama
154+
make docker-logs-webui
155+
```
156+
157+
### API endpoint not accessible
158+
Ensure Open WebUI is fully started:
159+
```bash
160+
make docker-status
161+
```
162+
163+
The Open WebUI service should show as "Up" before trying to use it with commitron.
164+
165+
## Stopping the Services
166+
167+
To stop all services:
168+
```bash
169+
make docker-down
170+
```
171+
172+
To stop and remove all data (volumes):
173+
```bash
174+
make docker-clean
175+
```
176+
177+
## Data Persistence
178+
179+
The setup uses Docker volumes to persist:
180+
- Ollama models and data (`ollama` volume)
181+
- Open WebUI configuration and data (`open-webui` volume)
182+
183+
Your models and settings will persist between container restarts.

Formula/commitron.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ class Commitron < Formula
22
desc "AI-driven CLI tool that generates optimal, context-aware commit messages"
33
homepage "https://github.com/stiliajohny/commitron"
44
url "https://github.com/stiliajohny/commitron/archive/refs/tags/v0.1.0.tar.gz"
5-
# Copy the SHA256 output from step 4 here
6-
sha256 "9d9aef9610f06d39d8e4ce76b808a06bb84a34daf78a2e82841c4b57bbc4b1ff"
5+
# SHA256 checksum for v0.1.0 release
6+
sha256 "c4ee5df458c875d8ef37768159d69e6e06c50f535cc1b77ba1f946c71e784f9f"
77

88
depends_on "go" => :build
99

Makefile

Lines changed: 107 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,110 @@ run: build ## Run the binary with provided arguments
6868
clean: ## Clean build artifacts
6969
@rm -rf $(BUILD_DIR) $(DIST_DIR)
7070

71-
.PHONY: help check-go deps test build build-all run clean
71+
# Docker commands
72+
docker-check: ## Check if Docker and Docker Compose are installed
73+
@if ! command -v docker &> /dev/null; then \
74+
echo "❌ Docker is not installed. Please install Docker first."; \
75+
exit 1; \
76+
fi
77+
@if ! command -v docker-compose &> /dev/null; then \
78+
echo "❌ Docker Compose is not installed. Please install Docker Compose first."; \
79+
exit 1; \
80+
fi
81+
@echo "✅ Docker and Docker Compose are installed"
82+
83+
docker-setup: docker-check ## Setup Docker environment (copy env file and start services)
84+
@echo "🚀 Setting up Docker environment for commitron..."
85+
@if [ ! -f ".env" ]; then \
86+
if [ -f "docker-compose.env.example" ]; then \
87+
echo "📋 Copying environment file..."; \
88+
cp docker-compose.env.example .env; \
89+
echo "✅ Environment file created. You can edit .env to customize settings."; \
90+
else \
91+
echo "⚠️ docker-compose.env.example not found. Creating basic .env file..."; \
92+
echo "# Docker Compose environment variables" > .env; \
93+
echo "OLLAMA_DOCKER_TAG=latest" >> .env; \
94+
echo "WEBUI_DOCKER_TAG=main" >> .env; \
95+
echo "OPEN_WEBUI_PORT=3000" >> .env; \
96+
echo "WEBUI_SECRET_KEY=" >> .env; \
97+
fi; \
98+
fi
99+
@echo "🐳 Starting Docker services..."
100+
@docker-compose up -d
101+
@echo "⏳ Waiting for services to start..."
102+
@sleep 10
103+
@if ! docker-compose ps | grep -q "Up"; then \
104+
echo "❌ Services failed to start. Check logs with: make docker-logs"; \
105+
exit 1; \
106+
fi
107+
@echo "✅ Services started successfully!"
108+
@echo ""
109+
@echo "🎉 Setup complete! Next steps:"
110+
@echo ""
111+
@echo "1. Pull a model in Ollama:"
112+
@echo " make docker-pull-model MODEL=mistral:latest"
113+
@echo ""
114+
@echo "2. Access Open WebUI:"
115+
@echo " http://localhost:3000"
116+
@echo ""
117+
@echo "3. Configure commitron to use the custom provider:"
118+
@echo " commitron init"
119+
@echo ""
120+
@echo "4. Edit ~/.commitronrc and set:"
121+
@echo " provider: custom"
122+
@echo " api_endpoint: http://localhost:3000/v1/chat/completions"
123+
@echo ""
124+
@echo "5. Test the setup:"
125+
@echo " git add ."
126+
@echo " commitron generate"
127+
@echo ""
128+
@echo "📖 For detailed instructions, see DOCKER_SETUP.md"
129+
@echo ""
130+
@echo "🛑 To stop services: make docker-down"
131+
132+
docker-up: docker-check ## Start Docker services
133+
@echo "🐳 Starting Docker services..."
134+
@docker-compose up -d
135+
136+
docker-down: ## Stop Docker services
137+
@echo "🛑 Stopping Docker services..."
138+
@docker-compose down
139+
140+
docker-logs: ## Show Docker service logs
141+
@docker-compose logs
142+
143+
docker-logs-ollama: ## Show Ollama service logs
144+
@docker-compose logs ollama
145+
146+
docker-logs-webui: ## Show Open WebUI service logs
147+
@docker-compose logs open-webui
148+
149+
docker-pull-model: docker-check ## Pull a model in Ollama (usage: make docker-pull-model MODEL=mistral:latest)
150+
@if [ -z "$(MODEL)" ]; then \
151+
echo "❌ Please specify a model: make docker-pull-model MODEL=mistral:latest"; \
152+
exit 1; \
153+
fi
154+
@echo "📥 Pulling model $(MODEL) in Ollama..."
155+
@docker exec -it ollama ollama pull $(MODEL)
156+
157+
docker-list-models: docker-check ## List available models in Ollama
158+
@echo "📋 Available models in Ollama:"
159+
@docker exec -it ollama ollama list
160+
161+
docker-status: ## Show Docker services status
162+
@echo "📊 Docker services status:"
163+
@docker-compose ps
164+
165+
docker-clean: ## Stop services and remove volumes (WARNING: This will delete all data)
166+
@echo "⚠️ WARNING: This will stop services and remove all data!"
167+
@read -p "Are you sure? [y/N] " -n 1 -r; \
168+
echo; \
169+
if [[ $$REPLY =~ ^[Yy]$$ ]]; then \
170+
echo "🧹 Cleaning up Docker environment..."; \
171+
docker-compose down -v; \
172+
echo "✅ Cleanup complete"; \
173+
else \
174+
echo "❌ Cleanup cancelled"; \
175+
fi
176+
177+
.PHONY: help check-go deps test build build-all run clean docker-check docker-setup docker-up docker-down docker-logs docker-logs-ollama docker-logs-webui docker-pull-model docker-list-models docker-status docker-clean

0 commit comments

Comments
 (0)