PIGSTY

Interface

Explore dashboard and access database service

Once installed, you’ll have the four core modules: PGSQL, INFRA, NODE, and ETCD on current node.

IDNODEPGSQLINFRAETCD
1node-1pg-meta-1infra-1etcd-1

You can access WebUI services from the following Ports directly (not recommended for prod). Or use local / public Domain Names to access them via Nginx Portal. SSL Certs can only be used with domains.

ComponentPortDomainCommentPublic Demo
Nginx80/443h.pigstyPortal, Repo, HAProxy Adminhome.pigsty.io
Grafana3000g.pigstyGrafana Dashboardsdemo.pigsty.io
Prometheus9090p.pigstyPrometheus Web UIp.pigsty.io
AlertManager9093a.pigstyAlter Managementa.pigsty.io

You can access the default PostgreSQL database (meta) @ default port 5342 via the following users and corresponding PGURL:

psql postgres://dbuser_dba:DBUser.DBA@10.10.10.10:5432/meta
psql postgres://dbuser_meta:DBUser.Meta@10.10.10.10:5432/meta
psql postgres://dbuser_view:DBUser.Viewer@10.10.10.10:5432/meta

PostgreSQL

For personal usage, you could just use the default superuser and IP:Port to access PostgreSQL:

DBSU

Default Superuser

The default database superuser is dbuser_dba, with DBUser.DBA as default password, use your own if changed.

Usernamedbuser_dbapg_admin_username
PasswordDBUser.DBApg_admin_password

CLI

The built-in psql CLI is already configured with .pgpass and .pg_service.conf for the admin user

p   # alias: os admin user @ current node
psql postgres://dbuser_dba:DBUser.DBA@10.10.10.10/postgres  # replace with your IP and password

GUI

To access your database with graphical interface, you can use your favorite GUI tools, we also have some built-in templates.

NameDescriptionPigsty Support
PgAdminOfficial PostgreSQL administration toolBuilt-in Docker template, OSS
Supabase StudioFancy 3rd party UI for PostgreSQL managementBuilt-in Docker template, OSS
PgWebLightweight web-based PostgreSQL clientBuilt-in Docker template, OSS
BytebaseSchema migration tool with a good GUIBuilt-in Docker template, OSS
DataGrip / IntelliJProfessional database IDE with powerful featuresCommercial / Community
NavicatPopular commercial database management toolCommercial
DBeaverOpen-source universal database GUIOSS

Defaults

You can define business Database and User. These config templates has some pre-defined examples for your reference.

For example, the default meta config template has pre-defined a meta database with Pigsty CMDB schema (optional) and a vector extension. It defines dbuser_meta as business admin user with DDL privilege, and a dbuser_view as read-only viewer user.

pg-meta:
  hosts:
    10.10.10.10: { pg_seq: 1, pg_role: primary } # <---- primary instance with read-write capability
  vars:
    pg_cluster: pg-meta                 # required identity parameter, usually same as group name

    pg_databases:                       # define business databases on this cluster, array of database definition
      - name: meta                      # REQUIRED, `name` is the only mandatory field of a database definition
        baseline: cmdb.sql              # optional, database sql baseline path, (relative to files/)
        schemas: [ pigsty ]             # optional, additional schemas to be created, array of schema names
        extensions: [ vector ]          # optional, additional extensions to be installed: array of `{name[,schema]}`
        comment: pigsty meta database   # optional, comment string for this database

    pg_users:                           # define business users/roles on this cluster, array of user definition
      - name: dbuser_meta               # REQUIRED, `name` is the only mandatory field of a user definition
        password: DBUser.Meta           # optional, password can be a scram-sha-256 hash string or plain text
      - { name: dbuser_view ,password: DBUser.Viewer ,pgbouncer: true ,roles: [dbrole_readonly], comment: read-only viewer for meta database }

    pg_hba_rules:                       # example hba rules
      - {user: dbuser_view , db: all ,addr: infra ,auth: pwd ,title: 'allow grafana dashboard access cmdb from infra nodes'}

Which means your can also access the meta database with these two users:

psql postgres://dbuser_meta:DBUser.Meta@10.10.10.10:5432/meta
psql postgres://dbuser_view:DBUser.Viewer@10.10.10.10:5432/meta

Production

To use HA PostgreSQL cluster in production environment, you'll need to read the following documents to proceed:

In that case, your traffic is usually distributed by haproxy and pooled by pgbouncer before reaching the database.


Grafana

Grafana is the platform for monitoring and observability, it listens on port 3000 by default:

Access via domain name

Pigsty has static local (fake) domain names for web components, you can access Grafana via http://g.pigsty through Nginx It's advised to use domain names, Since you can expose all services via Nginx with domain names, and use SSL certs for them.

Grafana Username and Password

Default credential: admin:pigsty. If you have changed the default credentials, use your own.

You can check our public demo site to see what it looks like:

pigsty-home.jpg

SSL with local fake domain

Pigsty issues self-signed SSL certs for local static domain names, but you'll have to trust the self-signed CA in your browser.

Use real domain names and certs

Pigsty has support for using real domain names and SSL certs

Just replace domain entries in infra_portal, and use make cert to apply for real certs for free