From 6c84b0a0b5b0b0fa6b385ed1713a93f5da9837eb Mon Sep 17 00:00:00 2001 From: jenstandstad Date: Tue, 14 Apr 2026 21:24:40 +0200 Subject: [PATCH] Adding fixes --- docker-compose.yml | 1 + start.sh | 56 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100755 start.sh diff --git a/docker-compose.yml b/docker-compose.yml index 5cbe2e0..cffb9fc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,6 +7,7 @@ services: - "50001:80" # local dev access — not needed once tunnel is running volumes: - ./agent-zero-data:/a0/usr + - ./agent-zero-data/ssh:/root/.ssh # persist SSH keys across container restarts restart: unless-stopped environment: AUTH_LOGIN: ${AUTH_LOGIN} diff --git a/start.sh b/start.sh new file mode 100755 index 0000000..6dd9e89 --- /dev/null +++ b/start.sh @@ -0,0 +1,56 @@ +#!/usr/bin/env bash +# start.sh — start Agent0 and the glitch-tunnel. +# +# Run this every time (after reboots, etc.). +# Run bootstrap.sh once first to set everything up. + +set -euo pipefail + +REPO_DIR="$(cd "$(dirname "$0")" && pwd)" +OS="$(uname -s)" + +GREEN='\033[0;32m'; YELLOW='\033[1;33m'; NC='\033[0m' +info() { echo -e "${GREEN}✓${NC} $*"; } +warn() { echo -e "${YELLOW}!${NC} $*"; } + +cd "$REPO_DIR" + +# ── Sanity check ────────────────────────────────────────────────────────────── +if [[ ! -f "${REPO_DIR}/.env" ]]; then + echo "No .env found. Run bootstrap.sh first." + exit 1 +fi + +# ── Ollama ──────────────────────────────────────────────────────────────────── +if [[ "$OS" == "Linux" ]]; then + if systemctl is-active --quiet ollama 2>/dev/null; then + info "Ollama already running" + else + info "Starting Ollama..." + sudo systemctl start ollama + fi +else + if curl -sf http://localhost:11434/api/tags >/dev/null 2>&1; then + info "Ollama already running" + else + info "Starting Ollama..." + ollama serve >/tmp/ollama.log 2>&1 & + sleep 2 + curl -sf http://localhost:11434/api/tags >/dev/null 2>&1 \ + && info "Ollama started" \ + || warn "Ollama didn't respond — check: ollama serve" + fi +fi + +# ── Docker containers ───────────────────────────────────────────────────────── +info "Starting agent0..." +docker compose up -d agent0 + +info "Starting glitch-tunnel..." +docker compose up -d glitch-tunnel + +echo "" +docker compose ps + +echo "" +info "Agent0 is up. Open https://agent0.glitch.university"