INFRA Arch

Infrastructure architecture, components and functionality in Pigsty.

Running production-grade, highly available PostgreSQL clusters typically requires a comprehensive set of infrastructure services (foundation) for support, such as monitoring and alerting, log collection, time synchronization, DNS resolution, and local software repositories. Pigsty provides the INFRA module to solve this problem — it’s an optional module, but we strongly recommend enabling it.


Overview

The diagram below shows the architecture of a single-node deployment. The right half represents the components included in the INFRA module:

ComponentTypeDescription
NginxWeb ServerUnified entry for WebUI, local repo, reverse proxy
CACertificateIssues encryption certificates within the environment
GrafanaVisualizationPresents metrics, logs, and traces; hosts dashboards, reports, and custom data apps
VictoriaMetricsTime Series DBScrapes all metrics, Prometheus API compatible, provides VMUI query interface
VictoriaLogsLog PlatformCentralized log storage; all nodes run Vector by default, pushing logs here
VictoriaTracesTracingCollects slow SQL, service traces, and other tracing data
VMAlertAlert EngineEvaluates alerting rules, pushes events to Alertmanager
AlertManagerAlert ManagerAggregates alerts, dispatches notifications via email, Webhook, etc.
BlackboxExporterBlackbox ProbeProbes reachability of IPs/VIPs/URLs
DNSMASQDNS ServiceProvides DNS resolution for domains used within Pigsty [Optional]
ChronydTime SyncProvides NTP time synchronization to ensure all nodes have consistent time [Optional]

pigsty-arch


Nginx

Nginx is the access entry point for all WebUI services in Pigsty, using ports 80 / 443 for HTTP/HTTPS by default. Live Demo

Infrastructure components with WebUIs can be exposed uniformly through Nginx, such as Grafana, VictoriaMetrics (VMUI), AlertManager, and HAProxy console. Additionally, local yum/apt repo and other static resources are served internally via Nginx.

Nginx configures local web servers or reverse proxy servers based on definitions in infra_portal.

infra_portal:
  home : { domain: i.pigsty }

By default, it exposes Pigsty’s admin homepage: i.pigsty. You can expose more services; see Nginx Management for details.

Pigsty allows rich customization of Nginx as a local file server or reverse proxy, with self-signed or real HTTPS certificates. For more information, see: Tutorial: Nginx—Expose Web Services via Proxy and Tutorial: Certbot—Request and Renew HTTPS Certificates


Local Software Repository

Pigsty creates a local software repository on the Infra node during installation to accelerate subsequent software installations. Live Demo

This repository defaults to the /www/pigsty directory, served by Nginx, mounted at the /pigsty path, accessible via ports 80/443.

  • http://<admin_ip>/pigsty / http://i.pigsty/pigsty

Pigsty supports offline installation, which essentially pre-copies a prepared local software repository to the target environment. When Pigsty performs production deployment and needs to create a local software repository, if it finds the /www/pigsty/repo_complete marker file already exists locally, it skips downloading packages from upstream and uses existing packages directly, avoiding internet downloads.

For more information, see: Config: INFRA - REPO


Grafana

Grafana is the core component of Pigsty’s monitoring system, used for visualizing metrics, logs, and various information. Demo

It listens on port 3000 by default, accessible via IP:3000 or http://g.pigsty.

Pigsty provides pre-built Dashboards based on VictoriaMetrics/Logs/Traces, with one-click drill-down and roll-up via URL jumps for rapid troubleshooting.

Grafana can also serve as a low-code visualization platform, so ECharts, victoriametrics-datasource, victorialogs-datasource plugins are installed by default, with Vector/Victoria datasources registered uniformly as vmetrics-*, vlogs-*, vtraces-* for easy custom dashboard extension.

For more information, see: Config: INFRA - GRAFANA.


Victoria Observability Suite

Pigsty v4.0 uses VictoriaMetrics components to replace Prometheus/Loki, providing a unified observability platform:

  • VictoriaMetrics: Listens on port 8428 by default, accessible via http://p.pigsty or https://i.pigsty/vmetrics/ for VMUI, compatible with PromQL, remote read/write protocols, and Alertmanager API.
  • VMAlert: Runs alerting rules on port 8880, sends events to Alertmanager.
  • VictoriaLogs: Listens on port 9428 by default, searchable via https://i.pigsty/vlogs/. Node-side Vector pushes system logs, PostgreSQL logs, etc. structured here.
  • VictoriaTraces: Listens on port 10428, provides Jaeger-compatible interface for slow SQL and trace analysis.
  • Alertmanager: Listens on port 9059, accessible via http://a.pigsty or https://i.pigsty/alertmgr/ for alert routing and notification management.
  • Blackbox Exporter: Listens on port 9115 by default, responsible for ICMP/TCP/HTTP blackbox probing.

For more information, see: Config: INFRA - VICTORIA and Config: INFRA - PROMETHEUS.


Ansible

Pigsty installs Ansible on the meta node by default. Ansible is a popular ops tool with declarative config style and idempotent playbook design, greatly reducing system maintenance complexity.


DNSMASQ

DNSMASQ provides DNS resolution within the environment; domains from other modules are registered with the DNSMASQ service on INFRA nodes.

DNS records are placed in the /etc/hosts.d/ directory on all INFRA nodes by default.

For more information, see: Config: INFRA - DNS and Tutorial: DNS—Configure Domain Resolution


Chronyd

NTP service synchronizes time across all nodes in the environment (optional).

For more information, see: Config: NODES - NTP


Others

EndpointComponentNative PortNotesPublic Demo
/Nginx80/443Homepage, local repo, file serverdemo.pigsty.io
/ui/Grafana3000Grafana dashboard entrydemo.pigsty.io/ui/
/vmetrics/VictoriaMetrics8428Time series DB Web UIdemo.pigsty.io/vmetrics/
/vlogs/VictoriaLogs9428Log DB Web UIdemo.pigsty.io/vlogs/
/vtraces/VictoriaTraces10428Tracing Web UIdemo.pigsty.io/vtraces/
/vmalert/VMAlert8880Alert rule managementdemo.pigsty.io/vmalert/
/alertmgr/AlertManager9059Alert management Web UIdemo.pigsty.io/alertmgr/
/blackbox/Blackbox9115Blackbox probe

A standard Pigsty deployment includes an INFRA module that provides services for managed nodes and database clusters:

The INFRA module is not mandatory for HA PostgreSQL—for example, in slim install mode, the Infra module is not installed. However, the INFRA module provides essential supporting services for running production-grade HA PostgreSQL clusters; it’s strongly recommended to enable it for the complete Pigsty DBaaS experience.

If you already have your own infrastructure (Nginx, local repo, monitoring system, DNS, NTP), you can disable the INFRA module and modify config to use existing infrastructure.

ComponentPortDefault DomainDescription
Nginx80/443i.pigstyWeb portal, local repo
Grafana3000g.pigstyVisualization platform
VictoriaMetrics8428p.pigstyTime series DB (VMUI, Prometheus compatible)
VictoriaLogs9428-Log database (receives Vector push)
VictoriaTraces10428-Trace / slow SQL storage
VMAlert8880-Metrics computation, alerting rules
AlertManager9059a.pigstyAlert aggregation and dispatch
BlackboxExporter9115-Blackbox monitoring probes
DNSMasq53-DNS server
Chronyd123-NTP time server

Last modified 2026-01-07: batch udpate (9892be5)