|
| 1 | +# yaml-language-server: $schema=https://raw.githubusercontent.com/compose-spec/compose-spec/master/schema/compose-spec.json |
| 2 | +name: 'openclaw' |
| 3 | + |
| 4 | +# OP_SERVICE_ACCOUNT_TOKEN is set as an Arcane global variable by the |
| 5 | +# arcane-deploy workflow. It's available to all compose projects via |
| 6 | +# Arcane's .env.global mechanism. |
| 7 | + |
| 8 | +services: |
| 9 | + init-secrets: |
| 10 | + image: 1password/op:2 |
| 11 | + user: '0:0' # Run as root for putting in the secrets dir |
| 12 | + environment: |
| 13 | + - OP_SERVICE_ACCOUNT_TOKEN=${OP_SERVICE_ACCOUNT_TOKEN} |
| 14 | + volumes: |
| 15 | + - openclaw-secrets:/run/secrets:rw |
| 16 | + command: |
| 17 | + - /bin/bash |
| 18 | + - -c |
| 19 | + - | |
| 20 | + set -euo pipefail |
| 21 | + { |
| 22 | + function fetch() { |
| 23 | + local ref="$$1" |
| 24 | + local dest="$$2" |
| 25 | + op read --no-newline "$$ref" > "$$dest" |
| 26 | + echo " got '$$ref' => '$$dest'" |
| 27 | + } |
| 28 | + echo "Fetching all secrets in parallel..." |
| 29 | +
|
| 30 | + fetch "op://heapsinfra/arcane--heapsnas--openclaw/gateway_token" "/run/secrets/openclaw_gateway_token" & |
| 31 | +
|
| 32 | + wait |
| 33 | + chmod 444 /run/secrets/* |
| 34 | + } || { |
| 35 | + echo "Failed to fetch secrets, waiting 5 minutes before exiting" |
| 36 | + sleep 300 |
| 37 | + exit 1 |
| 38 | + } |
| 39 | +
|
| 40 | + openclaw-gateway: |
| 41 | + image: ghcr.io/openclaw/openclaw:latest |
| 42 | + restart: unless-stopped |
| 43 | + init: true |
| 44 | + environment: |
| 45 | + - HOME=/home/node |
| 46 | + - TERM=xterm-256color |
| 47 | + volumes: |
| 48 | + - openclaw-config:/home/node/.openclaw |
| 49 | + - openclaw-workspace:/home/node/.openclaw/workspace |
| 50 | + - openclaw-secrets:/run/secrets:ro |
| 51 | + ports: |
| 52 | + - '${OPENCLAW_GATEWAY_PORT:-18789}:18789' |
| 53 | + command: |
| 54 | + - node |
| 55 | + - dist/index.js |
| 56 | + - gateway |
| 57 | + - --bind |
| 58 | + - lan |
| 59 | + - --port |
| 60 | + - '18789' |
| 61 | + - --token-file |
| 62 | + - /run/secrets/openclaw_gateway_token |
| 63 | + healthcheck: |
| 64 | + test: |
| 65 | + - CMD |
| 66 | + - node |
| 67 | + - -e |
| 68 | + - "fetch('http://127.0.0.1:18789/healthz').then((r)=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))" |
| 69 | + interval: 30s |
| 70 | + timeout: 5s |
| 71 | + retries: 5 |
| 72 | + start_period: 20s |
| 73 | + networks: |
| 74 | + - cloudflared |
| 75 | + depends_on: |
| 76 | + init-secrets: |
| 77 | + condition: service_completed_successfully |
| 78 | + |
| 79 | + openclaw-cli: |
| 80 | + image: ghcr.io/openclaw/openclaw:latest |
| 81 | + restart: unless-stopped |
| 82 | + init: true |
| 83 | + network_mode: 'service:openclaw-gateway' |
| 84 | + cap_drop: |
| 85 | + - NET_RAW |
| 86 | + - NET_ADMIN |
| 87 | + security_opt: |
| 88 | + - no-new-privileges:true |
| 89 | + environment: |
| 90 | + - HOME=/home/node |
| 91 | + - TERM=xterm-256color |
| 92 | + - BROWSER=echo |
| 93 | + volumes: |
| 94 | + - openclaw-config:/home/node/.openclaw |
| 95 | + - openclaw-workspace:/home/node/.openclaw/workspace |
| 96 | + - openclaw-secrets:/run/secrets:ro |
| 97 | + stdin_open: true |
| 98 | + tty: true |
| 99 | + entrypoint: ['node', 'dist/index.js'] |
| 100 | + depends_on: |
| 101 | + openclaw-gateway: |
| 102 | + condition: service_healthy |
| 103 | + |
| 104 | +# https://docs.docker.com/engine/storage/drivers/ |
| 105 | +volumes: |
| 106 | + openclaw-secrets: |
| 107 | + driver: local |
| 108 | + openclaw-config: |
| 109 | + driver: local |
| 110 | + openclaw-workspace: |
| 111 | + driver: local |
| 112 | + |
| 113 | +# https://docs.docker.com/engine/network/drivers/ |
| 114 | +networks: |
| 115 | + cloudflared: |
| 116 | + external: true |
0 commit comments