@nitsan-ai/ragsuite-test 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +61 -63
- package/package.json +3 -2
- package/src/commands/doctor.js +17 -13
- package/src/commands/init.js +67 -112
- package/src/commands/start.js +25 -17
- package/src/commands/stop.js +23 -13
- package/src/index.js +4 -3
- package/src/utils/args.js +6 -0
- package/src/utils/config.js +11 -5
- package/src/utils/distribution.js +11 -11
- package/src/utils/images-install.js +100 -0
- package/src/utils/paths.js +34 -9
- package/templates/images/.env.example +76 -0
- package/templates/images/docker-compose.yml +165 -0
- package/templates/images/scripts/docker-doctor-images.sh +48 -0
- package/templates/images/scripts/docker-start-images.sh +107 -0
- package/templates/images/scripts/docker-stop-images.sh +22 -0
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Start pull-only images stack (no source build).
|
|
3
|
+
# Exit: 0 ok, 1 prereq, 2 env, 3 compose, 4 health
|
|
4
|
+
set -euo pipefail
|
|
5
|
+
|
|
6
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
7
|
+
ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
8
|
+
cd "$ROOT"
|
|
9
|
+
|
|
10
|
+
DETACH=1
|
|
11
|
+
for arg in "$@"; do
|
|
12
|
+
case "$arg" in
|
|
13
|
+
-d|--detach) DETACH=1 ;;
|
|
14
|
+
-h|--help)
|
|
15
|
+
echo "Usage: $0 [--detach|-d]"
|
|
16
|
+
echo " docker compose up -d (pull images, no --build)"
|
|
17
|
+
exit 0
|
|
18
|
+
;;
|
|
19
|
+
esac
|
|
20
|
+
done
|
|
21
|
+
|
|
22
|
+
if ! command -v docker >/dev/null 2>&1; then
|
|
23
|
+
echo "error: docker is required for images install" >&2
|
|
24
|
+
exit 1
|
|
25
|
+
fi
|
|
26
|
+
if ! docker info >/dev/null 2>&1; then
|
|
27
|
+
echo "error: Docker daemon is not running" >&2
|
|
28
|
+
exit 1
|
|
29
|
+
fi
|
|
30
|
+
if ! docker compose version >/dev/null 2>&1; then
|
|
31
|
+
echo "error: docker compose plugin is required" >&2
|
|
32
|
+
exit 1
|
|
33
|
+
fi
|
|
34
|
+
|
|
35
|
+
if [[ ! -f .env ]]; then
|
|
36
|
+
if [[ -f .env.example ]]; then
|
|
37
|
+
cp .env.example .env
|
|
38
|
+
echo "warn: created .env from .env.example — edit secrets for production"
|
|
39
|
+
else
|
|
40
|
+
echo "error: missing .env" >&2
|
|
41
|
+
exit 2
|
|
42
|
+
fi
|
|
43
|
+
fi
|
|
44
|
+
|
|
45
|
+
# shellcheck disable=SC1091
|
|
46
|
+
set -a
|
|
47
|
+
# shellcheck source=/dev/null
|
|
48
|
+
source .env
|
|
49
|
+
set +a
|
|
50
|
+
|
|
51
|
+
if [[ -z "${JWT_SECRET_KEY:-}" || "${JWT_SECRET_KEY}" == change-me* ]]; then
|
|
52
|
+
echo "error: JWT_SECRET_KEY must be set (non placeholder) in .env" >&2
|
|
53
|
+
exit 2
|
|
54
|
+
fi
|
|
55
|
+
if [[ -z "${CUSTOM_LLM_INTERNAL_API_KEY:-}" || "${CUSTOM_LLM_INTERNAL_API_KEY}" == change-me* ]]; then
|
|
56
|
+
echo "error: CUSTOM_LLM_INTERNAL_API_KEY must be set (non placeholder) in .env" >&2
|
|
57
|
+
exit 2
|
|
58
|
+
fi
|
|
59
|
+
|
|
60
|
+
export IMAGE_REGISTRY="${IMAGE_REGISTRY:-ghcr.io/nitsan-ai}"
|
|
61
|
+
export IMAGE_TAG="${IMAGE_TAG:-latest}"
|
|
62
|
+
export PULL_POLICY="${PULL_POLICY:-always}"
|
|
63
|
+
|
|
64
|
+
COMPOSE_FILE="${COMPOSE_FILE:-docker-compose.yml}"
|
|
65
|
+
if [[ ! -f "$COMPOSE_FILE" ]]; then
|
|
66
|
+
echo "error: missing $COMPOSE_FILE (images install)" >&2
|
|
67
|
+
exit 1
|
|
68
|
+
fi
|
|
69
|
+
|
|
70
|
+
echo "==> Pulling / starting images (no build) registry=${IMAGE_REGISTRY} tag=${IMAGE_TAG}"
|
|
71
|
+
set +e
|
|
72
|
+
docker compose -f "$COMPOSE_FILE" pull
|
|
73
|
+
docker compose -f "$COMPOSE_FILE" up -d --pull always
|
|
74
|
+
rc=$?
|
|
75
|
+
set -e
|
|
76
|
+
if [[ "$rc" -ne 0 ]]; then
|
|
77
|
+
echo "error: docker compose failed (exit $rc). Are GHCR images published and public/readable?" >&2
|
|
78
|
+
echo " Expected: ${IMAGE_REGISTRY}/ragsuite-backend:${IMAGE_TAG}" >&2
|
|
79
|
+
echo " Expected: ${IMAGE_REGISTRY}/ragsuite-frontend:${IMAGE_TAG}" >&2
|
|
80
|
+
exit 3
|
|
81
|
+
fi
|
|
82
|
+
|
|
83
|
+
API_PORT="${API_PORT:-9090}"
|
|
84
|
+
echo "==> Waiting for API :${API_PORT}"
|
|
85
|
+
ok=0
|
|
86
|
+
for _ in $(seq 1 60); do
|
|
87
|
+
if curl -sf "http://127.0.0.1:${API_PORT}/api/v1/crawl/auth/public-config" >/dev/null 2>&1 \
|
|
88
|
+
|| curl -sf "http://127.0.0.1:${API_PORT}/api/v1/health/ping" >/dev/null 2>&1; then
|
|
89
|
+
ok=1
|
|
90
|
+
break
|
|
91
|
+
fi
|
|
92
|
+
sleep 2
|
|
93
|
+
done
|
|
94
|
+
if [[ "$ok" -ne 1 ]]; then
|
|
95
|
+
echo "error: API health timed out" >&2
|
|
96
|
+
docker compose -f "$COMPOSE_FILE" ps -a || true
|
|
97
|
+
docker compose -f "$COMPOSE_FILE" logs backend --tail 80 || true
|
|
98
|
+
exit 4
|
|
99
|
+
fi
|
|
100
|
+
|
|
101
|
+
echo ""
|
|
102
|
+
echo "Stack URLs:"
|
|
103
|
+
echo " API http://localhost:${API_PORT}"
|
|
104
|
+
echo " Web UI http://localhost:${WEB_PORT:-9091}"
|
|
105
|
+
echo ""
|
|
106
|
+
echo "Images stack is up (no source tree required)."
|
|
107
|
+
exit 0
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Stop pull-only images stack (volumes preserved).
|
|
3
|
+
set -euo pipefail
|
|
4
|
+
|
|
5
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
6
|
+
ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
7
|
+
cd "$ROOT"
|
|
8
|
+
|
|
9
|
+
if ! command -v docker >/dev/null 2>&1; then
|
|
10
|
+
echo "error: docker required" >&2
|
|
11
|
+
exit 1
|
|
12
|
+
fi
|
|
13
|
+
if ! docker info >/dev/null 2>&1; then
|
|
14
|
+
echo "error: Docker daemon is not running" >&2
|
|
15
|
+
exit 1
|
|
16
|
+
fi
|
|
17
|
+
|
|
18
|
+
COMPOSE_FILE="${COMPOSE_FILE:-docker-compose.yml}"
|
|
19
|
+
echo "==> Stopping images stack (volumes preserved)…"
|
|
20
|
+
docker compose -f "$COMPOSE_FILE" down
|
|
21
|
+
echo "Containers stopped. Volumes kept."
|
|
22
|
+
exit 0
|