2025-07-28

glitchhex rebuild - version 4

 

Here is the fully updated and clarified two-phase plan for your gl1tchh3x system, taking into account the following:

✅ You're switching both Ollama and OpenWebUI to Docker
✅ You want all persistent data stored on the 2TB /mnt/glitchbrain
✅ You want GPU acceleration enabled using your NVIDIA setup
✅ We're purging the failed native install before the rebuild
✅ This will result in a clean, portable, self-healing AI stack


🔥 PHASE 1: PURGE & CLEANUP OF NATIVE INSTALL

Step 1: Deactivate and remove the Python virtual environment

deactivate || true
rm -rf ~/glitch-stack/open-webui/backend/venv

Step 2: Remove any native Python-related files

rm -rf ~/glitch-stack/open-webui/__pycache__/
rm -rf ~/glitch-stack/open-webui/backend/__pycache__/
rm -rf ~/glitch-stack/open-webui/backend/open_webui/__pycache__/
find ~/glitch-stack -name "*.pyc" -delete

Step 3: Delete broken native install directories

rm -rf ~/glitch-stack/open-webui

Step 4: Remove Ollama binary if installed natively

sudo rm -f /usr/local/bin/ollama

Step 5: Purge systemd autostart services if they exist

sudo systemctl disable ollama.service --now
sudo rm -f /etc/systemd/system/ollama.service
sudo rm -rf /etc/systemd/system/ollama.service.d
sudo systemctl daemon-reexec
sudo systemctl daemon-reload

Step 6: Remove leftover .ollama or data directories in home

rm -rf ~/.ollama

Step 7: Purge unused Docker containers and volumes

docker stop $(docker ps -aq) 2>/dev/null
docker rm $(docker ps -aq) 2>/dev/null
docker volume prune -f
docker system prune -af --volumes

⚙️ PHASE 2: REBUILD WITH DOCKER + GPU SUPPORT (Persistent Glitchbrain Setup)

✅ Assumptions

  • You have Docker, Docker Compose, and NVIDIA Container Toolkit installed.

  • Your 2TB drive is mounted at /mnt/glitchbrain.


Step 1: Create persistent directories

sudo mkdir -p /mnt/glitchbrain/ollama
sudo mkdir -p /mnt/glitchbrain/openwebui-data
sudo chown -R jetson:jetson /mnt/glitchbrain

Step 2: Run Ollama + OpenWebUI (GPU bundle)

This bundles Ollama and OpenWebUI into a single container with GPU acceleration:

docker run -d \
  --gpus=all \
  -p 3000:8080 \
  -v /mnt/glitchbrain/ollama:/root/.ollama \
  -v /mnt/glitchbrain/openwebui-data:/app/backend/data \
  --name open-webui \
  --restart always \
  ghcr.io/open-webui/open-webui:ollama

Step 3: Confirm GPU is active

You should see your GPU with:

docker exec -it open-webui nvidia-smi

Or check if llama3 or codellama loads much faster vs CPU.


Step 4: Open WebUI in Browser

Visit:

http://localhost:3000

Or from LAN:

http://<your-gl1tchh3x-IP>:3000

🧠 Optional: Docker Compose Version

Create docker-compose.yml in ~/glitch-stack/:

version: '3.8'
services:
  open-webui:
    image: ghcr.io/open-webui/open-webui:ollama
    container_name: open-webui
    ports:
      - "3000:8080"
    volumes:
      - /mnt/glitchbrain/ollama:/root/.ollama
      - /mnt/glitchbrain/openwebui-data:/app/backend/data
    deploy:
      resources:
        reservations:
          devices:
            - capabilities: [gpu]
    restart: always
    environment:
      - NVIDIA_VISIBLE_DEVICES=all

Start it:

docker compose up -d

✅ TL;DR Summary

Task Description
Phase 1 Full removal of failed native OpenWebUI + Ollama installs
Phase 2 Launch Ollama + OpenWebUI from Docker, GPU-enabled
Storage All model/data live in /mnt/glitchbrain
Result Clean, fast, persistent, GPU-accelerated AI stack

🧩 Final Check

Want me to generate:

  • launch-glitchhex.sh launcher script?

  • .env file and Compose option?

  • Discord integration later?

Standing by, Boss-D.