Skip to content

armgit / Ix

Public Imported from GitHub
0

Understand any codebase instantly. System intelligence for codebases, built for humans and AI.

feat: Docker Compose + stack.sh for backend containers

riley02272553c2ef2bf7
diff --git a/dev.sh b/dev.sh
new file mode 100755
index 00000000..7e81d44a
--- /dev/null
+++ b/dev.sh
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+cd "$SCRIPT_DIR"
+
+case "${1:-up}" in
+ down)
+ docker compose stop arangodb
+ echo "ArangoDB stopped."
+ ;;
+ up|*)
+ echo "Starting ArangoDB..."
+ docker compose up -d arangodb
+ echo "Waiting for ArangoDB..."
+ for i in $(seq 1 20); do
+ if curl -sf http://localhost:8529/_api/version > /dev/null 2>&1; then
+ echo "ArangoDB is ready at http://localhost:8529"
+ echo ""
+ echo "To start the Memory Layer:"
+ echo " cd memory-layer && sbt run"
+ exit 0
+ fi
+ sleep 1
+ done
+ echo "Warning: ArangoDB health check timed out."
+ exit 1
+ ;;
+esac
diff --git a/docker-compose.yml b/docker-compose.yml
index 1663a134..e2e203c9 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,3 +1,4 @@
+version: "3.8"
services:
arangodb:
image: arangodb:3.12
@@ -5,3 +6,32 @@ services:
- "8529:8529"
environment:
ARANGO_NO_AUTH: "1"
+ volumes:
+ - ix_arango_data:/var/lib/arangodb3
+ healthcheck:
+ test: ["CMD", "curl", "-sf", "http://localhost:8529/_api/version"]
+ interval: 5s
+ timeout: 3s
+ retries: 10
+
+ memory-layer:
+ build:
+ context: ./memory-layer
+ dockerfile: Dockerfile
+ depends_on:
+ arangodb:
+ condition: service_healthy
+ ports:
+ - "8090:8090"
+ environment:
+ ARANGO_HOST: arangodb
+ ARANGO_PORT: "8529"
+ ARANGO_DATABASE: ix_memory
+ healthcheck:
+ test: ["CMD", "curl", "-sf", "http://localhost:8090/v1/health"]
+ interval: 5s
+ timeout: 3s
+ retries: 10
+
+volumes:
+ ix_arango_data:
diff --git a/memory-layer/Dockerfile b/memory-layer/Dockerfile
new file mode 100644
index 00000000..4c7c93d2
--- /dev/null
+++ b/memory-layer/Dockerfile
@@ -0,0 +1,5 @@
+FROM eclipse-temurin:17-jre-jammy
+WORKDIR /app
+COPY target/scala-2.13/ix-memory-assembly.jar app.jar
+EXPOSE 8090
+CMD ["java", "-jar", "app.jar"]
diff --git a/stack.sh b/stack.sh
new file mode 100755
index 00000000..cf94a3f5
--- /dev/null
+++ b/stack.sh
@@ -0,0 +1,35 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+cd "$SCRIPT_DIR"
+
+case "${1:-up}" in
+ down)
+ docker compose down
+ echo "Ix backend stopped."
+ ;;
+ logs)
+ docker compose logs -f
+ ;;
+ clean)
+ docker compose down -v
+ echo "Ix backend stopped and data volumes removed."
+ ;;
+ up|*)
+ echo "Building Memory Layer..."
+ (cd memory-layer && sbt assembly 2>&1 | tail -5)
+ echo "Starting Ix backend..."
+ docker compose up -d --build
+ echo "Waiting for health checks..."
+ for i in $(seq 1 30); do
+ if curl -sf http://localhost:8090/v1/health > /dev/null 2>&1; then
+ echo "Ix Memory backend is ready at http://localhost:8090"
+ exit 0
+ fi
+ sleep 2
+ done
+ echo "Warning: Backend health check timed out. Check 'docker compose logs' for details."
+ exit 1
+ ;;
+esac