Skip to content

Commit 42381aa

Browse files
committed
add pg18 config template
1 parent 99b9a2b commit 42381aa

9 files changed

Lines changed: 242 additions & 165 deletions

File tree

conf/pg18.yml

Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
---
2+
#==============================================================#
3+
# File : pg18.yml
4+
# Desc : Pigsty default 1-node config for pg18 beta
5+
# Ctime : 2025-05-06
6+
# Mtime : 2025-05-06
7+
# Docs : https://pigsty.io/docs/conf/meta
8+
# License : AGPLv3 @ https://pigsty.io/docs/about/license
9+
# Copyright : 2018-2025 Ruohang Feng / Vonng (rh@vonng.com)
10+
#==============================================================#
11+
12+
all:
13+
14+
#==============================================================#
15+
# Clusters, Nodes, and Modules
16+
#==============================================================#
17+
children:
18+
19+
#----------------------------------#
20+
# infra: monitor, alert, repo, etc..
21+
#----------------------------------#
22+
infra:
23+
hosts:
24+
10.10.10.10: { infra_seq: 1 }
25+
vars:
26+
docker_enabled: true # enabled docker with ./docker.yml
27+
#docker_registry_mirrors: ["https://docker.1ms.run", "https://docker.m.daocloud.io"]
28+
29+
#----------------------------------#
30+
# etcd cluster for HA postgres DCS
31+
#----------------------------------#
32+
etcd:
33+
hosts:
34+
10.10.10.10: { etcd_seq: 1 }
35+
vars:
36+
etcd_cluster: etcd
37+
38+
#----------------------------------#
39+
# minio (OPTIONAL backup repo)
40+
#----------------------------------#
41+
#minio:
42+
# hosts:
43+
# 10.10.10.10: { minio_seq: 1 }
44+
# vars:
45+
# minio_cluster: minio
46+
47+
#----------------------------------#
48+
# pgsql (singleton on current node)
49+
#----------------------------------#
50+
# this is an example single-node postgres cluster with pgvector installed, with one biz database & two biz users
51+
pg-meta:
52+
hosts:
53+
10.10.10.10: { pg_seq: 1, pg_role: primary } # <---- primary instance with read-write capability
54+
#x.xx.xx.xx: { pg_seq: 2, pg_role: replica } # <---- read only replica for read-only online traffic
55+
#x.xx.xx.xy: { pg_seq: 3, pg_role: offline } # <---- offline instance of ETL & interactive queries
56+
vars:
57+
pg_cluster: pg-meta # required identity parameter, usually same as group name
58+
59+
# define business databases here: https://pigsty.io/docs/pgsql/db/
60+
pg_databases: # define business databases on this cluster, array of database definition
61+
- name: meta # REQUIRED, `name` is the only mandatory field of a database definition
62+
baseline: cmdb.sql # optional, database sql baseline path, (relative path among ansible search path, e.g: files/)
63+
schemas: [ pigsty ] # optional, additional schemas to be created, array of schema names
64+
extensions: # optional, additional extensions to be installed: array of `{name[,schema]}`
65+
- { name: vector } # install pgvector extension on this database by default
66+
comment: pigsty meta database # optional, comment string for this database
67+
#pgbouncer: true # optional, add this database to pgbouncer database list? true by default
68+
#owner: postgres # optional, database owner, postgres by default
69+
#template: template1 # optional, which template to use, template1 by default
70+
#encoding: UTF8 # optional, database encoding, UTF8 by default. (MUST same as template database)
71+
#locale: C # optional, database locale, C by default. (MUST same as template database)
72+
#lc_collate: C # optional, database collate, C by default. (MUST same as template database)
73+
#lc_ctype: C # optional, database ctype, C by default. (MUST same as template database)
74+
#tablespace: pg_default # optional, default tablespace, 'pg_default' by default.
75+
#allowconn: true # optional, allow connection, true by default. false will disable connect at all
76+
#revokeconn: false # optional, revoke public connection privilege. false by default. (leave connect with grant option to owner)
77+
#register_datasource: true # optional, register this database to grafana datasources? true by default
78+
#connlimit: -1 # optional, database connection limit, default -1 disable limit
79+
#pool_auth_user: dbuser_meta # optional, all connection to this pgbouncer database will be authenticated by this user
80+
#pool_mode: transaction # optional, pgbouncer pool mode at database level, default transaction
81+
#pool_size: 64 # optional, pgbouncer pool size at database level, default 64
82+
#pool_size_reserve: 32 # optional, pgbouncer pool size reserve at database level, default 32
83+
#pool_size_min: 0 # optional, pgbouncer pool size min at database level, default 0
84+
#pool_max_db_conn: 100 # optional, max database connections at database level, default 100
85+
#- { name: grafana ,owner: dbuser_grafana ,revokeconn: true ,comment: grafana primary database } # define another database
86+
87+
# define business users here: https://pigsty.io/docs/pgsql/user/
88+
pg_users: # define business users/roles on this cluster, array of user definition
89+
- name: dbuser_meta # REQUIRED, `name` is the only mandatory field of a user definition
90+
password: DBUser.Meta # optional, password, can be a scram-sha-256 hash string or plain text
91+
login: true # optional, can log in, true by default (new biz ROLE should be false)
92+
superuser: false # optional, is superuser? false by default
93+
createdb: false # optional, can create database? false by default
94+
createrole: false # optional, can create role? false by default
95+
inherit: true # optional, can this role use inherited privileges? true by default
96+
replication: false # optional, can this role do replication? false by default
97+
bypassrls: false # optional, can this role bypass row level security? false by default
98+
pgbouncer: true # optional, add this user to pgbouncer user-list? false by default (production user should be true explicitly)
99+
connlimit: -1 # optional, user connection limit, default -1 disable limit
100+
expire_in: 3650 # optional, now + n days when this role is expired (OVERWRITE expire_at)
101+
expire_at: '2030-12-31' # optional, YYYY-MM-DD 'timestamp' when this role is expired (OVERWRITTEN by expire_in)
102+
comment: pigsty admin user # optional, comment string for this user/role
103+
roles: [dbrole_admin] # optional, belonged roles. default roles are: dbrole_{admin,readonly,readwrite,offline}
104+
parameters: {} # optional, role level parameters with `ALTER ROLE SET`
105+
pool_mode: transaction # optional, pgbouncer pool mode at user level, transaction by default
106+
pool_connlimit: -1 # optional, max database connections at user level, default -1 disable limit
107+
- { name: dbuser_view ,password: DBUser.Viewer ,pgbouncer: true ,roles: [dbrole_readonly], comment: read-only viewer for meta database }
108+
109+
# define pg extensions: https://pigsty.io/docs/pgext/
110+
pg_libs: 'pg_stat_statements, auto_explain' # add timescaledb to shared_preload_libraries
111+
pg_extensions: [ pgvector ] # check list for available extension for your pg & os combination: https://pigsty.io/ext/list
112+
113+
# define HBA rules here: https://pigsty.io/docs/pgsql/hba/#define-hba
114+
pg_hba_rules: # example hba rules
115+
- {user: dbuser_view , db: all ,addr: infra ,auth: pwd ,title: 'allow grafana dashboard access cmdb from infra nodes'}
116+
117+
#pg_vip_enabled: true # define a L2 VIP which bind to cluster primary instance
118+
#pg_vip_address: 10.10.10.2/24 # L2 VIP Address and netmask
119+
#pg_vip_interface: eth1 # L2 VIP Network interface, overwrite on host vars if member have different network interface names
120+
node_crontab: [ '00 01 * * * postgres /pg/bin/pg-backup full' ] # make a full backup every 1am
121+
122+
123+
#==============================================================#
124+
# Global Parameters
125+
#==============================================================#
126+
vars:
127+
128+
#----------------------------------#
129+
# Meta Data
130+
#----------------------------------#
131+
version: v3.4.1 # pigsty version string
132+
admin_ip: 10.10.10.10 # admin node ip address
133+
region: default # upstream mirror region: default|china|europe
134+
node_tune: oltp # node tuning specs: oltp,olap,tiny,crit
135+
pg_conf: oltp.yml # pgsql tuning specs: {oltp,olap,tiny,crit}.yml
136+
proxy_env: # global proxy env when downloading packages
137+
no_proxy: "localhost,127.0.0.1,10.0.0.0/8,192.168.0.0/16,*.pigsty,*.aliyun.com,mirrors.*,*.myqcloud.com,*.tsinghua.edu.cn"
138+
# http_proxy: # set your proxy here: e.g http://user:pass@proxy.xxx.com
139+
# https_proxy: # set your proxy here: e.g http://user:pass@proxy.xxx.com
140+
# all_proxy: # set your proxy here: e.g http://user:pass@proxy.xxx.com
141+
infra_portal: # domain names and upstream servers
142+
home : { domain: h.pigsty }
143+
grafana : { domain: g.pigsty ,endpoint: "${admin_ip}:3000" , websocket: true }
144+
prometheus : { domain: p.pigsty ,endpoint: "${admin_ip}:9090" }
145+
alertmanager : { domain: a.pigsty ,endpoint: "${admin_ip}:9093" }
146+
blackbox : { endpoint: "${admin_ip}:9115" }
147+
loki : { endpoint: "${admin_ip}:3100" }
148+
#minio : { domain: m.pigsty ,endpoint: "${admin_ip}:9001" ,scheme: https ,websocket: true }
149+
150+
#----------------------------------#
151+
# MinIO Related Options
152+
#----------------------------------#
153+
#pgbackrest_method: minio # if you want to use minio as backup repo instead of 'local' fs, uncomment this
154+
#minio_users: # and configure `pgbackrest_repo` & `minio_users` accordingly
155+
# - { access_key: dba , secret_key: S3User.DBA, policy: consoleAdmin }
156+
# - { access_key: pgbackrest , secret_key: S3User.Backup, policy: readwrite }
157+
#pgbackrest_repo: # pgbackrest repo: https://pgbackrest.org/configuration.html#section-repository
158+
# minio: ... # optional minio repo for pgbackrest ...
159+
# s3_key: pgbackrest # minio user access key for pgbackrest
160+
# s3_key_secret: S3User.Backup # minio user secret key for pgbackrest
161+
# cipher_pass: pgBackRest # AES encryption password, default is 'pgBackRest'
162+
# if you want to use minio as backup repo instead of 'local' fs, uncomment this, and configure `pgbackrest_repo`
163+
#pgbackrest_method: minio
164+
#node_etc_hosts: [ '10.10.10.10 h.pigsty a.pigsty p.pigsty g.pigsty sss.pigsty' ]
165+
166+
#----------------------------------#
167+
# Credential: CHANGE THESE PASSWORDS
168+
#----------------------------------#
169+
#grafana_admin_username: admin
170+
grafana_admin_password: pigsty
171+
#pg_admin_username: dbuser_dba
172+
pg_admin_password: DBUser.DBA
173+
#pg_monitor_username: dbuser_monitor
174+
pg_monitor_password: DBUser.Monitor
175+
#pg_replication_username: replicator
176+
pg_replication_password: DBUser.Replicator
177+
#patroni_username: postgres
178+
patroni_password: Patroni.API
179+
#haproxy_admin_username: admin
180+
haproxy_admin_password: pigsty
181+
#minio_access_key: minioadmin
182+
minio_secret_key: minioadmin
183+
184+
#----------------------------------#
185+
# Safe Guard
186+
#----------------------------------#
187+
# you can enable these flags after bootstrap, to prevent purging running etcd / pgsql instances
188+
etcd_safeguard: false # prevent purging running etcd instance?
189+
pg_safeguard: false # prevent purging running postgres instance? false by default
190+
191+
#----------------------------------#
192+
# Repo, Node, Packages
193+
#----------------------------------#
194+
repo_modules: node,infra,pgsql,beta
195+
repo_remove: true # remove existing repo on admin node during repo bootstrap
196+
node_repo_remove: true # remove existing node repo for node managed by pigsty
197+
repo_extra_packages: [ pg18-core ]
198+
pg_packages: [ pg18-core, pgsql-common ]
199+
pg_version: 18 # default postgres version
200+
...

install.yml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -138,15 +138,4 @@
138138
- { role: pgsql ,when: pg_cluster is defined }
139139
- { role: pg_monitor ,when: pg_cluster is defined }
140140

141-
142-
#---------------------------------------------------------------
143-
# PGSQL Monitor
144-
#---------------------------------------------------------------
145-
- name: PGSQL MONITOR # init pgsql monitor
146-
become: yes # with pg_cluster defined
147-
hosts: all
148-
gather_facts: no
149-
tags: [monitor, pgsql-monitor ]
150-
roles:
151-
- { role: pg_monitor ,when: pg_cluster is defined }
152141
...

0 commit comments

Comments
 (0)