-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
107 lines (90 loc) · 4.29 KB
/
install.sh
File metadata and controls
107 lines (90 loc) · 4.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#!/usr/bin/env bash
# ECHOFORM Ghost Memory — one-line installer (Linux/macOS).
#
# Usage:
# curl -fsSL https://raw.githubusercontent.com/OpenAgentic-Labs/echoform-ghost-memory/main/install.sh | bash
#
# This script:
# 1. Checks for Docker + docker compose; offers to install Docker if missing.
# 2. Pulls the official echoform/ghost-memory:latest image (or builds local).
# 3. Brings up the full production stack (api + worker + postgres + redis + minio).
# 4. Waits for /healthz, then opens http://localhost:8080 in the user's browser.
set -euo pipefail
BLUE="\033[34m"; GREEN="\033[32m"; RED="\033[31m"; DIM="\033[2m"; CLR="\033[0m"
say() { printf "${BLUE}▸${CLR} %s\n" "$*"; }
ok() { printf "${GREEN}✓${CLR} %s\n" "$*"; }
err() { printf "${RED}✗${CLR} %s\n" "$*" >&2; }
INSTALL_DIR="${ECHOFORM_HOME:-$HOME/.echoform}"
PORT="${ECHOFORM_PORT:-8080}"
say "ECHOFORM Ghost Memory — local install"
say "Install dir: $INSTALL_DIR"
say "Port: $PORT"
# 1. Docker check ───────────────────────────────────────────────────────────────
if ! command -v docker >/dev/null 2>&1; then
err "Docker not installed."
cat <<'EOF'
Install Docker first:
macOS / Windows: https://www.docker.com/products/docker-desktop/
Linux: https://docs.docker.com/engine/install/
Then re-run this installer.
EOF
exit 1
fi
ok "Docker found: $(docker --version)"
if ! docker compose version >/dev/null 2>&1; then
err "'docker compose' plugin missing (Docker Compose v2 required)."
exit 1
fi
ok "Docker Compose v2 found"
# 2. Fetch / clone repo ────────────────────────────────────────────────────────
mkdir -p "$INSTALL_DIR"
if [ ! -f "$INSTALL_DIR/docker-compose.yml" ]; then
say "Downloading compose file..."
if command -v curl >/dev/null 2>&1; then
curl -fsSL https://raw.githubusercontent.com/OpenAgentic-Labs/echoform-ghost-memory/main/docker-compose.yml \
-o "$INSTALL_DIR/docker-compose.yml" || {
err "Download failed — falling back to local clone."
git clone --depth 1 https://github.com/OpenAgentic-Labs/echoform-ghost-memory "$INSTALL_DIR/repo"
cp "$INSTALL_DIR/repo/docker-compose.yml" "$INSTALL_DIR/docker-compose.yml"
}
else
git clone --depth 1 https://github.com/OpenAgentic-Labs/echoform-ghost-memory "$INSTALL_DIR/repo"
cp "$INSTALL_DIR/repo/docker-compose.yml" "$INSTALL_DIR/docker-compose.yml"
fi
fi
ok "Compose file ready"
# 3. Bring up the stack ────────────────────────────────────────────────────────
cd "$INSTALL_DIR"
say "Pulling images (this can take ~2 min on first run)..."
docker compose pull 2>&1 | grep -v "^$" || true
say "Starting services..."
docker compose up -d
ok "Services started"
# 4. Wait for health ───────────────────────────────────────────────────────────
say "Waiting for /healthz (up to 90s)..."
for i in $(seq 1 90); do
if curl -fsS "http://localhost:${PORT}/healthz" >/dev/null 2>&1; then
ok "Server healthy"
break
fi
sleep 1
printf "${DIM}.${CLR}"
done
printf "\n"
# 5. Open the browser ──────────────────────────────────────────────────────────
URL="http://localhost:${PORT}/"
if command -v xdg-open >/dev/null 2>&1; then
xdg-open "$URL" >/dev/null 2>&1 || true
elif command -v open >/dev/null 2>&1; then
open "$URL" >/dev/null 2>&1 || true
fi
cat <<EOF
${GREEN}✓ ECHOFORM is running.${CLR}
Web UI: ${BLUE}${URL}${CLR}
API docs: ${BLUE}http://localhost:${PORT}/docs${CLR}
Metrics: ${BLUE}http://localhost:${PORT}/metrics${CLR}
Health: ${BLUE}http://localhost:${PORT}/healthz${CLR}
To stop: cd ${INSTALL_DIR} && docker compose down
To uninstall: cd ${INSTALL_DIR} && docker compose down -v && rm -rf ${INSTALL_DIR}
To upgrade: cd ${INSTALL_DIR} && docker compose pull && docker compose up -d
EOF