# Minimal Install

> install Postgres with minimal dependencies
---

If you just want HA PostgreSQL itself, without monitoring, infra, etc..., consider the slim installation.

There’s no [**`INFRA`**](/docs/infra/) modules, no monitoring, no [**local repo**](/docs/admin/repo) Just [**`ETCD`**](/docs/etcd/) & [**`PGSQL`**](/docs/pgsql/) and partial of [**`NODE`**](/docs/node/)


------

## Overview


To use slim installation, you need to:


### Step 1
      Use the `slim.yml` config template (`configure -c slim`)

### Step 2
      Run the `slim.yml` playbook instead of `install.yml`


```bash
curl https://repo.pigsty.cc/get | bash -s v3.7.0
./configure -c slim
./install.yml
```


Slim installation only installs these essential components:

|  Component  |                         Required                          | Description                                          |
|:-----------:|:---------------------------------------------------------:|------------------------------------------------------|
|   patroni   | <span class="text-red-500 font-black">REQUIRED</span> | Bootstrap HA PostgreSQL cluster                      |
|    etcd     | <span class="text-red-500 font-black">REQUIRED</span> | meta database dependency (DCS) for patroni           |
|  pgbouncer  | <span class="text-blue-500 font-bold">OPTIONAL</span> | Connection pooler for postgres                       |
| vip-manager | <span class="text-blue-500 font-bold">OPTIONAL</span> | L2 VIP binding to postgres cluster leader            |
|   haproxy   | <span class="text-blue-500 font-bold">OPTIONAL</span> | Auto-routing [**service**](/docs/pgsql/service/)          |
|   chronyd   | <span class="text-blue-500 font-bold">OPTIONAL</span> | Time synchronization with NTP server                 |
|    tuned    | <span class="text-blue-500 font-bold">OPTIONAL</span> | Node tuned template and kernel parameters management |

You can turn off the optional components, the only two required components are `patroni` and `etcd`.

Packages are directly installed from the Internet upstream repo, [**offline install**](/docs/install/offline) is not applicable here.


------

## Configure

Config file example: [`conf/slim.yml`](https://github.com/pgsty/pigsty/blob/v3.7.0/conf/slim.yml) for slim installation:


```yaml
all:
  children:
    infra: { hosts: { 10.10.10.10: { infra_seq: 1 }} ,vars: { repo_enabled: false }}
    etcd:  { hosts: { 10.10.10.10: { etcd_seq: 1  }} ,vars: { etcd_cluster: etcd  }}

    #----------------------------------------------#
    # PostgreSQL Cluster
    #----------------------------------------------#
    pg-meta:
      hosts:
        10.10.10.10: { pg_seq: 1, pg_role: primary }
      vars:
        pg_cluster: pg-meta
        pg_users:
          - { name: dbuser_meta ,password: DBUser.Meta   ,pgbouncer: true ,roles: [dbrole_admin   ] ,comment: pigsty admin user }
          - { name: dbuser_view ,password: DBUser.Viewer ,pgbouncer: true ,roles: [dbrole_readonly] ,comment: read-only viewer  }
        pg_databases:
          - { name: meta, baseline: cmdb.sql ,comment: pigsty meta database ,schemas: [pigsty] ,extensions: [ vector ]}
        pg_hba_rules:
          - { user: dbuser_view , db: all ,addr: infra ,auth: pwd ,title: 'allow grafana dashboard access cmdb from infra nodes' }
        node_crontab: [ '00 01 * * * postgres /pg/bin/pg-backup full' ] # make a full backup every 1am

  vars:
    #----------------------------------------------#
    # INFRA : https://doc.pgsty.com/infra/param
    #----------------------------------------------#
    version: v3.7.0                   # pigsty version string
    admin_ip: 10.10.10.10             # admin node ip address
    region: default                   # upstream mirror region: default,china,europe
    infra_portal:                     # domain names and upstream servers
      home         : { domain: h.pigsty }
      grafana      : { domain: g.pigsty ,endpoint: "${admin_ip}:3000" , websocket: true }
      prometheus   : { domain: p.pigsty ,endpoint: "${admin_ip}:9058" }
      alertmanager : { domain: a.pigsty ,endpoint: "${admin_ip}:9059" }
      blackbox     : { endpoint: "${admin_ip}:9115" }
      loki         : { endpoint: "${admin_ip}:3100" }

    #----------------------------------------------#
    # NODE : https://doc.pgsty.com/node/param
    #----------------------------------------------#
    nodename_overwrite: false           # do not overwrite node hostname on single node mode
    node_repo_modules: node,infra,pgsql # add these repos directly to the singleton node
    node_tune: oltp                     # node tuning specs: oltp,olap,tiny,crit

    #----------------------------------------------#
    # PGSQL : https://doc.pgsty.com/pgsql/param
    #----------------------------------------------#
    pg_version: 17                      # Default PostgreSQL Major Version is 17
    pg_conf: oltp.yml                   # pgsql tuning specs: {oltp,olap,tiny,crit}.yml
    pg_packages: [ pgsql-main, pgsql-common ]   # pg kernel and common utils
    #pg_extensions: [pg17-time ,pg17-gis ,pg17-rag ,pg17-fts ,pg17-feat ,pg17-lang ,pg17-type ,pg17-util ,pg17-func ,pg17-admin ,pg17-stat ,pg17-sec ,pg17-fdw ,pg17-sim ,pg17-etl ,pg17-olap]

    #----------------------------------------------#
    # SLIM: http://localhost:3000/docs/install/minimal
    #----------------------------------------------#
    nginx_enabled: false              # nginx not exists
    dns_enabled: false                # dnsmasq not exists
    prometheus_enabled: false         # prometheus not exists
    grafana_enabled: false            # grafana not exists
    pg_exporter_enabled: false        # disable pg_exporter
    pgbouncer_exporter_enabled: false # disable pgbouncer_exporter
    pgbackrest_exporter_enabled: false # disable pgbackrest_exporter
    pg_vip_enabled: false             # disable pg_vip
```


------

## Install

Use the [`slim.yml`](https://github.com/pgsty/pigsty/blob/v3.7.0/slim.yml) playbook instead of the [`install.yml`](https://github.com/pgsty/pigsty/blob/v3.7.0/install.yml) playbook:

```bash
./slim.yml
```

**Do not use install.yml here**

The `slim.yml` playbook is designed to replace the `install.yml` playbook for the minimal installations.
