diff --git a/docker-compose.phala.yml b/docker-compose.phala.yml index 1c2238665..7c9a82f6a 100644 --- a/docker-compose.phala.yml +++ b/docker-compose.phala.yml @@ -1,7 +1,7 @@ # Clawdbot on Phala Cloud CVM # Deploy with: docker compose -f docker-compose.phala.yml up -d # -# Access the web UI at http://:18789 +# Access the web UI at http://-18789. # Configure channels and API keys via /setup (password protected) # # If REDPILL_API_KEY is set, the container auto-configures Redpill @@ -9,6 +9,7 @@ services: clawdbot: + # Comment out if using pre-built image build: context: . dockerfile: Dockerfile @@ -25,6 +26,7 @@ services: TELEGRAM_ALLOWED_USERS: ${TELEGRAM_ALLOWED_USERS:-} DISCORD_ALLOWED_USERS: ${DISCORD_ALLOWED_USERS:-} # Gateway configuration + GATEWAY_BIND: ${GATEWAY_BIND:-loopback} GATEWAY_PORT: ${GATEWAY_PORT:-18789} GATEWAY_AUTH: ${GATEWAY_AUTH:-off} GATEWAY_TOKEN: ${GATEWAY_TOKEN:-} @@ -36,10 +38,16 @@ services: # Persistent storage for credentials, agents, sessions - clawdbot-data:/data # Host network mode: container shares CVM's network stack - # Gateway binds to loopback, accessible via CVM's public IP + # Gateway binds to loopback by default, accessible via CVM's public IP network_mode: host restart: unless-stopped - entrypoint: ["/bin/bash", "/app/scripts/docker-entrypoint-phala.sh"] + user: root + command: > + bash -c " + mkdir -p /data/.clawdbot /data/workspace && + chown -R node:node /data && + su node -c '/bin/bash /app/scripts/docker-entrypoint-phala.sh' + " volumes: clawdbot-data: diff --git a/scripts/docker-entrypoint-phala.sh b/scripts/docker-entrypoint-phala.sh index 37c1b8830..908592713 100755 --- a/scripts/docker-entrypoint-phala.sh +++ b/scripts/docker-entrypoint-phala.sh @@ -39,7 +39,7 @@ if [ ! -f "$CONFIG_FILE" ] && [ -n "$REDPILL_API_KEY" ]; then --mode local \ --auth-choice redpill-api-key \ --workspace "${CLAWDBOT_WORKSPACE_DIR:-/data/workspace}" \ - --gateway-bind loopback \ + --gateway-bind ${GATEWAY_BIND:-loopback} \ $GATEWAY_AUTH_ARGS \ --skip-daemon \ --skip-skills \ @@ -86,6 +86,6 @@ fi # Start the gateway exec node dist/index.js gateway \ - --bind loopback \ + --bind ${GATEWAY_BIND:-loopback} \ --port "${GATEWAY_PORT:-18789}" \ --allow-unconfigured