This is the multi-page printable view of this section. .
Piglet Documentation
-
1: About
-
1.1: License
-
1.1: License
-
2: Concept
-
2.1: Overview
-
2.2: Architecture
-
2.3: Storage
-
2.4: Snapshot
-
2.5: Clone
-
2.6: Monitoring
-
2.7: Security
-
2.1: Overview
-
3: Tutorial
-
3.1: Installation
-
3.2: Quick Start
-
3.3: VS Code
-
3.4: Jupyter
-
3.5: Claude Code
-
3.6: Database
-
3.7: Application
-
3.1: Installation
-
4: Reference
-
4.1: CLI
-
4.2: Configuration
-
4.3: VS Code Server
-
4.4: Nginx
-
4.5: REST API
-
4.1: CLI
- 5: Task
Welcome to the Piglet documentation.
Piglet is a lightweight runtime profile built on Pigsty. It turns one Linux machine into a shared environment for AI coding, PostgreSQL, durable storage, observability, and web delivery.
Documentation Structure
Our documentation follows the Diataxis framework, organized into four categories:
| Category | Purpose | Example |
|---|---|---|
| Concept | Understand the principles | What is Piglet Run? How does snapshot work? |
| Tutorial | Learn step by step | Install Piglet Run, Create your first project |
| Task | Get specific things done | Backup database, Deploy application |
| Reference | Look up detailed info | Configuration options, CLI commands |
Quick Links
- New to Piglet Run? Start with the Installation Tutorial
- Want to understand the concepts? Read What is Piglet Run?
- Looking for how-to guides? Check the Task section
- Need detailed reference? See the Reference section
Core Features
| Feature | Description |
|---|---|
| 🤖 AI Coding | Claude Code, OpenCode, VS Code, Jupyter, Python, Go, and Node.js |
| 🐘 Data Powerhouse | PostgreSQL 18 with hundreds of available extensions |
| 💾 Shared Storage | JuiceFS stores workspace in database |
| ⏱️ Time Machine | Database PITR + filesystem snapshots |
| 🔀 Instant Clone | Copy-on-Write database forking |
| 🌐 One-Click Deploy | Built-in Nginx with auto SSL |
| 📊 Full Observability | VictoriaMetrics + Grafana |
1 - About
Piglet Run is a lightweight runtime environment from Pigsty, designed as a cloud coding sandbox for AI Web Coding.
What is Piglet Run?
Piglet Run integrates:
- PostgreSQL 18 with 400+ extensions
- JuiceFS distributed storage with PITR support
- VS Code Server for web-based development
- JupyterLab for data science
- Claude Code for AI-assisted coding
- Grafana for observability
All in a single, easy-to-deploy package.
Project Links
| Resource | Link |
|---|---|
| GitHub | github.com/pgsty |
| Documentation | piglet.run |
| Discord | Join Community |
| Pigsty | pigsty.io |
Topics
| Topic | Description |
|---|---|
| License | Open source license (Apache 2.0) |
1.1 - License
Apache License 2.0
Piglet Run is licensed under the Apache License 2.0.
What This Means
The Apache 2.0 license allows you to:
- ✅ Use - Use the software for any purpose
- ✅ Modify - Modify the source code
- ✅ Distribute - Distribute copies of the software
- ✅ Commercial Use - Use in commercial projects
- ✅ Patent Grant - Includes patent rights from contributors
Requirements
When using Piglet Run, you must:
- Include the license and copyright notice
- State any significant changes made to the code
- Include the NOTICE file if one exists
Third-Party Components
Piglet Run includes several third-party open source components:
| Component | License |
|---|---|
| PostgreSQL | PostgreSQL License |
| JuiceFS | Apache 2.0 |
| VS Code Server | MIT |
| Grafana | AGPL 3.0 |
| VictoriaMetrics | Apache 2.0 |
| Nginx | BSD-2-Clause |
Please refer to each component’s license for specific terms.
2 - Concept
Concept documentation helps you understand the principles and architecture behind Piglet Run.
What You’ll Learn
- How Piglet Run works under the hood
- The design philosophy and architecture
- Key concepts like snapshots, cloning, and storage
Topics
2.1 - Overview
What is Piglet Run?
Piglet Run is a lightweight runtime environment from Pigsty, designed as a cloud coding sandbox for AI Web Coding. It integrates PostgreSQL database, JuiceFS distributed storage, VS Code, JupyterLab, and more into a unified environment.
Why Piglet Run?
In the age of AI-assisted development, developers need:
- Instant development environments that just work
- Powerful databases with all extensions available
- Safe experimentation with easy rollback
- Seamless collaboration between humans and AI agents
Piglet Run provides all of this in a single package.
Key Features
| Feature | Description |
|---|---|
| 🤖 AI Coding | Pre-installed Claude Code, OpenCode, VS Code, Jupyter |
| 🐘 Data Powerhouse | PostgreSQL 18 + 400+ extensions |
| 💾 Shared Storage | JuiceFS stores workspace in database |
| ⏱️ Time Machine | Database PITR + filesystem snapshots |
| 🔀 Instant Clone | Copy-on-Write database forking |
| 🌐 One-Click Deploy | Built-in Nginx with auto SSL |
| 📊 Full Observability | VictoriaMetrics + Grafana |
| 🇨🇳 China Friendly | Global CDN + China mirrors |
Who is it for?
- Solo developers who want a powerful dev environment
- Teams that need shared development infrastructure
- AI developers using Claude Code or similar tools
- Data scientists working with PostgreSQL and Jupyter
- Learners exploring PostgreSQL and web development
How it works
Next Steps
- Install Piglet Run to get started
- Learn about the Architecture
- Explore the Storage system
2.2 - Architecture
System Architecture
Piglet Run is built on top of Pigsty, providing a streamlined development environment.
Components
| Component | Role | Port |
|---|---|---|
| Nginx | Reverse proxy, SSL termination | 80, 443 |
| VS Code Server | Web-based IDE | /code |
| JupyterLab | Data science notebook | /jupyter |
| PostgreSQL | Primary database | 5432 |
| JuiceFS | Distributed filesystem | - |
| VictoriaMetrics | Metrics storage | 8428 |
| Grafana | Monitoring dashboards | /ui |
Network Architecture
Storage Architecture
All development work is stored in PostgreSQL via JuiceFS:
Next Steps
2.3 - Storage
JuiceFS Shared Storage
Piglet Run uses JuiceFS to provide a distributed filesystem backed by PostgreSQL.
Why JuiceFS?
- POSIX Compatible: Works like a normal filesystem
- Database-Backed: Data stored in PostgreSQL
- Snapshots: Point-in-time recovery support
- Multi-User: Share workspace across sessions
How It Works
Features
| Feature | Description |
|---|---|
| Transparent | Use like local filesystem |
| Durable | Data stored in database |
| Concurrent | Multiple users/agents access |
| Snapshots | Point-in-time recovery |
Next Steps
2.4 - Snapshot
Time Machine
Piglet Run provides point-in-time recovery for both database and filesystem.
Database PITR
PostgreSQL’s built-in PITR (Point-in-Time Recovery) allows you to restore the database to any point in time. Managed by pgBackRest.
Filesystem Snapshots
JuiceFS snapshots preserve the state of your workspace:
Use Cases
| Scenario | Solution |
|---|---|
| AI broke code | Restore filesystem snapshot |
| Bad database migration | Use pig pb restore -t <time> |
| Experiment failed | Roll back entire environment |
| Need clean state | Restore to baseline snapshot |
Backup Management
Next Steps
- Learn about Cloning
- See Restore Task
- See Backup Task
2.5 - Clone
Instant Cloning
Piglet Run supports Copy-on-Write (CoW) cloning for rapid database forking.
How It Works
Copy-on-Write means:
- Zero copy at clone time
- Only changed blocks consume storage
- TB-scale databases clone in milliseconds
Use Cases
| Use Case | Benefit |
|---|---|
| Development | Clone prod for testing |
| AI Experiments | Branch for each experiment |
| Feature Branches | Database per branch |
| Training | Each learner gets own copy |
Database Cloning
Using PostgreSQL utilities:
Using pgBackRest for Cloning
Filesystem Cloning with JuiceFS
Next Steps
- See Clone Task
- Learn about Snapshots
2.6 - Monitoring
Full Observability
Piglet Run includes a complete monitoring stack based on VictoriaMetrics and Grafana.
Components
| Component | Role |
|---|---|
| VictoriaMetrics | Time-series database |
| Grafana | Visualization dashboards |
| node_exporter | System metrics |
| pg_exporter | PostgreSQL metrics |
Dashboards
Access Grafana at http://<ip>/ui
Available dashboards:
- Claude Code: AI agent monitoring
- PostgreSQL: Database performance
- System: Host metrics
- JuiceFS: Filesystem statistics
Metrics
Over 3000+ metrics collected:
- Database queries, connections, locks
- System CPU, memory, disk, network
- Application-specific metrics
Alerts
Configure alerts for:
- High CPU/memory usage
- Database connection limits
- Disk space warnings
- Query performance issues
Next Steps
- See Monitor Task
- Learn about Grafana Reference
2.7 - Security
Security Model
Piglet Run provides multiple layers of security for your development environment.
Access Control
| Layer | Mechanism |
|---|---|
| Network | Firewall, VPN support |
| Web | Nginx authentication |
| Database | PostgreSQL roles |
| Filesystem | Unix permissions |
Authentication
Default authentication methods:
- VS Code: Password or token
- Jupyter: Token-based
- Grafana: Username/password
- PostgreSQL: Role-based access
Encryption
| Type | Support |
|---|---|
| In Transit | SSL/TLS |
| At Rest | Database encryption |
| Backup | Encrypted backups |
Best Practices
- Change default passwords immediately
- Enable SSL for all services
- Restrict network access
- Regular security updates
Next Steps
3 - Tutorial
Tutorial documentation provides step-by-step guides to learn Piglet Run from scratch.
Learning Path
Follow these tutorials in order to get started:
- Installation - Set up Piglet Run on your server
- Quick Start - Create your first project
- VS Code - Using the web-based VS Code
- Jupyter - Data analysis with Jupyter
- Claude Code - AI-assisted development
- Database - Working with PostgreSQL
Topics
| Topic | Description |
|---|---|
| Install | Install Piglet Run on a fresh server |
| Quick Start | Your first 5 minutes with Piglet Run |
| VS Code | Web-based VS Code tutorial |
| Jupyter | JupyterLab for data science |
| Claude Code | AI coding with Claude |
| Database | PostgreSQL basics |
| Application | Build and deploy an app |
3.1 - Installation
Install Piglet Run
This tutorial guides you through installing Piglet Run on a fresh server.
Prerequisites
- OS: Linux (Ubuntu 22.04+, Debian 12+, RHEL 8+, Rocky 8+)
- CPU: 2+ cores recommended
- RAM: 4GB minimum, 8GB+ recommended
- Disk: 40GB+ free space
- Network: Internet access for package download
Quick Install
1. Install Pig CLI
2. Setup Repositories
3. Install Pigsty with Piglet Profile
Step-by-Step Installation
Download and Install Pig
Setup Repositories
Install PostgreSQL and Extensions
Install Pigsty Distribution
Verify Installation
After installation, check status:
Access the services:
| Service | URL |
|---|---|
| Homepage | http://<ip>/ |
| VS Code | http://<ip>/code |
| Jupyter | http://<ip>/jupyter |
| Grafana | http://<ip>/ui |
| PostgreSQL | postgres://<ip>:5432 |
Troubleshooting
Check Logs
Common Issues
| Issue | Solution |
|---|---|
| Repository error | pig repo set -u to refresh |
| Package conflict | pig repo rm then pig repo set |
| Permission denied | Run with sudo or as root |
Next Steps
- Continue with Quick Start
- Learn about VS Code
3.2 - Quick Start
Your First 5 Minutes
This tutorial gets you productive with Piglet Run in 5 minutes.
Access Your Environment
After installation, access your environment:
| Service | URL | Default Credentials |
|---|---|---|
| Homepage | http://<ip>/ |
None |
| VS Code | http://<ip>/code |
See /data/code/config.yaml |
| Jupyter | http://<ip>/jupyter |
Token in logs |
| Grafana | http://<ip>/ui |
admin / admin |
Create Your First Project
1. Open VS Code
Navigate to http://<ip>/code in your browser.
2. Open Terminal
Press Ctrl+` to open the integrated terminal.
3. Create a Project
4. Create a Simple App
Create app.py:
5. Run It
Connect to PostgreSQL
Or in Python:
Next Steps
- Learn more about VS Code
- Explore Jupyter
- Try Claude Code
3.3 - VS Code
Web-based VS Code
Learn to use the web-based VS Code server in Piglet Run.
Access
Open your browser and navigate to:
Features
The web VS Code includes:
- Full VS Code experience in browser
- Extensions support
- Integrated terminal
- Git integration
- Python, Go, Node.js support
Getting Started
1. Open a Folder
Click “Open Folder” and select /root/workspace.
2. Install Extensions
Recommended extensions:
- Python
- Pylance
- GitLens
- Database Client
3. Configure Settings
Press Ctrl+, to open settings.
Tips
- Use
Ctrl+Shift+Pfor command palette - `Ctrl+`` for integrated terminal
Ctrl+Bto toggle sidebar
Next Steps
- Try Jupyter
- Learn Claude Code
3.4 - Jupyter
JupyterLab Tutorial
Learn to use JupyterLab for data analysis in Piglet Run.
Access
Navigate to:
Features
- Interactive Python notebooks
- Rich output (charts, tables, images)
- PostgreSQL integration
- Multiple kernels (Python, SQL)
Getting Started
1. Create a Notebook
Click “Python 3” under Notebook.
2. Connect to PostgreSQL
3. Visualize Data
Tips
- Use
Shift+Enterto run cells - Save notebooks to
/root/workspace/notebooks
Next Steps
- Learn Claude Code
- Explore Database
3.5 - Claude Code
AI-Assisted Development
Learn to use Claude Code for AI-assisted development in Piglet Run.
Prerequisites
You need an Anthropic API key. Set it up:
Getting Started
1. Launch Claude Code
In VS Code terminal:
2. Give Instructions
Ask Claude to help with your project:
3. Review and Accept
Claude will:
- Analyze your request
- Generate code
- Explain the changes
- Wait for your approval
Best Practices
| Practice | Reason |
|---|---|
| Create snapshots | Roll back if needed |
| Review changes | Verify before accepting |
| Be specific | Better results |
| Iterate | Refine step by step |
Safety
Piglet Run makes AI coding safer:
- Snapshots: Restore any time
- Monitoring: Track AI activity
- Isolation: Sandboxed environment
Monitoring
View Claude Code activity at:
Next Steps
- Explore Database
- Build an Application
3.6 - Database
PostgreSQL Basics
Learn to work with PostgreSQL in Piglet Run.
Connect
Using psql
Using Python
Create Database
Install Extensions
PostgreSQL 18 with 400+ extensions available:
Basic Operations
Monitoring
View database performance at:
Next Steps
- Build an Application
- Learn about Backup
3.7 - Application
Build and Deploy
Learn to build and deploy a web application in Piglet Run.
Create a FastAPI App
1. Set Up Project
2. Create Application
Create main.py:
3. Run Locally
4. Deploy with Nginx
See Deploy Task for production deployment.
Next Steps
4 - Reference
Use the reference when you already know what you need and want the exact command, option, path, or endpoint.
Choose a section below for Piglet configuration, CLI commands, API access, Nginx Portal, and VS Code details.
4.1 - CLI
Command-line interface reference for Piglet Run, powered by pig - the PostgreSQL package manager.
Overview
The pig CLI provides complete control over PostgreSQL installation, extension management, and system operations.
Installation
Verify installation:
Global Options
| Option | Description |
|---|---|
--help, -h |
Show help |
--debug |
Enable debug mode |
--log-level |
Set log level (debug/info/warn/error) |
-H, --home |
Pigsty home directory |
-i, --inventory |
Configuration inventory path |
Main Commands
Repository Management (pig repo)
Extension Management (pig ext)
Installation Alias (pig install)
PostgreSQL Management (pig pg)
Backup Management (pig pb)
Patroni Cluster (pig pt)
Pigsty Management (pig sty)
System Status (pig status)
Environment Variables
| Variable | Description |
|---|---|
PIGSTY_HOME |
Pigsty home directory (default: ~/pigsty) |
PIG_LOG_LEVEL |
Log level |
Examples
See Also
4.2 - Configuration
Configuration file reference for Piglet Run.
Overview
Piglet Run uses YAML configuration files located in /etc/piglet/.
Main Configuration
File: /etc/piglet/piglet.yml
Database Configuration
File: /etc/piglet/database.yml
Service Configuration
VS Code Server
File: /etc/piglet/vscode.yml
JupyterLab
File: /etc/piglet/jupyter.yml
Backup Configuration
File: /etc/piglet/backup.yml
Network Configuration
File: /etc/piglet/network.yml
Environment Variables
Override configuration with environment variables:
See Also
4.3 - VS Code Server
VS Code Server configuration and details for Piglet Run.
Overview
Piglet Run includes a pre-configured VS Code Server (code-server) for browser-based development.
Access
Default URL: http://<ip>/code
Configuration
File: /etc/piglet/vscode.yml
Pre-installed Extensions
| Extension | Description |
|---|---|
ms-python.python |
Python language support |
ms-toolsai.jupyter |
Jupyter notebook support |
rust-lang.rust-analyzer |
Rust language support |
golang.go |
Go language support |
dbaeumer.vscode-eslint |
JavaScript linting |
esbenp.prettier-vscode |
Code formatter |
mtxr.sqltools |
SQL tools |
Installing Extensions
Via CLI
Via Settings
- Open VS Code in browser
- Go to Extensions (Ctrl+Shift+X)
- Search and install extensions
Settings
Default settings location: /home/dba/.local/share/code-server/User/settings.json
Service Management
Keyboard Shortcuts
| Shortcut | Action |
|---|---|
Ctrl+Shift+P |
Command palette |
Ctrl+P |
Quick open file |
Ctrl+Shift+E |
Explorer |
Ctrl+Shift+F |
Search |
Ctrl+`` |
Terminal |
Ctrl+Shift+G |
Git |
Troubleshooting
Connection Issues
Extension Issues
See Also
4.4 - Nginx
Nginx web server configuration for Piglet Run.
Overview
Piglet Run uses Nginx as a reverse proxy and web server for all services.
Configuration
Main config: /etc/nginx/nginx.conf
Site configs: /etc/nginx/conf.d/
Default Configuration
File: /etc/nginx/conf.d/piglet.conf
SSL Configuration
File: /etc/nginx/conf.d/piglet-ssl.conf
Service Management
Custom Site Configuration
Create custom site config:
Proxy Configuration
WebSocket Support
Node.js Application
Logging
Access log: /var/log/nginx/access.log
Error log: /var/log/nginx/error.log
Rate Limiting
Troubleshooting
See Also
4.5 - REST API
REST API reference for Piglet Run.
Overview
Piglet Run provides a REST API for programmatic access to all features.
Base URL
Authentication
API Key
Generate API Key
Endpoints
System
Get Status
Response:
Get System Info
Response:
Databases
List Databases
Response:
Create Database
Delete Database
Backups
List Backups
Response:
Create Backup
Restore Backup
Services
List Services
Response:
Control Service
Actions: start, stop, restart
Snapshots
List Snapshots
Create Snapshot
Restore Snapshot
Users
List Users
Create User
Error Responses
Error Codes
| Code | HTTP Status | Description |
|---|---|---|
UNAUTHORIZED |
401 | Invalid or missing API key |
FORBIDDEN |
403 | Insufficient permissions |
NOT_FOUND |
404 | Resource not found |
CONFLICT |
409 | Resource already exists |
INTERNAL_ERROR |
500 | Server error |
Rate Limiting
- Default: 100 requests per minute
- Burst: 20 requests
Headers:
SDK Examples
Python
JavaScript
See Also
5 - Task
Task documentation provides goal-oriented guides for specific operations.
How to Use
Each task guide focuses on accomplishing a specific goal:
- Problem-focused: Start with what you want to achieve
- Step-by-step: Clear instructions to follow
- Practical: Real-world scenarios
Topics
| Topic | Description |
|---|---|
| Backup | Backup database and files |
| Restore | Restore from backup or snapshot |
| Clone | Clone database or environment |
| Deploy | Deploy web application |
| SSL | Configure SSL certificates |
| Domain | Set up custom domain |
| Scale | Scale resources up or down |
| Migrate | Migrate data from other systems |
| Monitor | Set up alerts and monitoring |
| Upgrade | Upgrade Piglet Run |
5.1 - Backup
Learn how to backup your database and files in Piglet Run.
Overview
Piglet Run provides multiple backup methods to protect your data:
- Database Backup: Full and incremental PostgreSQL backups
- File Backup: User files and configurations
- Snapshot: Complete system state capture
Quick Backup
Create a full backup with a single command:
Backup Database
Full Database Backup
Incremental Backup
Backup Specific Database
Backup Files
Backup User Files
Backup Configurations
Scheduled Backups
Configure automatic backups in /etc/piglet/backup.yml:
Backup Storage
Backups are stored in:
| Type | Location |
|---|---|
| Database | /data/backup/postgres/ |
| Files | /data/backup/files/ |
| Config | /data/backup/config/ |
Next Steps
5.2 - Restore
Learn how to restore your database and files from backups or snapshots.
Overview
Piglet Run supports multiple restore scenarios:
- Point-in-Time Recovery: Restore to any moment in time
- Full Restore: Restore from a complete backup
- Selective Restore: Restore specific databases or files
Quick Restore
Restore from the latest backup:
Restore Database
List Available Backups
Restore Full Backup
Point-in-Time Recovery
Restore Specific Database
Restore Files
Restore All Files
Restore Specific Directory
Restore from Snapshot
Verification
After restore, verify data integrity:
Next Steps
5.3 - Clone
Learn how to clone databases and environments in Piglet Run.
Overview
Cloning allows you to create exact copies of:
- Database: Clone a database for testing or development
- Environment: Clone the entire Piglet Run instance
- Schema Only: Clone structure without data
Quick Clone
Clone a database instantly:
Clone Database
Full Clone
Schema Only
Clone with Data Filter
Clone Environment
Create Environment Clone
Clone to Remote Server
Clone from Snapshot
Clone Options
| Option | Description |
|---|---|
--schema-only |
Clone structure without data |
--no-owner |
Skip ownership information |
--no-privileges |
Skip privilege information |
--parallel N |
Use N parallel jobs |
Use Cases
- Development: Clone production for local development
- Testing: Create isolated test environments
- Analytics: Clone for reporting without impacting production
Next Steps
5.4 - Deploy
Learn how to deploy web applications on Piglet Run.
Overview
Piglet Run supports deploying various web applications:
- Static Sites: HTML, CSS, JavaScript
- Node.js: Express, Next.js, React
- Python: Flask, Django, FastAPI
- PHP: Laravel, WordPress
Quick Deploy
Deploy a static site:
Deploy Static Site
From Local Directory
From Git Repository
Deploy Node.js Application
Basic Deployment
With Custom Port
Configuration
Create piglet.yml in your project:
Deploy Python Application
Flask Application
Django Application
Deployment Management
List Deployments
View Logs
Restart Application
Remove Deployment
Next Steps
- Configure SSL for HTTPS
- Set up Custom Domain
5.5 - SSL
Learn how to configure SSL certificates for secure HTTPS connections.
Overview
Piglet Run supports multiple SSL certificate options:
- Let’s Encrypt: Free automatic certificates
- Self-Signed: For development and testing
- Custom: Bring your own certificates
Quick SSL Setup
Enable SSL with Let’s Encrypt:
Let’s Encrypt Certificates
Enable for Domain
Multiple Domains
Wildcard Certificate
Self-Signed Certificates
Generate Self-Signed
For Development
Custom Certificates
Install Custom Certificate
With Certificate Chain
Certificate Management
View Certificates
Check Expiration
Renew Certificates
Configuration
SSL settings in /etc/piglet/ssl.yml:
Next Steps
- Set up Custom Domain
- Learn about Security
5.6 - Domain
Learn how to set up custom domains for your Piglet Run services.
Overview
Configure custom domains for:
- Main Application: Your primary domain
- Subdomains: Service-specific subdomains
- Multiple Domains: Support multiple domains
Quick Setup
Add a custom domain:
DNS Configuration
Required DNS Records
Point your domain to Piglet Run:
| Type | Name | Value |
|---|---|---|
| A | @ | Your server IP |
| A | www | Your server IP |
| CNAME | code | @ |
| CNAME | jupyter | @ |
Using Cloudflare
Add Custom Domain
Primary Domain
Subdomain for Services
Domain Management
List Domains
Remove Domain
Set Primary
Configuration
Domain settings in /etc/piglet/domains.yml:
Verify Domain
Check domain configuration:
Next Steps
- Configure SSL for HTTPS
- Learn about Nginx Configuration
5.7 - Scale
Learn how to scale your Piglet Run resources up or down.
Overview
Piglet Run supports scaling:
- Database: Adjust PostgreSQL resources
- Storage: Expand disk capacity
- Services: Scale service resources
Quick Scale
Scale database resources:
Scale Database
Increase Resources
Adjust Connection Limits
Configure Shared Buffers
Scale Storage
Expand Disk
Add Storage Volume
Scale Services
VS Code Server
JupyterLab
Resource Limits
View current resource allocation:
Example output:
Configuration
Scale settings in /etc/piglet/resources.yml:
Best Practices
- Monitor resource usage before scaling
- Scale gradually to avoid disruption
- Test changes in development first
Next Steps
- Set up Monitoring
- Learn about Architecture
5.8 - Migrate
Learn how to migrate data from other systems to Piglet Run.
Overview
Piglet Run supports migration from:
- Other PostgreSQL: Migrate from existing PostgreSQL instances
- MySQL/MariaDB: Convert and migrate from MySQL
- Cloud Databases: AWS RDS, Google Cloud SQL, Azure Database
- Files: Import from SQL dumps or CSV files
Quick Migration
Migrate from another PostgreSQL:
Migrate from PostgreSQL
Direct Connection
From pg_dump File
Schema Only
Migrate from MySQL
Direct Migration
With Type Mapping
Migrate from Cloud
AWS RDS
Google Cloud SQL
Import Files
SQL Dump
CSV Files
Multiple CSV Files
Migration Options
| Option | Description |
|---|---|
--schema-only |
Migrate structure only |
--data-only |
Migrate data only |
--no-owner |
Skip ownership |
--parallel N |
Parallel jobs |
--exclude TABLE |
Exclude tables |
Verification
Verify migration:
Next Steps
- Learn about Backup
- Understand PostgreSQL Configuration
5.9 - Monitor
Learn how to set up alerts and monitoring for your Piglet Run instance.
Overview
Piglet Run includes comprehensive monitoring:
- Grafana Dashboards: Visual monitoring
- Alerting: Configurable alerts
- Metrics: Prometheus-based metrics
- Logs: Centralized logging
Quick Setup
Access monitoring dashboard:
Grafana Dashboards
Available Dashboards
| Dashboard | Description |
|---|---|
| Overview | System overview and health |
| PostgreSQL | Database performance metrics |
| Node | Server resource usage |
| Nginx | Web server statistics |
Access Dashboards
Set Up Alerts
Enable Email Alerts
Enable Slack Alerts
Enable Webhook Alerts
Alert Rules
View Alert Rules
Add Custom Alert
Default Alerts
| Alert | Condition | Severity |
|---|---|---|
| High CPU | > 80% for 5m | Warning |
| High Memory | > 90% for 5m | Warning |
| Disk Full | > 85% | Critical |
| DB Down | Connection failed | Critical |
| Replication Lag | > 1s | Warning |
Configuration
Alert configuration in /etc/piglet/alerts.yml:
View Logs
Next Steps
- Learn about Grafana
- Understand Architecture
5.10 - Upgrade
Learn how to upgrade your Piglet Run installation.
Overview
Piglet Run upgrades include:
- Minor Updates: Bug fixes and security patches
- Major Upgrades: New features and improvements
- PostgreSQL Upgrades: Database version upgrades
Quick Upgrade
Upgrade to latest version:
Check for Updates
View Current Version
Check Available Updates
Perform Upgrade
Standard Upgrade
Upgrade to Specific Version
Dry Run
Upgrade PostgreSQL
Check Compatible Versions
Upgrade Database Version
With Full Backup
Before Upgrading
-
Create Backup
-
Check Compatibility
-
Review Release Notes
Rollback
If upgrade fails:
Restore from Backup
Rollback to Previous Version
Upgrade History
View upgrade history:
Example output:
Configuration
Upgrade settings in /etc/piglet/upgrade.yml: