# User Interface

> Explore dashboard and access database service
---

Once installed, you’ll have the four core modules:
[**`PGSQL`**](/docs/pgsql/), [**`INFRA`**](/docs/infra/), [**`NODE`**](/docs/node/), and [**`ETCD`**](/docs/etcd/) on current node.

| ID | [NODE](/docs/node) | [PGSQL](/docs/pgsql) | [INFRA](/docs/infra) | [**ETCD**](/docs/etcd) |
|:--:|:-------------:|:---------------:|:---------------:|:-----------------:|
| 1  |   `node-1`    |   `pg-meta-1`   |    `infra-1`    |     `etcd-1`      |


You can access [WebUI](#grafana) services from the following **Ports** directly (not recommended for prod).
Or use local / public [Domain Names](/docs/admin/domain) to access them via [Nginx Portal](/docs/admin/portal).
[SSL Certs](/docs/admin/cert) can only be used with domains.


|         Component          |   Port   |   Domain   | Comment                     | Public Demo                                |
|:--------------------------:|:--------:|:----------:|-----------------------------|--------------------------------------------|
| [**Nginx**](/docs/admin/portal) | `80/443` | `h.pigsty` | Portal, Repo, HAProxy Admin | [`home.pigsty.io`](https://h.pigsty.io)    |
|  [**Grafana**](#grafana)   |  `3000`  | `g.pigsty` | Grafana Dashboards          | [`g.pgsty.com`](https://g.pgsty.com) |
|         Prometheus         |  `9058`  | `p.pigsty` | Prometheus Web UI           | [`p.pigsty.io`](https://p.pigsty.io)       |
|        AlertManager        |  `9059`  | `a.pigsty` | Alert Management            | [`a.pigsty.io`](https://a.pigsty.io)       |

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

```bash tab="dbuser_dba"
psql postgres://dbuser_dba:DBUser.DBA@10.10.10.10:5432/meta
```
```bash tab="dbuser_meta"
psql postgres://dbuser_meta:DBUser.Meta@10.10.10.10:5432/meta
```
```bash tab="dbuser_view"
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.

|   Username   | `dbuser_dba`  | [`pg_admin_username`](/docs/pgsql/param#pg_admin_username) |
|:------------:|---------------|------------------------------------------------------------|
| **Password** | `DBUser.DBA` | [`pg_admin_password`](/docs/pgsql/param#pg_admin_password)  |

### CLI

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

```bash tab="alias"
p   # alias: os admin user @ current node
```
```bash tab="psql"
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.

| Name                                                                                          | Description                                      | Pigsty Support                |
|-----------------------------------------------------------------------------------------------|--------------------------------------------------|-------------------------------|
| [PgAdmin](https://www.pgadmin.org/)                                                           | Official PostgreSQL administration tool          | Built-in Docker template, OSS |
| [Supabase Studio](https://supabase.com/blog/supabase-studio)                                  | Fancy 3rd party UI for PostgreSQL management     | Built-in Docker template, OSS |
| [PgWeb](https://sosedoff.github.io/pgweb/)                                                    | Lightweight web-based PostgreSQL client          | Built-in Docker template, OSS |
| [Bytebase](https://www.bytebase.com/)                                                         | Schema migration tool with a good GUI            | Built-in Docker template, OSS |
| [DataGrip](https://www.jetbrains.com/datagrip/) / [IntelliJ](https://www.jetbrains.com/idea/) | Professional database IDE with powerful features | Commercial / Community        |
| [Navicat](https://www.navicat.com/)                                                           | Popular commercial database management tool      | Commercial                    |
| [DBeaver](https://dbeaver.io/)                                                                | Open-source universal database GUI               | OSS                           |

### Defaults

You can define business [**Database**](/docs/pgsql/db) and [**User**](/docs/pgsql/user). These [config templates](/docs/config/template) has some pre-defined examples for your reference.

For example, the default [`meta`](https://github.com/pgsty/pigsty/blob/v3.7.0/conf/meta.yml#L51) config template has pre-defined a `meta` database with Pigsty [CMDB](/docs/config/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.


```yaml
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 you can also access the `meta` database with these two users:

```bash tab="dbuser_meta"
psql postgres://dbuser_meta:DBUser.Meta@10.10.10.10:5432/meta
```
```bash tab="dbuser_view"
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:

- [Feature: PostgreSQL High-Availability](/docs/feat/ha)
- [Service: Access Postgres Cluster](/docs/pgsql/service)

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

![](/img/pigsty/ha.png)




-------

## Grafana

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

- http://10.10.10.10:3000 (replace with your IP)

**Access via domain name**

Pigsty support static [local domain (fake)](/zh/docs/admin/domain#local-static-resolution) for web components, you can access Grafana via `http://g.pigsty` through Nginx
It&#39;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.

|   Username   | `admin`  | [`grafana_admin_username`](/docs/infra/param#grafana_admin_username) |
|:------------:|----------|----------------------------------------------------------------------|
| **Password** | `pigsty` | [`grafana_admin_password`](/docs/infra/param#grafana_admin_password) |

You can check our public demo site to see what it looks like: https://g.pgsty.com

![pigsty-home.jpg](/img/pigsty/home.jpg)

**SSL with local fake domain**

Pigsty issues self-signed SSL certs for local static domain names, but you&#39;ll have to [trust the self-signed CA](/docs/admin/domain#trust-self-signed-ca) in your browser.

**Use real domain names and certs**

Pigsty has support for using [real domain names](/docs/admin/domain#public-domain-resolution) and [SSL certs](/docs/admin/cert)

Just replace `domain` entries in [`infra_portal`](/docs/infra/param#infra_portal), and use [`make cert`](/docs/admin/cert) to apply for real certs for free
