Add deployment scripts and configuration for Open WebUI + Ollama stack on Linux
This commit is contained in:
59
DEPLOYMENT.md
Normal file
59
DEPLOYMENT.md
Normal file
@@ -0,0 +1,59 @@
|
||||
# Open WebUI + Ollama (Self-Contained) on Linux
|
||||
|
||||
This stack runs Open WebUI and Ollama in Docker with persistent storage, and starts automatically at boot via systemd.
|
||||
|
||||
## 1) Install Docker and compose plugin
|
||||
|
||||
Ubuntu/Debian example:
|
||||
|
||||
```bash
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y docker.io docker-compose-plugin
|
||||
sudo systemctl enable --now docker
|
||||
```
|
||||
|
||||
## 2) Copy this folder to your Linux host
|
||||
|
||||
Example destination:
|
||||
|
||||
```bash
|
||||
/opt/openwebui-ollama-src
|
||||
```
|
||||
|
||||
## 3) Run installer
|
||||
|
||||
```bash
|
||||
cd /opt/openwebui-ollama-src
|
||||
chmod +x install-linux.sh
|
||||
./install-linux.sh
|
||||
```
|
||||
|
||||
What it does:
|
||||
- Copies `docker-compose.yml` to `/opt/openwebui-ollama`
|
||||
- Installs and enables `openwebui-ollama.service`
|
||||
- Starts the stack immediately
|
||||
|
||||
## 4) Open WebUI
|
||||
|
||||
Browse to:
|
||||
|
||||
```text
|
||||
http://<linux-host-ip>:3000
|
||||
```
|
||||
|
||||
## 5) Validate boot persistence
|
||||
|
||||
```bash
|
||||
sudo systemctl status openwebui-ollama.service
|
||||
sudo reboot
|
||||
# after reboot
|
||||
sudo systemctl status openwebui-ollama.service
|
||||
docker ps
|
||||
```
|
||||
|
||||
## Optional: Pull additional Ollama models
|
||||
|
||||
```bash
|
||||
docker exec ollama ollama pull qwen2.5:7b
|
||||
docker exec ollama ollama pull mistral:7b
|
||||
```
|
||||
26
docker-compose.yml
Normal file
26
docker-compose.yml
Normal file
@@ -0,0 +1,26 @@
|
||||
services:
|
||||
ollama:
|
||||
image: ollama/ollama:latest
|
||||
container_name: ollama
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- ollama_data:/root/.ollama
|
||||
ports:
|
||||
- "11434:11434"
|
||||
|
||||
open-webui:
|
||||
image: ghcr.io/open-webui/open-webui:main
|
||||
container_name: open-webui
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
- ollama
|
||||
environment:
|
||||
- OLLAMA_BASE_URL=http://ollama:11434
|
||||
volumes:
|
||||
- openwebui_data:/app/backend/data
|
||||
ports:
|
||||
- "3000:8080"
|
||||
|
||||
volumes:
|
||||
ollama_data:
|
||||
openwebui_data:
|
||||
50
install-linux.sh
Normal file
50
install-linux.sh
Normal file
@@ -0,0 +1,50 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
STACK_DIR="/opt/openwebui-ollama"
|
||||
SERVICE_NAME="openwebui-ollama.service"
|
||||
SERVICE_PATH="/etc/systemd/system/${SERVICE_NAME}"
|
||||
|
||||
if ! command -v docker >/dev/null 2>&1; then
|
||||
echo "Docker is not installed. Install Docker first, then rerun this script."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! docker compose version >/dev/null 2>&1; then
|
||||
echo "Docker Compose plugin is not available. Install docker-compose-plugin, then rerun this script."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
sudo mkdir -p "${STACK_DIR}"
|
||||
sudo cp "${SCRIPT_DIR}/docker-compose.yml" "${STACK_DIR}/docker-compose.yml"
|
||||
|
||||
sudo tee "${SERVICE_PATH}" >/dev/null <<'EOF'
|
||||
[Unit]
|
||||
Description=Open WebUI + Ollama Docker Stack
|
||||
Requires=docker.service
|
||||
After=docker.service network-online.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
RemainAfterExit=yes
|
||||
WorkingDirectory=/opt/openwebui-ollama
|
||||
ExecStart=/usr/bin/docker compose up -d
|
||||
ExecStop=/usr/bin/docker compose down
|
||||
TimeoutStartSec=0
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable --now "${SERVICE_NAME}"
|
||||
|
||||
# Keep local models persistent and pull a small starter model.
|
||||
sudo docker exec ollama ollama pull llama3.2 || true
|
||||
|
||||
echo "Deployment complete."
|
||||
echo "Open WebUI: http://<your-linux-host-ip>:3000"
|
||||
echo "Service status: sudo systemctl status ${SERVICE_NAME}"
|
||||
16
openwebui-ollama.service
Normal file
16
openwebui-ollama.service
Normal file
@@ -0,0 +1,16 @@
|
||||
[Unit]
|
||||
Description=Open WebUI + Ollama Docker Stack
|
||||
Requires=docker.service
|
||||
After=docker.service network-online.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
RemainAfterExit=yes
|
||||
WorkingDirectory=/opt/openwebui-ollama
|
||||
ExecStart=/usr/bin/docker compose up -d
|
||||
ExecStop=/usr/bin/docker compose down
|
||||
TimeoutStartSec=0
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Reference in New Issue
Block a user