File size: 3,657 Bytes
759c0a1
 
 
 
 
 
 
 
 
 
6d73319
 
 
 
 
4d807f3
6d73319
4d807f3
 
6d73319
 
 
 
 
 
 
 
 
 
759c0a1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6d73319
 
 
 
 
759c0a1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
version: "0.5"

log_level: info
# Logs to stdout when log_location not set (required for Docker visibility)

environment:
  - HOME=/home/user
  - PATH=/home/user/.local/bin:/usr/local/bin:/usr/bin:/bin

processes:
  tailscale:
    command: >-
      sh -c '
      if [ -n "$TS_AUTHKEY" ]; then
        echo "[vpn] Starting mesh network (userspace)..."
        tailscaled --tun=userspace-networking --state=/tmp/tailscaled --socket=/tmp/tailscaled.sock --socks5-server=localhost:1055 &
        sleep 3
        tailscale --socket=/tmp/tailscaled.sock up --authkey="$TS_AUTHKEY" --hostname=neural-runner
        echo "[vpn] Up: $(tailscale --socket=/tmp/tailscaled.sock ip -4 2>/dev/null)"
        tail -f /dev/null
      else
        echo "[vpn] No TS_AUTHKEY — skipping"
        tail -f /dev/null
      fi'
    availability:
      restart: on_failure
      backoff_seconds: 10
      max_restarts: 3

  nextjs:
    command: sh -c 'node /home/user/app/frontend/server.js 2>&1 | sed -u "s/^/[nextjs] [${GIT_COMMIT:-unknown}] /"'
    working_dir: /home/user/app/frontend
    availability:
      restart: always
      backoff_seconds: 2
      max_restarts: 0  # unlimited
    environment:
      - PORT=7860
      - HOSTNAME=0.0.0.0
      - MCP_GARMIN_URL=http://localhost:8080/mcp
      - MCP_COROS_URL=http://localhost:8081/mcp
      - MCP_AGENT_URL=http://localhost:8082/mcp
      - NODE_ENV=production
    readiness_probe:
      http_get:
        host: localhost
        port: 7860
        path: /api/healthz
      initial_delay_seconds: 2
      period_seconds: 30
      timeout_seconds: 5
      success_threshold: 1
      failure_threshold: 3

  garmin-mcp:
    command: sh -c 'python3 -m garmin_mcp --http --port 8080 2>&1 | sed -u "s/^/[garmin-mcp] [${GIT_COMMIT:-unknown}] /"'
    working_dir: /home/user/app
    environment:
      - TS_SOCKS_PROXY=socks5h://localhost:1055
    depends_on:
      tailscale:
        condition: process_started
    availability:
      restart: on_failure
      backoff_seconds: 5
      max_restarts: 3

  coros-mcp:
    command: sh -c 'python3 -m coros_mcp --http --port 8081 2>&1 | sed -u "s/^/[coros-mcp] [${GIT_COMMIT:-unknown}] /"'
    working_dir: /home/user/app
    availability:
      restart: on_failure
      backoff_seconds: 5
      max_restarts: 3
    # No environment variables needed - fully stateless (memory-only)

  agent-tools:
    # bwrap sandbox: agent-tools can only write to /tmp/neural-runner/sessions/ (per-session dirs).
    # Tokens, app source, and secrets are invisible. Python/libs/fonts are read-only.
    command: >-
      sh -c 'mkdir -p /tmp/neural-runner/sessions && bwrap
      --ro-bind /usr /usr
      --ro-bind /lib /lib
      --ro-bind /bin /bin
      --ro-bind /sbin /sbin
      --symlink /usr/lib64 /lib64
      --ro-bind /usr/local /usr/local
      --ro-bind /etc/resolv.conf /etc/resolv.conf
      --ro-bind /etc/ssl /etc/ssl
      --ro-bind /etc/nsswitch.conf /etc/nsswitch.conf
      --proc /proc
      --dev /dev
      --tmpfs /tmp
      --bind /tmp/neural-runner/sessions /tmp/neural-runner/sessions
      --
      python3 -m agent_tools --http --port 8082 2>&1 | sed -u "s/^/[agent-tools] [${GIT_COMMIT:-unknown}] /"'
    working_dir: /home/user/app
    availability:
      restart: on_failure
      backoff_seconds: 5
      max_restarts: 3

  hf-storage-sync:
    command: sh -c 'python3 /home/user/app/hf-storage-sync.py 2>&1 | sed -u "s/^/[hf-storage-sync] /"'
    working_dir: /home/user/app
    environment:
      - SYNC_ROOT=/tmp/neural-runner
      - SYNC_DIRS=tokens,subagents
    availability:
      restart: on_failure
      backoff_seconds: 10
      max_restarts: 3