# Provisioner installation with Managed Postgres

To install the PerfectScale Provisioner with Managed Postgres, you first need to set up a Postgres database and then configure its connection details in the config.yaml file for the PerfectScale self-hosted platform.

## Prerequisites

1. A running Postgres instance (either self-hosted or managed).
2. Access to the Postgres instance with sufficient privileges to create databases and users.
3. The Postgres instance should be accessible from the PerfectScale on-prem cluster nodes.

{% hint style="info" %}
We tested it using PostgreSQL version 16.
{% endhint %}

## Provisioning options

You can use one of the following options in order to configure provisioning:

* **Manual provisioning** - requires manual creation of databases, users, and schemas.
* **Automated provisioning** - requires passing superuser credentials to PerfectScale on-prem, and it will create databases, users, and schemas on your behalf.

### Manual Provisioning

In this case, you don't need to pass superuser (postgres by default) credentials to PerfectScale, instead, you need to manually create databases, users, and schemas.

In the `config.yaml` file, you need to set the following parameters:

{% hint style="info" %}
Ensure to update the host, port, and SSL mode to your values.
{% endhint %}

```yaml
deploy_postgres_chart: false
deploy_postgres_init_chart: false
postgres_host: <your-postgres-host>
postgres_port: 5432
postgres_ssl_mode: require
```

To get SQL commands for manual provisioning, use the `provisioner` CLI tool:

```bash
/provisioner pg-init-print
```

### Automated Provisioning <a href="#automated-provisioning" id="automated-provisioning"></a>

To automate provisioning, you need to pass superuser credentials to PerfectScale. In this case, PerfectScale will create databases, users, and schemas on your behalf.

In the `config.yaml` file, you need to set the following parameters:

```yaml
deploy_postgres_chart: false
deploy_postgres_init_chart: true
postgres_host: <your-postgres-host>
postgres_port: 5432
postgres_ssl_mode: require
postgres_admin_user_name: <your-postgres-superuser> # e.g. postgres
postgres_admin_user_pass: <your-postgres-superuser-password>
```

{% hint style="info" %}
Postgres superuser credentials are stored in the postgres-creds secret (key postgres-password) in the PerfectScale Onprem namespace.
{% endhint %}
