Skip to content

Piglet Runtime: AI Runtime Sandbox

Pigsty Lightweight Runtime, AI Coding sandbox, spin up your cloud coding environment with one click

— Pigsty Lightweight Runtime, AI Coding Sandbox

PIGLET is a lightweight runtime environment based on Pigsty. It provides a cloud sandbox for AI Web Coding.

PIGLET combines PostgreSQL, JuiceFS distributed storage, Code Server, JupyterLab, Claude Code, Codex CLI, and other tools. These tools support a continuous workflow from code prompts to production deployment.


Key Features

FeatureDescription
🤖 AI CodingPre-installed Claude Code, Codex CLI, OpenCode, VS Code, Jupyter full stack, Python/Go/Node.js dev env ready
🐘 Data CapablePostgreSQL 18 + 600 extensions, vector/timeseries/geo/graph/analytics, add Supabase for complex apps
💾 Shared StorageJuiceFS stores working directory in database, multi-agent/multi-user collaboration, files never lost, rollback to any point
⏱️ Time MachineDatabase PITR + filesystem snapshot sync, messed up? One-click restore to any point in time, keep db and filesystem consistent!
🔀 Instant CloneCoW sub-second Fork Large Database, fork existing instances/clusters, no extra storage, rebuild anytime, tinker freely!
🌐 One-Click DeployBuilt-in Nginx handles domains, certs, proxy, static/dynamic sites, from prompt to production in one step!
📊 Full-Stack MonitoringVictoriaMetrics + Grafana panoramic dashboards, Claude Code observability included, all details at your fingertips!
🇨🇳 China AccessibleGlobal CDN + mirrors, one config for CC + GLM-5.2 domestic models, legal and compliant!

Quick Start

Prepare a node with SSH access and a compatible Linux distribution. Run these commands as an admin user with passwordless ssh and sudo:

curl -fsSL https://repo.pigsty.io/get | bash; cd ~/pigsty
./configure -c vibe -g # Use vibe mode, generate random passwords!
./deploy.yml           # Deploy infrastructure and PostgreSQL
./juice.yml            # Deploy JuiceFS filesystem
./vibe.yml             # Deploy Claude Code, Codex CLI, Code-Server, JupyterLab

After installation, access the sandbox homepage via IP: http://<ip>. Assuming your IP is 10.10.10.10:

For public cloud deployment, first read Security Recommendations. Run configure -g and review credentials that it does not cover. Enable the firewall.


VIBE Components

vibe.yml splits the browser IDE, notebook, AI CLIs, and Node.js runtime into independently switchable components:

ComponentDefaultDescriptionRun Separately
Code Servercode_enabled: trueBrowser-based VS Code, mounted at /code by default./vibe.yml -t code
JupyterLabjupyter_enabled: trueNotebook and interactive terminal; the role defaults to disabled, while conf/vibe.yml explicitly enables it for the sandbox template./vibe.yml -t jupyter
Node.jsnodejs_enabled: trueRuntime required by AI CLIs; installed on demand when Claude/Codex is enabled, and uses npmmirror for npm by default when region=china./vibe.yml -t nodejs
Claude Codeclaude_enabled: trueInstalls @anthropic-ai/claude-code, renders ~/.claude.json and ~/.claude/settings.json, and enables monitoring by default./vibe.yml -t claude
Codex CLIcodex_enabled: trueOnly runs npm install -g @openai/codex; it does not manage Codex config or integrate Codex into VIBE observability./vibe.yml -t codex
Extra npmnpm_packages: []Installs additional global npm packages only; Claude and Codex are installed by their own tasks./vibe.yml -t nodejs_pkg

If you do not need a component, set its *_enabled: false in pigsty.yml. For one run, pass a switch such as ./vibe.yml -e codex_enabled=false.


Start AI Coding

By default, /fs is a shared directory stored in PostgreSQL. It is also the default home for VS Code and Jupyter. The vibe role renders the AGENTS.md environment guide there and creates a CLAUDE.md -> AGENTS.md symlink. We recommend this directory for Vibe Coding.

Connect to the server with SSH and run cd /fs. Start the corresponding CLI with claude or codex. The preconfigured x alias starts Codex YOLO mode. The xx alias starts Claude YOLO mode. Use these modes carefully with real data. You can also start Claude Code from the Code Server or Jupyter terminal, or through VS Code / Jupyter Claude plugins.

AI coding environment in VS Code

Claude logs and monitoring metrics integrate with Grafana dashboards. Use Grafana to monitor Claude runtime status.

VIBE installs the Codex CLI package by default. Codex itself manages login, provider setup, and configuration files.

Claude Code monitoring dashboard

Using Other Models

To use other models with Claude Code, edit pigsty.yml during installation. For example, GLM-5.2 does not require overseas network access in China. Find the claude_env section at the bottom. Add the Anthropic-compatible endpoint variables that you need:

claude_env:
  ANTHROPIC_BASE_URL: https://open.bigmodel.cn/api/anthropic
  ANTHROPIC_API_URL: https://open.bigmodel.cn/api/anthropic
  ANTHROPIC_AUTH_TOKEN: your_api_service_token
  ANTHROPIC_DEFAULT_OPUS_MODEL: "glm-5.2[1m]"
  ANTHROPIC_DEFAULT_SONNET_MODEL: "glm-5.2[1m]"
  ANTHROPIC_DEFAULT_HAIKU_MODEL: "glm-4.7"
  CLAUDE_CODE_AUTO_COMPACT_WINDOW: "1000000"

Run ./vibe.yml -t claude again. This affects only Claude Code. VIBE does not manage Codex CLI account and provider configuration.

Claude Code observability data

Claude Code Observability

To monitor Claude Code in other environments, send its OTEL events to the PIGLET VictoriaMetrics / VictoriaLogs OTEL endpoints. Set these environment variables:

# Claude Code OTEL Configuration
export CLAUDE_CODE_ENABLE_TELEMETRY=1             # Enable monitoring
export OTEL_METRICS_EXPORTER=otlp
export OTEL_LOGS_EXPORTER=otlp
export OTEL_LOG_USER_PROMPTS=1                    # Explicitly enable prompt-content logging when needed
export OTEL_EXPORTER_OTLP_METRICS_PROTOCOL=http/protobuf
export OTEL_EXPORTER_OTLP_LOGS_PROTOCOL=http/protobuf
export OTEL_RESOURCE_ATTRIBUTES="ip=10.10.10.20,job=claude"  # Add your own labels
export OTEL_EXPORTER_OTLP_METRICS_ENDPOINT=http://10.10.10.10:8428/opentelemetry/v1/metrics     # Metrics endpoint, VictoriaMetrics
export OTEL_EXPORTER_OTLP_LOGS_ENDPOINT=http://10.10.10.10:9428/insert/opentelemetry/v1/logs    # Logs endpoint, VictoriaLogs
export OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE=cumulative

Was this page helpful?