PIGSTY

Configure

how to configure pigsty inventory file?

The configure script will generate the pigsty.yml config file inventory with good defaults according to your environment and input. It's OPTIONAL, you can edit the pigsty.yml directly as the tutorial shows.


Usage

The configure script is an interactive wizard unless -n|--non-interactive is specified.

~/pigsty/configure
./configure
    [-c|--conf <confname>   # [meta|dual|trio|full|app/supa|...]
    [-i|--ip <ip>]          # primary IP address (skip with -s)
    [-v|--version <pgver>   # [17|16|15|14|13]
    [-r|--region <region>   # [default|china|europe]
    [-s|--skip]             # skip IP address probing
    [-x|--proxy]            # write proxy env from environment
    [-n|--non-interactive]  # non-interactively mode
    [-p|--port <port>]      # specify SSH port (only used if set)
OptionDescription
-c|--confGenerate config from config templates according to this parameter
-i|--ipReplace IP address placeholder 10.10.10.10 with given IP
-v|--versionSpecify PostgreSQL major version number (13|14|15|16|17)
-r|--regionSet upstream repo mirror according to region (default|china|europe)
-x|--proxyWrite current proxy env to the config proxy_env
-s|--skipSkip interactive wizard and using default/arg values
-n|--non-interactiveNon-interactively mode
-p|--portSpecify SSH port (only used if set)

Example

./configure                # if there's only one IP address, otherwise it will ask you for it
./configure -i 10.11.12.13 # just tell the primary IP address explicitly
./configure -c rich -v 16  # use the conf/rich.yml as template, with PG 16 and all extensions
./configure -c app/supa    # use the app/supa template, run self-hosting supabase
./configure -c mssql       # use the babelfish template, run MSSQL compatible PG kernel fork
./configure -c full -s     # use the 4-node sandbox config template, without IP replace & probe
./configure -r china       # use use china mirror instead of default repo

configure output example:

./configure
[vagrant@node-1 pigsty]$ ./configure
configure pigsty v3.5.0 begin
[ OK ] region = china
[ OK ] kernel  = Linux
[ OK ] machine = x86_64
[ OK ] package = rpm,dnf
[ OK ] vendor  = rocky (Rocky Linux)
[ OK ] version = 9 (9.5)
[ OK ] sudo = vagrant ok
[ OK ] ssh = vagrant@127.0.0.1 ok
[WARN] Multiple IP address candidates found:
    (1) 192.168.121.193	    inet 192.168.121.193/24 brd 192.168.121.255 scope global dynamic noprefixroute eth0
    (2) 10.10.10.11	    inet 10.10.10.11/24 brd 10.10.10.255 scope global noprefixroute eth1
[ IN ] INPUT primary_ip address (of current meta node, e.g 10.10.10.10):
=> 10.10.10.11
[ OK ] primary_ip = 10.10.10.11 (from input)
[ OK ] admin = vagrant@10.10.10.11 ok
[ OK ] mode = meta (el9)
[ OK ] locale  = C.UTF-8
[ OK ] configure pigsty done
proceed with ./install.yml

Behavior

Config Template

If -c|--conf <template> is specified, it will generate the config file from the specified template. Such as meta, app/supa, etc... If no config template is given, it will use the default 1-node config template meta.

IP Address

If -i|--ip <ipaddr> is specified, it will replace the placeholder 10.10.10.10 in the config template with the given IP address. Otherwise, if the current node has only one IP address, it will be used. If there are multiple IP addresses, it will ask you to input the primary IP address of current node manually.

PostgreSQL Version

If -v|--version is specified, it will use the specified PostgreSQL major version number, range from 13 to 17. If no version is specified, it leaves the pg_version intact, which usually fallbacks to 17 by default.

Region

If -r|--region is specified, it will use the specified region directly. The china mirror will be used where Google services are not accessible.

Proxy Environment

If -x|--proxy is specified, it will write the current proxy environment variables to the config proxy_env. Will be reused during installation. Including: HTTP_PROXY, HTTPS_PROXY, ALL_PROXY, NO_PROXY.

Skip Mode

If -s|--skip is specified, it will skip IP address replacement and ssh sudo privilege check

Non-Interactive Mode

If -n|--non-interactive is specified, this script will not ask you for anything, but you have to specify a primary IP address with -i|--ip <ipaddr> explicitly.

SSH Port

If -p|--port is specified, it will use the specified SSH port instead of the default 22. It is used when your local SSH port is not 22.

Low-End Hardware Optimization

If current node CPU cores ≤ 4, it will use the tiny mode for pg_conf and node_tune to optimize for low-end hardware.

Locale Setting

Pigsty will use C.UTF-8 as the default locale, If:

  • PostgreSQL major version ≥ 17, with built-in local provider (default)
  • OR, Your system supports C.utf8 / C.utf-8 locale (locale -a)

Otherwise, local C will be used by default.