This repository has been archived on 2026-11-17. You can view files and clone it, but cannot push or open issues or pull requests.
caelum0x 49b183818c Unify gitgram + aitimemachine into the monorepo (de-submodule) and merge vendored engines
Convert gitgram/ and aitimemachine/ from embedded git repos (which showed as
opaque submodule gitlinks on GitHub) into fully-tracked first-party content.

AITM now merges its 7 vendored repos as first-party engines:
- memory: beads (Go task DAG) + context7 (docs SDK), unified into saved_contexts
- git: vendored C git (bundled binary) + gitnexus (in-process code intelligence)
- agentic: a2a (@a2a-js/sdk) + pal (AITM-managed Python subprocess)

Includes the full session's product build: Gitgram web/mobile/backend features,
AITM website/CLI/MCP, the unified memory layer, engine build tooling
(scripts/build-engines.sh, Dockerfile, CI), docs (README, ENGINES.md, ARCHITECTURE.md),
and extensive test suites.

Build artifacts, node_modules, external/, and gemini-cli are gitignored.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 14:14:09 +03:00

100 lines
3.0 KiB
Bash

#!/bin/bash
set -euo pipefail
# Colors for output
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m'
echo -e "${GREEN}=== Deploying PAL MCP Server ===${NC}"
# Function to check if required environment variables are set
check_env_vars() {
# At least one of these API keys must be set
local required_vars=("GEMINI_API_KEY" "GOOGLE_API_KEY" "OPENAI_API_KEY" "XAI_API_KEY" "DIAL_API_KEY" "OPENROUTER_API_KEY")
local has_api_key=false
for var in "${required_vars[@]}"; do
if [[ -n "${!var:-}" ]]; then
has_api_key=true
break
fi
done
if [[ "$has_api_key" == false ]]; then
echo -e "${RED}Error: At least one API key must be set in your .env file${NC}"
printf ' %s\n' "${required_vars[@]}"
exit 1
fi
}
# Load environment variables
if [[ -f .env ]]; then
set -a
source .env
set +a
echo -e "${GREEN}✓ Environment variables loaded from .env${NC}"
else
echo -e "${RED}Error: .env file not found${NC}"
echo -e "${YELLOW}Please copy .env.example to .env and configure your API keys${NC}"
exit 1
fi
# Check required environment variables
check_env_vars
# Exponential backoff health check function
wait_for_health() {
local max_attempts=6
local attempt=1
local delay=2
while (( attempt <= max_attempts )); do
status=$(docker-compose ps -q pal-mcp | xargs docker inspect -f "{{.State.Health.Status}}" 2>/dev/null || echo "unavailable")
if [[ "$status" == "healthy" ]]; then
return 0
fi
echo -e "${YELLOW}Waiting for service to be healthy... (attempt $attempt/${max_attempts}, retrying in ${delay}s)${NC}"
sleep $delay
delay=$(( delay * 2 ))
attempt=$(( attempt + 1 ))
done
echo -e "${RED}Service failed to become healthy after $max_attempts attempts${NC}"
echo -e "${YELLOW}Checking logs:${NC}"
docker-compose logs pal-mcp
exit 1
}
# Create logs directory if it doesn't exist
mkdir -p logs
# Stop existing containers
echo -e "${GREEN}Stopping existing containers...${NC}"
docker-compose down
# Start the services
echo -e "${GREEN}Starting PAL MCP Server...${NC}"
docker-compose up -d
# Wait for health check
echo -e "${GREEN}Waiting for service to be healthy...${NC}"
timeout 60 bash -c 'while [[ "$(docker-compose ps -q pal-mcp | xargs docker inspect -f "{{.State.Health.Status}}")" != "healthy" ]]; do sleep 2; done' || {
wait_for_health
echo -e "${RED}Service failed to become healthy${NC}"
echo -e "${YELLOW}Checking logs:${NC}"
docker-compose logs pal-mcp
exit 1
}
echo -e "${GREEN}✓ PAL MCP Server deployed successfully${NC}"
echo -e "${GREEN}Service Status:${NC}"
docker-compose ps
echo -e "${GREEN}=== Deployment Complete ===${NC}"
echo -e "${YELLOW}Useful commands:${NC}"
echo -e " View logs: ${GREEN}docker-compose logs -f pal-mcp${NC}"
echo -e " Stop service: ${GREEN}docker-compose down${NC}"
echo -e " Restart service: ${GREEN}docker-compose restart pal-mcp${NC}"