# Everything on one small server: the account server (relay), HTTPS (Caddy), and AnyBot itself. # Set up: make server (= ./setup.sh: asks for the address, account and keys, writes .env and # Caddyfile, starts everything and checks it). Settings live only in .env; after changing it, or # to update: make update-server. Logs: make server-logs. # Don't start this with a bare `docker compose up`: on a host with both rootless and root Docker # that can reach the daemon without this server's data and bring up a second, empty server; the # make targets always use the one in .env (DOCKER_SOCKET) and the HTTPS port in its address. # AI keys: set them in .env, or set ANYBOT_RESTORE_FROM_ACCOUNT=1 to start from the newest backup # your Mac made (bots, chats, routines and the keys you set there). # # 大腦: this AnyBot is the brain of the account. It keeps the bots, chats, memory and routines, # and works even while your computers sleep. On each of your computers: 設定 › 手機與帳號 › # 大腦 › 「改用它當大腦」. Those computers then show these bots, and the bots can use them as hands # (screen, files, browser), asking you first as usual. A Linux computer without a screen can be # hands too: run `anybot setup` there and pick this brain. services: relay: build: context: ../.. dockerfile: relay/Dockerfile args: { JOBS: "${ANYBOT_BUILD_JOBS:-}" } restart: unless-stopped environment: # Your public address (for the links of sites the bots publish), e.g. https://anybot.example.com ANYBOT_RELAY_PUBLIC_URL: "${ANYBOT_RELAY_PUBLIC_URL:-}" ANYBOT_RELAY_INVITE: "${ANYBOT_RELAY_INVITE:-}" # Caddy (or `tailscale serve`) is in front: the caller's address is the one it reports. # Without this every login attempt counts as coming from the proxy, and a few wrong # passwords from anyone lock that account for everyone. RELAY_TRUST_PROXY: "1" volumes: - relay-data:/data caddy: image: caddy:2 restart: unless-stopped ports: ["80:80", "443:443"] volumes: # Written by setup.sh (your domain); ../../relay/Caddyfile is the template. - ./Caddyfile:/etc/caddy/Caddyfile:ro - caddy-data:/data depends_on: [relay] anybot: build: context: ../.. dockerfile: deploy/server/Dockerfile args: { JOBS: "${ANYBOT_BUILD_JOBS:-}" } restart: unless-stopped depends_on: [relay] # A second wall for the bots' computer (optional, Linux): install gVisor on this host # (see gvisor.dev/docs "Installation" for the apt repository + `apt-get install runsc`, # then register it in /etc/docker/daemon.json: {"runtimes": {"runsc": {"path": "runsc"}}} # and `systemctl restart docker`). In AnyBot: 設定 › 電腦 › 在哪裡執行 › 容器隔離 → # 「強隔離(gVisor)」, then rebuild the computer (更新). The box gets a virtualized # kernel and Chromium's own sandbox comes back on. On a host without runsc the box won't # start — switch 容器隔離 back to 標準. environment: ANYBOT_ACCOUNT: "http://relay:8080|${ANYBOT_USER}" ANYBOT_ACCOUNT_PASSWORD: "${ANYBOT_PASSWORD}" ANYBOT_HOST_NAME: "${ANYBOT_HOST_NAME:-雲端 AnyBot}" # First start on a new server: make the account (the first one needs no invite). ANYBOT_ACCOUNT_CREATE: "1" ANYBOT_RELAY_INVITE: "${ANYBOT_RELAY_INVITE:-}" XAI_API_KEY: "${XAI_API_KEY:-}" ANTHROPIC_API_KEY: "${ANTHROPIC_API_KEY:-}" OPENAI_API_KEY: "${OPENAI_API_KEY:-}" GEMINI_API_KEY: "${GEMINI_API_KEY:-}" ANYBOT_RESTORE_FROM_ACCOUNT: "${ANYBOT_RESTORE_FROM_ACCOUNT:-}" # The bots' computer goes by its own name: a desktop AnyBot on this same machine keeps # "anybot-box" for itself (and used to pause the brain's one as idle). ANYBOT_BOX_NAME: "anybot-brain-box" # The Docker socket is not mounted here any more (a mounted socket is full control of this # host). The bots' computer is driven through the filtered proxy below, which only answers # the calls cloudbox.rs makes: containers (run/start/stop/rm/inspect/ps), exec, volumes, # images and the box image build. DOCKER_HOST is the plain `docker` CLI default, which is # what src/cloudbox.rs uses when its own docker_host setting is empty. DOCKER_HOST: "tcp://docker-socket-proxy:2375" # 語音 on this server (the voice service below, when it is on): 設定 › 語音 is filled in # with it once; what you choose there afterwards stays. ANYBOT_VOICE_URL: "${ANYBOT_VOICE_URL:-}" ANYBOT_VOICE_LISTEN_MODEL: "${ANYBOT_VOICE_LISTEN_MODEL:-}" ANYBOT_VOICE_SPEAK_MODEL: "${ANYBOT_VOICE_SPEAK_MODEL:-}" ANYBOT_VOICE_VOICE: "${ANYBOT_VOICE_VOICE:-}" # 記憶的本機語意模型 is fetched from Hugging Face on the first start (530 MB, kept as # 130 MB under /data/models); a mirror when that can't be reached, e.g. https://hf-mirror.com. ANYBOT_HF_BASE: "${ANYBOT_HF_BASE:-}" networks: [default, docker-api] volumes: - anybot-data:/data # 語音 (optional: ./setup.sh asks; COMPOSE_PROFILES=voice in .env turns it on): speech to text # (Whisper) on this server's CPU for every screen and phone, with no key. speaches (MIT) speaks # OpenAI's audio API. No port is published: only the brain reaches it, at http://voice:8000/v1. # The model is downloaded once, into voice-models. (It reads English aloud but not Chinese: # reading aloud is set in 設定 › 語音, e.g. xAI.) voice: # The build checked with AnyBot (latest-cpu of 2025-09-19; the 0.8.2-cpu tag is older). image: ghcr.io/speaches-ai/speaches@sha256:21e3df06d842fb7802ab470dd77c25f0e8c0d22950e8d8c6ae886e851af53ef8 profiles: ["voice"] restart: unless-stopped # The brain asks it for ANYBOT_VOICE_LISTEN_MODEL at each start (this build has no # PRELOAD_MODELS): downloaded the first time, found at once after that. environment: WHISPER__COMPUTE_TYPE: "int8" # Stay loaded: the first sentence after a quiet hour shouldn't wait for a model to load. WHISPER__TTL: "-1" volumes: - voice-models:/home/ubuntu/.cache/huggingface/hub docker-socket-proxy: # https://github.com/Tecnativa/docker-socket-proxy: a small nginx in front of the Docker # socket with an endpoint allowlist. Keep this list minimal: adding an API here widens what # a compromised brain can do on this host (no AUTH, no SECRETS, no SWARM, no plugins). image: tecnativa/docker-socket-proxy:0.3.0 restart: unless-stopped environment: CONTAINERS: "1" # run, start, stop, rm, inspect, ps (the box's lifecycle) EXEC: "1" # docker exec: every screen step, box_exec, snapshots IMAGES: "1" # inspect/create the box image (build uploads it) BUILD: "1" # 更新/重建 builds the box image # A daemon of Docker 23 or newer says BuildKit is its builder (_ping: Builder-Version 2), # and the brain's docker then builds through a session: without these two the proxy # refuses it (403) and 更新/重建 can't make the box image. They reach only the builder. GRPC: "1" SESSION: "1" VOLUMES: "1" # anybot-box-home: inspect, create, rm (Reset/Restore) NETWORKS: "1" # inspect/attach (docker run needs the bridge network) POST: "1" GET: "1" # DOCKER_SOCKET in .env: the Docker this server lives on (setup.sh writes it at the first setup, # e.g. /run/user//docker.sock for rootless Docker, and starts compose on that same one). # The default /var/run/docker.sock is the root daemon; on a rootless host the proxy answers 503. networks: [docker-api] volumes: - ${DOCKER_SOCKET:-/var/run/docker.sock}:/var/run/docker.sock:ro networks: # Only `anybot` shares this internal network with `docker-socket-proxy`; `relay`, `caddy` and # `voice` cannot reach port 2375. docker-api: internal: true volumes: relay-data: caddy-data: anybot-data: voice-models: