pig sty
The pig can also be used as a CLI tool for Pigsty — the battery-included free PostgreSQL RDS. Which brings HA, PITR, Monitoring, IaC, and all the extensions to your PostgreSQL cluster.
pig sty - Init (Download), Bootstrap, Configure, and Deploy Pigsty
pig sty init [-pfvd] # install pigsty (~/pigsty by default)
pig sty boot [-rpk] # install ansible and prepare offline pkg
pig sty conf [-cvrsoxnpg] # configure pigsty and generate config
pig sty deploy # use pigsty to deploy everything (CAUTION!)
pig sty get # download pigsty source tarball
pig sty list # list available pigsty versions
Examples:
pig sty init # extract and init ~/pigsty
pig sty boot # install ansible & other deps
pig sty conf # generate pigsty.yml config file
pig sty deploy # run the deploy.yml playbook
| Command | Description | Notes |
|---|---|---|
sty init | Install Pigsty | |
sty boot | Install Ansible prerequisites | Requires sudo or root |
sty conf | Generate configuration | |
sty deploy | Run deployment playbook | |
sty list | List available Pigsty versions | |
sty get | Download Pigsty source tarball |
Quick Start
pig sty init # Install Pigsty to ~/pigsty
pig sty boot # Install Ansible prerequisites
pig sty conf # Generate configuration
pig sty deploy # Run deployment playbook
sty init
Download and install Pigsty distribution to ~/pigsty directory.
pig sty init # Install latest Pigsty
pig sty init -v 3.5.0 # Install specific version
pig sty init -d /opt/pigsty # Install to specific directory
Options:
-v|--version: Specify Pigsty version-d|--dir: Specify installation directory-f|--force: Overwrite existing pigsty directory
sty boot
Install Ansible and its dependencies.
pig sty boot # Install Ansible
pig sty boot -r china # Use China region mirrors
Options:
-r|--region: Upstream repo region (default, china, europe)-k|--keep: Keep existing upstream repo during bootstrap
sty conf
Generate Pigsty configuration file.
pig sty conf # Generate default configuration
pig sty conf -c rich # Use conf/rich.yml template (more extensions)
pig sty conf -c slim # Use conf/slim.yml template (minimal install)
pig sty conf -c supabase # Use conf/supabase.yml template (self-hosting)
pig sty conf -g # Generate with random passwords (recommended!)
pig sty conf -v 18 # Use PostgreSQL 18
pig sty conf -r china # Use China region mirrors
pig sty conf --ip 10.10.10.10 # Specify IP address
Options:
-c|--conf: Config template name-v|--version: PostgreSQL major version-r|--region: Upstream repo region--ip: Primary IP address-g|--generate: Generate random passwords-s|--skip: Skip IP address probing-o|--output: Output config file path
sty deploy
Run Pigsty deployment playbook.
pig sty deploy # Run deploy.yml (or install.yml if not found)
pig sty install # Same as deploy (backward compatibility)
pig sty d # Short alias
pig sty de # Short alias
pig sty ins # Short alias
This command runs the deploy.yml playbook from your Pigsty installation. For backward compatibility, if deploy.yml doesn’t exist but install.yml does, install.yml will be used instead.
Warning: This operation makes changes to your system. Use with caution!
Complete Workflow
Here’s the complete workflow to set up Pigsty:
# 1. Download and install Pigsty
pig sty init
# 2. Install Ansible and dependencies
cd ~/pigsty
pig sty boot
# 3. Generate configuration
pig sty conf -g # Generate with random passwords
# 4. Deploy Pigsty
pig sty deploy
For detailed setup instructions, check Get Started.
Configuration Templates
Available configuration templates (-c option):
| Template | Description |
|---|---|
meta | Default single-node meta configuration |
rich | Configuration with more extensions enabled |
slim | Minimal installation |
full | Full 4-node HA template |
supabase | Self-hosting Supabase template |
Example:
pig sty conf -c rich -g -v 18 -r china
This generates a configuration using the rich template with PostgreSQL 18, random passwords, and China region mirrors.
sty list
List available Pigsty versions.
pig sty list # List available versions
sty get
Download Pigsty source tarball.
pig sty get # Download latest version
pig sty get v3.4.0 # Download specific version
Feedback
Was this page helpful?
Thanks for the feedback! Please let us know how we can improve.
Sorry to hear that. Please let us know how we can improve.