|
| 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. |
0 commit comments