added k3s deployment on RPi

This commit is contained in:
stevef 2026-03-28 13:47:35 +01:00
parent 6c277610df
commit 9edd527d19
6 changed files with 729 additions and 1 deletions

View file

@ -2,7 +2,7 @@
.gitignore .gitignore
build/ build/
.picoclaw/ .picoclaw/
config/ # config/
.env .env
.env.example .env.example
*.md *.md

68
docker/Dockerfile.rpi Normal file
View file

@ -0,0 +1,68 @@
# ============================================================
# Stage 1: Build the picoclaw binaries
# ============================================================
FROM golang:1.25-alpine AS builder
WORKDIR /app
# Cache dependencies
COPY go.mod go.sum ./
RUN go mod download
# Copy source
COPY . .
# Build main binary for ARM64 (Raspberry Pi)
# We enable standard JSON and Go-based OLM for Matrix
RUN CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -tags goolm,stdjson -ldflags="-s -w" -o bin/picoclaw ./cmd/picoclaw
# Build additional tools from cmd/ as individual binaries (e.g. launcher-tui)
# This follows your requested tool-building pattern
RUN set -e; \
mkdir -p bin/tools; \
for d in $(find cmd -maxdepth 1 -type d -not -path 'cmd' -not -path 'cmd/picoclaw'); do \
name=$(basename "$d"); \
echo "Building tool: $name"; \
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -tags goolm,stdjson -ldflags="-s -w" -o bin/tools/$name ./$d; \
done
# ============================================================
# Stage 2: Final runtime image - lightweight Alpine
# ============================================================
FROM alpine:latest
# Install runtime dependencies as requested
RUN apk add --no-cache \
ca-certificates \
openssh-client \
bash \
tzdata && \
update-ca-certificates
WORKDIR /app
# Copy main binary
COPY --from=builder /app/bin/picoclaw /app/picoclaw
# Copy additional tools (PICOCLAW_HOME typically looks for binaries here)
RUN mkdir -p /app/bin/tools
COPY --from=builder /app/bin/tools/ /app/bin/tools/
RUN chmod -R +x /app/bin/tools || true
# App configuration: use the example template by default
COPY config/config.example.json ./config.json
# If you have specific MCP skill configurations, copy them here
# Matching your requested template structure
RUN mkdir -p ./config
COPY config/config.example.json ./config/mcp_skills.json
# Initial setup: run onboard to create initial directories and local state
RUN /app/picoclaw onboard
# Expose Gateway port
EXPOSE 18790
# Standard entrypoint for PicoClaw
ENTRYPOINT ["/app/picoclaw"]
CMD ["gateway"]

581
k3s/configmap.yaml Normal file
View file

@ -0,0 +1,581 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: picoclaw-config
namespace: agi
data:
config.json: |
{
"session": {
"dm_scope": "per-channel-peer"
},
"version": 1,
"agents": {
"defaults": {
"workspace": "",
"restrict_to_workspace": true,
"allow_read_outside_workspace": false,
"provider": "",
"model_name": "nemotron-3-super-120b-a12b",
"max_tokens": 32768,
"max_tool_iterations": 50,
"summarize_message_threshold": 20,
"summarize_token_percent": 75,
"steering_mode": "one-at-a-time",
"subturn": {
"max_depth": 10,
"max_concurrent": 5,
"default_timeout_minutes": 20,
"default_token_budget": 100000,
"concurrency_timeout_sec": 10
},
"tool_feedback": {
"enabled": true,
"max_args_length": 300
}
}
},
"channels": {
"whatsapp": {
"enabled": false,
"bridge_url": "ws://localhost:3001",
"use_native": false,
"session_store_path": "",
"allow_from": [],
"reasoning_channel_id": ""
},
"telegram": {
"enabled": true,
"token": "REDACTED",
"base_url": "",
"proxy": "",
"allow_from": [
"-5274005272",
"8271300679"
],
"group_trigger": {},
"typing": {
"enabled": true
},
"placeholder": {
"enabled": true,
"text": "Thinking... 💭"
},
"streaming": {
"enabled": true,
"throttle_seconds": 3,
"min_growth_chars": 200
},
"reasoning_channel_id": "",
"use_markdown_v2": false
},
"feishu": {
"enabled": false,
"app_id": "",
"allow_from": [],
"group_trigger": {},
"placeholder": {},
"reasoning_channel_id": "",
"random_reaction_emoji": null,
"is_lark": false
},
"discord": {
"enabled": false,
"proxy": "",
"allow_from": [],
"mention_only": false,
"group_trigger": {},
"typing": {},
"placeholder": {},
"reasoning_channel_id": ""
},
"maixcam": {
"enabled": false,
"host": "0.0.0.0",
"port": 18790,
"allow_from": [],
"reasoning_channel_id": ""
},
"qq": {
"enabled": false,
"app_id": "",
"allow_from": [],
"group_trigger": {},
"max_message_length": 2000,
"max_base64_file_size_mib": 0,
"send_markdown": false,
"reasoning_channel_id": ""
},
"dingtalk": {
"enabled": false,
"client_id": "",
"allow_from": [],
"group_trigger": {},
"reasoning_channel_id": ""
},
"slack": {
"enabled": false,
"allow_from": [],
"group_trigger": {},
"typing": {},
"placeholder": {},
"reasoning_channel_id": ""
},
"matrix": {
"enabled": false,
"homeserver": "https://matrix.org",
"user_id": "",
"join_on_invite": true,
"allow_from": [],
"group_trigger": {
"mention_only": true
},
"placeholder": {
"enabled": true,
"text": "Thinking... 💭"
},
"reasoning_channel_id": ""
},
"line": {
"enabled": false,
"webhook_host": "0.0.0.0",
"webhook_port": 18791,
"webhook_path": "/webhook/line",
"allow_from": [],
"group_trigger": {
"mention_only": true
},
"typing": {},
"placeholder": {},
"reasoning_channel_id": ""
},
"onebot": {
"enabled": false,
"ws_url": "ws://127.0.0.1:3001",
"reconnect_interval": 5,
"group_trigger_prefix": null,
"allow_from": [],
"group_trigger": {},
"typing": {},
"placeholder": {},
"reasoning_channel_id": ""
},
"wecom": {
"enabled": false,
"webhook_url": "",
"webhook_host": "0.0.0.0",
"webhook_port": 18793,
"webhook_path": "/webhook/wecom",
"allow_from": [],
"reply_timeout": 5,
"group_trigger": {},
"reasoning_channel_id": ""
},
"wecom_app": {
"enabled": false,
"corp_id": "",
"agent_id": 0,
"webhook_host": "0.0.0.0",
"webhook_port": 18792,
"webhook_path": "/webhook/wecom-app",
"allow_from": [],
"reply_timeout": 5,
"group_trigger": {},
"reasoning_channel_id": ""
},
"wecom_aibot": {
"enabled": false,
"webhook_path": "/webhook/wecom-aibot",
"allow_from": [],
"reply_timeout": 5,
"max_steps": 10,
"welcome_message": "Hello! I'm your AI assistant. How can I help you today?",
"processing_message": "⏳ Processing, please wait. The results will be sent shortly.",
"reasoning_channel_id": ""
},
"weixin": {
"enabled": false,
"base_url": "https://ilinkai.weixin.qq.com/",
"cdn_base_url": "https://novac2c.cdn.weixin.qq.com/c2c",
"proxy": "",
"allow_from": [],
"reasoning_channel_id": ""
},
"pico": {
"enabled": true,
"allow_token_query": true,
"ping_interval": 30,
"read_timeout": 60,
"write_timeout": 10,
"max_connections": 100,
"allow_from": [],
"placeholder": {}
},
"pico_client": {
"enabled": false,
"url": "",
"token": "",
"allow_from": null
},
"irc": {
"enabled": false,
"server": "",
"tls": false,
"nick": "",
"sasl_user": "",
"channels": null,
"allow_from": null,
"group_trigger": {},
"typing": {},
"reasoning_channel_id": ""
}
},
"model_list": [
{
"model_name": "glm-4.7",
"model": "zhipu/glm-4.7",
"api_base": "https://open.bigmodel.cn/api/paas/v4"
},
{
"model_name": "gpt-5.4",
"model": "openai/gpt-5.4",
"api_base": "https://api.openai.com/v1"
},
{
"model_name": "claude-sonnet-4.6",
"model": "anthropic/claude-sonnet-4.6",
"api_base": "https://api.anthropic.com/v1"
},
{
"model_name": "deepseek-chat",
"model": "deepseek/deepseek-chat",
"api_base": "https://api.deepseek.com/v1"
},
{
"model_name": "gemini-2.0-flash",
"model": "gemini/gemini-2.0-flash-exp",
"api_base": "https://generativelanguage.googleapis.com/v1beta"
},
{
"model_name": "qwen-plus",
"model": "qwen/qwen-plus",
"api_base": "https://dashscope.aliyuncs.com/compatible-mode/v1"
},
{
"model_name": "moonshot-v1-8k",
"model": "moonshot/moonshot-v1-8k",
"api_base": "https://api.moonshot.cn/v1"
},
{
"model_name": "llama-3.3-70b",
"model": "groq/llama-3.3-70b-versatile",
"api_base": "https://api.groq.com/openai/v1"
},
{
"model_name": "openrouter-auto",
"model": "openrouter/auto",
"api_base": "https://openrouter.ai/api/v1"
},
{
"model_name": "openrouter-gpt-5.4",
"model": "openrouter/openai/gpt-5.4",
"api_base": "https://openrouter.ai/api/v1"
},
{
"model_name": "nemotron-3-super-120b-a12b",
"model": "nvidia/nemotron-3-super-120b-a12b",
"api_base": "https://integrate.api.nvidia.com/v1",
"api_key": "REDACTED"
},
{
"model_name": "azure-grok",
"model": "openai/grok-4-fast-non-reasoning",
"api_base": "https://TestSJF.openai.azure.com/openai/v1/",
"api_key": "REDACTED"
},
{
"model_name": "cerebras-llama-3.3-70b",
"model": "cerebras/llama-3.3-70b",
"api_base": "https://api.cerebras.ai/v1"
},
{
"model_name": "vivgrid-auto",
"model": "vivgrid/auto",
"api_base": "https://api.vivgrid.com/v1"
},
{
"model_name": "ark-code-latest",
"model": "volcengine/ark-code-latest",
"api_base": "https://ark.cn-beijing.volces.com/api/v3"
},
{
"model_name": "doubao-pro",
"model": "volcengine/doubao-pro-32k",
"api_base": "https://ark.cn-beijing.volces.com/api/v3"
},
{
"model_name": "deepseek-v3",
"model": "shengsuanyun/deepseek-v3",
"api_base": "https://api.shengsuanyun.com/v1"
},
{
"model_name": "gemini-flash",
"model": "antigravity/gemini-3-flash",
"auth_method": "oauth"
},
{
"model_name": "copilot-gpt-5.4",
"model": "github-copilot/gpt-5.4",
"api_base": "http://localhost:4321",
"auth_method": "oauth"
},
{
"model_name": "llama3",
"model": "ollama/llama3",
"api_base": "http://localhost:11434/v1"
},
{
"model_name": "mistral-small",
"model": "mistral/mistral-small-latest",
"api_base": "https://api.mistral.ai/v1"
},
{
"model_name": "deepseek-v3.2",
"model": "avian/deepseek/deepseek-v3.2",
"api_base": "https://api.avian.io/v1"
},
{
"model_name": "kimi-k2.5",
"model": "avian/moonshotai/kimi-k2.5",
"api_base": "https://api.avian.io/v1"
},
{
"model_name": "MiniMax-M2.5",
"model": "minimax/MiniMax-M2.5",
"api_base": "https://api.minimaxi.com/v1",
"extra_body": {
"reasoning_split": true
}
},
{
"model_name": "LongCat-Flash-Thinking",
"model": "longcat/LongCat-Flash-Thinking",
"api_base": "https://api.longcat.chat/openai"
},
{
"model_name": "modelscope-qwen",
"model": "modelscope/Qwen/Qwen3-235B-A22B-Instruct-2507",
"api_base": "https://api-inference.modelscope.cn/v1"
},
{
"model_name": "local-model",
"model": "vllm/custom-model",
"api_base": "http://localhost:8000/v1"
},
{
"model_name": "azure-gpt5",
"model": "azure/my-gpt5-deployment",
"api_base": "https://your-resource.openai.azure.com"
}
],
"gateway": {
"host": "0.0.0.0",
"port": 18790,
"api_key": "picoclaw-secret-123",
"chat_enabled": true,
"hot_reload": true,
"log_level": "info"
},
"hooks": {
"enabled": true,
"defaults": {
"observer_timeout_ms": 500,
"interceptor_timeout_ms": 5000,
"approval_timeout_ms": 60000
}
},
"tools": {
"filter_sensitive_data": true,
"filter_min_length": 8,
"allow_read_paths": null,
"allow_write_paths": null,
"deny_read_paths": [
"^skills(/.*)?$"
],
"deny_write_paths": [
"^skills(/.*)?$"
],
"web": {
"enabled": true,
"brave": {
"enabled": false,
"max_results": 5
},
"tavily": {
"enabled": false,
"base_url": "",
"max_results": 5
},
"duckduckgo": {
"enabled": true,
"max_results": 5
},
"perplexity": {
"enabled": false,
"max_results": 5
},
"searxng": {
"enabled": false,
"base_url": "",
"max_results": 5
},
"glm_search": {
"enabled": false,
"base_url": "https://open.bigmodel.cn/api/paas/v4/web_search",
"search_engine": "search_std",
"max_results": 5
},
"baidu_search": {
"enabled": false,
"base_url": "https://qianfan.baidubce.com/v2/ai_search/web_search",
"max_results": 10
},
"prefer_native": true,
"fetch_limit_bytes": 10485760,
"format": "plaintext"
},
"cron": {
"enabled": true,
"exec_timeout_minutes": 5,
"allow_command": true
},
"exec": {
"enabled": true,
"enable_deny_patterns": true,
"allow_remote": true,
"custom_deny_patterns": null,
"custom_allow_patterns": null,
"timeout_seconds": 60
},
"skills": {
"whitelist_enabled": true,
"whitelist": [
"weather",
"summarize"
],
"enabled": true,
"registries": {
"clawhub": {
"enabled": true,
"base_url": "https://clawhub.ai",
"search_path": "",
"skills_path": "",
"download_path": "",
"timeout": 0,
"max_zip_size": 0,
"max_response_size": 0
},
"github": {}
},
"max_concurrent_searches": 2,
"search_cache": {
"max_size": 50,
"ttl_seconds": 300
}
},
"media_cleanup": {
"enabled": true,
"max_age_minutes": 30,
"interval_minutes": 5
},
"mcp": {
"enabled": true,
"discovery": {
"enabled": false,
"ttl": 5,
"max_search_results": 5,
"use_bm25": true,
"use_regex": false
},
"servers": {}
},
"whitelist": [
"spawn",
"subagent",
"read_file",
"list_dir",
"write_file",
"edit_file",
"append_file",
"exec",
"message",
"weather",
"summarize",
"github"
],
"whitelist_enabled": true,
"append_file": {
"enabled": true
},
"edit_file": {
"enabled": true
},
"find_skills": {
"enabled": true
},
"i2c": {
"enabled": false
},
"install_skill": {
"enabled": true
},
"list_dir": {
"enabled": true
},
"message": {
"enabled": true
},
"read_file": {
"enabled": true,
"max_read_file_size": 65536
},
"send_file": {
"enabled": true
},
"spawn": {
"enabled": true
},
"spawn_status": {
"enabled": false
},
"spi": {
"enabled": false
},
"subagent": {
"enabled": true
},
"web_fetch": {
"enabled": true
},
"write_file": {
"enabled": true
}
},
"heartbeat": {
"enabled": true,
"interval": 30
},
"devices": {
"enabled": false,
"monitor_usb": true
},
"voice": {
"echo_transcription": false
},
"build_info": {
"version": "0.1.0",
"git_commit": "054b55fd",
"build_time": "2026-03-23T10:15:13+0100",
"go_version": "go1.26.1"
}
}

55
k3s/deployment.yaml Normal file
View file

@ -0,0 +1,55 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: picoclaw-agent
namespace: agi
spec:
replicas: 1
selector:
matchLabels:
app: picoclaw-agent
template:
metadata:
labels:
app: picoclaw-agent
spec:
# Init container to bootstrap the configuration from the ConfigMap into the Persistent Volume
# This answers "how will I copy the config file": the config is copied into the volume on the first run.
initContainers:
- name: init-config
image: busybox:latest
command:
- sh
- -c
- |
mkdir -p /home/picoclaw/.picoclaw
echo "Syncing config.json from ConfigMap..."
cp /config-source/config.json /home/picoclaw/.picoclaw/config.json
# Ensure the agent has write permissions to its home volume
chown -R 1000:1000 /home/picoclaw/.picoclaw
volumeMounts:
- name: picoclaw-data
mountPath: /home/picoclaw/.picoclaw
- name: picoclaw-config-source
mountPath: /config-source
containers:
- name: picoclaw-agent
image: stevef1uk/picoclaw-rpi:latest
imagePullPolicy: Always
ports:
- containerPort: 18790
env:
- name: PICOCLAW_HOME
value: /home/picoclaw/.picoclaw
- name: PICOCLAW_GATEWAY_HOST
value: "0.0.0.0"
volumeMounts:
- name: picoclaw-data
mountPath: /home/picoclaw/.picoclaw
volumes:
- name: picoclaw-data
persistentVolumeClaim:
claimName: picoclaw-agent-pvc
- name: picoclaw-config-source
configMap:
name: picoclaw-config

11
k3s/pvc.yaml Normal file
View file

@ -0,0 +1,11 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: picoclaw-agent-pvc
namespace: agi
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 500Mi

13
k3s/service.yaml Normal file
View file

@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: picoclaw-agent
namespace: agi
spec:
selector:
app: picoclaw-agent
ports:
- protocol: TCP
port: 18790
targetPort: 18790
type: ClusterIP