Ctrl K
ComunidadGuías…

deploy/docker-compose.yml

Rama main · réplica de lectura del repositorio original.

Archivo original ↗Preguntar a KiBot
# One OpenMausBot tenant: the harness server plus Caddy for TLS + login.
#
# The server only listens on loopback inside its container, and on two Unix
# sockets in the `edge` volume; Caddy, in its own container, reaches it through
# those. A request on a socket is never a local one: it needs a session, and
# X-Forwarded-For names the client, exactly as when Caddy shared the server's
# network. Caddy no longer shares that network because a server restarted on
# its own (a crash, `docker compose restart`, `stop omb`) came back in a new
# one, leaving Caddy in the old one with HTTPS refused while both looked
# healthy; a socket path is the same file again as soon as the server is back.
#
#   cp .env.example .env   # set DOMAIN
#   docker compose pull omb && docker compose up -d     # prebuilt image
#   docker compose up -d --build                        # or build from source
#   ./update.sh                                         # later: the stable version, with a way back
services:
  omb:
    build:
      context: ..
      args:
        ENGINES: ${ENGINES:-}
    # update.sh pins OMB_IMAGE in .env to the stable version's digest. Without it: `latest`, prebuilt on every main
    # push; `docker compose up --build` builds from source instead.
    image: ${OMB_IMAGE:-ghcr.io/milind-soni/openmausbot:latest}
    restart: unless-stopped
    # The bots' browsers (docs/browser-packaging.md, "Process hygiene"): an
    # init collects the browser processes whose parents exit, and Chrome
    # gets the shared memory OMB's desktop containers give it.
    init: true
    shm_size: 512m
    volumes:
      - data:/data
      - edge:/run/openmausbot
    environment:
      OMB_PORT: "8799"
      OMB_WEBHOOK_PORT: "8800"
      # What Caddy connects to (deploy/Caddyfile).
      OMB_TUNNEL_SOCKET: /run/openmausbot/http.sock
      OMB_WEBHOOK_SOCKET: /run/openmausbot/hooks.sock
      # what the app prints as hook URLs — Caddy passes /hooks/* straight through
      OMB_WEBHOOK_PUBLIC_URL: https://${DOMAIN}
      # pairing links for remote clients point here (docs/self-hosting.md)
      OMB_PUBLIC_URL: https://${DOMAIN}
      OMB_SERVER_NAME: ${OMB_SERVER_NAME:-${DOMAIN}}
      # Who may sign in with an emailed code at /pair (docs/self-hosting.md,
      # "Sign in with your email"), and your own mail server for the codes.
      # With no value here, each is passed only when .env sets it. A list
      # .env leaves empty is Settings → Remote access's to manage; one that
      # names someone decides that list, and Settings refuses to change it.
      OMB_SIGNIN_EMAILS:
      OMB_SIGNIN_MEMBER_EMAILS:
      OMB_SIGNIN_SMTP_URL:
      OMB_SIGNIN_SMTP_FROM:
      # "1": phones pair by QR through MausBot Relay (docs/phone-relay-server.md). Sign the
      # container in once first: docker compose exec omb openmausbot login --relay
      OMB_PHONE_RELAY:
    healthcheck:
      test: ["CMD-SHELL", "curl -sf http://127.0.0.1:8799/api/health | grep -q openmausbot"]
      interval: 30s
      timeout: 5s
      retries: 3

  caddy:
    image: caddy:2
    restart: unless-stopped
    ports:
      - "80:80"
      - "443:443"
    # Started with the server, not after it is healthy: Caddy reaches it over the socket
    # whenever it answers, so `up` never waits on the server's health, and HTTPS is back
    # as soon as a restarted server is.
    depends_on:
      omb:
        condition: service_started
    environment:
      DOMAIN: ${DOMAIN}
    volumes:
      - ./Caddyfile:/etc/caddy/Caddyfile:ro
      - edge:/run/openmausbot
      - caddy_data:/data
      - caddy_config:/config

volumes:
  data:
  # The two sockets: in memory, made afresh by the server at each start. Not
  # under /data, which every bot's sandbox sees; the sandbox has its own /run.
  edge:
    driver_opts:
      type: tmpfs
      device: tmpfs
      o: mode=1777,size=1m
  caddy_data:
  caddy_config: