Skip to main content

Setack Openclaw by Hosteg

version: "3.8"

services:

--------------------------- CLAWDBOT GATEWAY ---------------------------

clawdbot_gateway:
image: ramel/openclaw:1.1

environment:
  ## šŸ  Diretórios
  HOME: /root
  TERM: xterm-256color
  NODE_ENV: production

  ## šŸ” Token do Gateway
  CLAWDBOT_GATEWAY_TOKEN: "SEU_TOKEN"

  ## šŸ¤– OpenRouter / OpenAI / Gemini
  OPENAI_API_KEY: "SUA_API_KEY"

  ## 🌐 Gateway
  CLAWDBOT_GATEWAY_MODE: local
  CLAWDBOT_GATEWAY_BIND: 0.0.0.0
  CLAWDBOT_GATEWAY_PORT: 18789

  ## ā° Timezone
  TZ: America/Sao_Paulo

volumes:
  - clawdbot_config:/root/.clawdbot
  - clawdbot_workspace:/root/clawd

  # āš ļø Altamente permissivos — mantenha só se souber o risco
  - /var/run/docker.sock:/var/run/docker.sock
  - /:/host:rw
  - /root:/host_root:rw
  - /opt:/opt:rw
  - /etc:/etc:ro

networks:
  - openclaw_hosteg_network

user: root

command:
  - /bin/sh
  - -lc
  - |
    set -e

    # Instala docker cli se necessƔrio
    apt-get update 
      && apt-get install -y docker.io --no-install-recommends 
      && rm -rf /var/lib/apt/lists/*

    mkdir -p /root/.clawdbot

    cat > /root/.clawdbot/clawdbot.json << 'EOF'
    {
      "gateway": {
        "mode": "local",
        "bind": "lan",
        "trustedProxies": [
          "10.0.0.0/8",
          "172.16.0.0/12",
          "192.168.0.0/16"
        ],
        "auth": { "mode": "token" },
        "controlUi": {
          "dangerouslyDisableDeviceAuth": true
        }
      },
      "agents": {
        "defaults": {
          "model": {
            "primary": "openai/gpt-5.2"
          },
          "workspace": "/root/clawd"
        }
      },
      "channels": {
        "telegram": {},
        "whatsapp": {}
      }
    }
    EOF

    export HOME=/root
    node dist/index.js gateway run --port 18789 --force

deploy:
  mode: replicated
  replicas: 1

  placement:
    constraints:
      - node.role == manager

  resources:
    limits:
      cpus: "2"
      memory: 2048M

  labels:
    - traefik.enable=true
    - traefik.http.routers.clawdbot.rule=Host(`SEUSITE.com.br`)
    - traefik.http.routers.clawdbot.entrypoints=websecure
    - traefik.http.routers.clawdbot.priority=1
    - traefik.http.routers.clawdbot.tls.certresolver=letsencryptresolver
    - traefik.http.routers.clawdbot.service=clawdbot
    - traefik.http.services.clawdbot.loadbalancer.server.port=18789
    - traefik.http.services.clawdbot.loadbalancer.passHostHeader=true

  update_config:
    parallelism: 1
    delay: 30s
    order: start-first
    failure_action: rollback

  restart_policy:
    condition: any
    delay: 5s
    max_attempts: 3

healthcheck:
  test: ["CMD", "node", "dist/index.js", "health", "--json"]
  interval: 30s
  timeout: 10s
  retries: 3
  start_period: 60s

--------------------------- CLAWDBOT CLI (opcional) ---------------------------

clawdbot_cli:
image: ramel/openclaw:1.1

environment:
  HOME: /root
  TERM: xterm-256color
  TZ: America/Sao_Paulo
  OPENAI_API_KEY: "SUA_API_KEY"

volumes:
  - clawdbot_config:/root/.clawdbot
  - clawdbot_workspace:/root/clawd

networks:
  - openclaw_hosteg_network

stdin_open: true
tty: true
entrypoint: ["node", "dist/index.js"]

deploy:
  mode: replicated
  replicas: 0
  # docker service scale clawdbot_clawdbot_cli=1

volumes:
clawdbot_config:
driver: local
clawdbot_workspace:
driver: local

networks:
openclaw_hosteg_network:
external: true
name: openclaw_hosteg_network