-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
133 lines (123 loc) · 4.45 KB
/
Copy pathdocker-compose.yml
File metadata and controls
133 lines (123 loc) · 4.45 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# Sage Docker Compose
# Run with: docker compose up
#
# Prerequisites:
# - Maple Desktop running on host (port 8089) OR maple-proxy
# - Signal account already registered (data in ~/.local/share/signal-cli)
#
# First-time setup:
# 1. Ensure signal-cli data exists at ~/.local/share/signal-cli
# 2. Copy .env.example to .env and configure
# 3. Run: docker compose up
services:
# PostgreSQL with pgvector for memory storage
postgres:
image: pgvector/pgvector:pg17
container_name: sage-postgres
environment:
POSTGRES_USER: sage
POSTGRES_PASSWORD: sage
POSTGRES_DB: sage
ports:
- "5434:5432" # Use 5434 externally to match dev setup
volumes:
- sage-postgres-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U sage -d sage"]
interval: 5s
timeout: 5s
retries: 5
start_period: 10s
# signal-cli daemon for Signal messaging
# Uses JRE image for reliability (native/GraalVM image has known issues with
# message delivery - see https://github.com/AnthonyRonning/sage/issues/4)
signal-cli:
image: registry.gitlab.com/packaging/signal-cli/signal-cli-jre:latest
container_name: sage-signal-cli
command: ["daemon", "--tcp", "0.0.0.0:7583", "--send-read-receipts", "--ignore-stories"]
ports:
- "7583:7583"
volumes:
# Use a named volume (populated via `just signal-init`)
# Run `just signal-init` before first use to copy ~/.local/share/signal-cli/data into the volume
- signal-cli-data:/var/lib/signal-cli
tmpfs:
- /tmp:exec
# TCP keepalive settings to detect dead connections faster and prevent NAT timeout drops
# These help maintain long-running connections in Docker's bridge network
sysctls:
- net.ipv4.tcp_keepalive_time=30 # Start probing after 30s idle (default 7200)
- net.ipv4.tcp_keepalive_intvl=10 # Probe every 10s (default 75)
- net.ipv4.tcp_keepalive_probes=3 # Give up after 3 failed probes (default 9)
healthcheck:
# Avoid connection churn / broken-pipe noise by issuing a real JSON-RPC request.
test:
- CMD-SHELL
- 'echo "{\"jsonrpc\":\"2.0\",\"method\":\"listAccounts\",\"id\":1}" | timeout 5 nc localhost 7583 | grep -q result'
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
restart: unless-stopped
# One-shot init: make signal-cli attachments readable by sage
signal-cli-perms:
image: docker.io/alpine:latest
container_name: sage-signal-cli-perms
volumes:
- signal-cli-data:/signal-cli-data
entrypoint: ["sh", "-c", "chmod o+rX /signal-cli-data/.local/share/signal-cli/attachments 2>/dev/null || true"]
depends_on:
signal-cli:
condition: service_healthy
# Sage V2 - Rust AI agent
sage:
build:
context: .
dockerfile: Dockerfile
container_name: sage
depends_on:
postgres:
condition: service_healthy
signal-cli:
condition: service_healthy
signal-cli-perms:
condition: service_completed_successfully
ports:
- "8080:8080" # Health check port
volumes:
- ${SAGE_WORKSPACE:-~/.sage/workspace}:/workspace:rw
- signal-cli-data:/signal-cli-data:ro
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
interval: 30s
timeout: 5s
retries: 3
start_period: 30s
environment:
# Database
- DATABASE_URL=postgres://sage:sage@postgres:5432/sage
# LLM Backend (Maple)
- MAPLE_API_URL=${MAPLE_API_URL:-http://host.docker.internal:8089/v1}
- MAPLE_API_KEY=${MAPLE_API_KEY}
- MAPLE_MODEL=${MAPLE_MODEL:-kimi-k2-5}
- MAPLE_EMBEDDING_MODEL=${MAPLE_EMBEDDING_MODEL:-maple/nomic-embed-text}
- MAPLE_VISION_MODEL=${MAPLE_VISION_MODEL:-${MAPLE_MODEL:-kimi-k2-5}}
# Signal (TCP mode to signal-cli container)
- SIGNAL_CLI_HOST=signal-cli
- SIGNAL_CLI_PORT=7583
- SIGNAL_PHONE_NUMBER=${SIGNAL_PHONE_NUMBER}
- SIGNAL_ALLOWED_USERS=${SIGNAL_ALLOWED_USERS}
# Tools
- BRAVE_API_KEY=${BRAVE_API_KEY:-}
# Workspace
- SAGE_WORKSPACE=/workspace
# Logging
- RUST_LOG=${RUST_LOG:-info}
extra_hosts:
- "host.docker.internal:host-gateway"
restart: unless-stopped
volumes:
sage-postgres-data:
# Named volume for PostgreSQL data persistence
signal-cli-data:
# Named volume for signal-cli data (run `just signal-init` to populate)