# Database Section

<!-- Page description found under page header in Chapter View -->

<p hidden>Configuration options for how ESS can communicate with your PostgreSQL database.</p>

<p hidden>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>

<!-- `&nbsp;` used to prevent following text appearing in view -->



<div class="toggle-container" style="float: right;">
  <label for="toggle-switch">Config:</label>
  <label class="switch">
    <input type="checkbox" id="bkmrk-toggle-switch">
    <span class="slider round"></span>
  </label>
</div>
<br />



This section of the ESS installer GUI will only be present if you are using the Kubernetes deployment option or you have opted to use your own PostgreSQL for a Standalone deployment.



If you have not yet set up your PostgreSQL, you should ensure you have done so before proceeding, see the relevant PostgreSQL section from the [Requirements and Recommendations](https://ems-docs.element.io/books/element-server-suite-classic-documentation-lts-2410/page/requirements-and-recommendations) page:

- [Standalone Deployment PostgreSQL Prerequisites](https://ems-docs.element.io/books/element-server-suite-classic-documentation-lts-2410/page/requirements-and-recommendations#bkmrk-postgresql)

- [Kubernetes Deployment PostgreSQL Prerequisites](https://ems-docs.element.io/books/element-server-suite-classic-documentation-lts-2410/page/requirements-and-recommendations#bkmrk-postgresql-1)



<p class='cog'>All settings configured via the UI in this section will be saved to your <code>deployment.yml</code>, with the contents of secrets being saved to <code>secrets.yml</code>. You will find specific configuration examples in each section.</p>



<details class='cog'>

<summary>Config Example</summary>



- `deployment.yml`

  ```yml

  spec:

    components:

      synapse:

        config:

          postgresql:

  ```

- `secrets.yml`

  ```yml

  apiVersion: v1

  kind: Secret

  metadata:

    name: synapse

    namespace: element-onprem

  data:

    postgresPassword: https://ems-docs.element.io/books/element-server-suite-classic-documentation-lts-2504

  ```

</details>



<p class='cog'>By default, if you do not change any settings on this page, defaults will be added to your configuration file/s (see example below).</p>



<details class='cog'>

<summary>Config Example</summary>



```yml
https://ems-docs.element.io/books/element-server-suite-classic-documentation-lts-2504
spec:

  components:

    synapse:

      config:

        postgresql:

          database: synapse

          host: db.example.com

          passwordSecretKey: postgresPassword

          user: test-username

```
https://ems-docs.element.io/books/element-server-suite-classic-documentation-lts-2504
</details>



### PostgreSQL



#### Database



[![](https://ems-docs.element.io/uploads/images/gallery/2024-08/scaled-1680-/image-1724150284621.png)](https://ems-docs.element.io/uploads/images/gallery/2024-08/image-1724150284621.png)



<details class='cog'>

<summary>Config Example</summary>



```yml

spec:

  components:

    synapse:

      config:

        postgresql:

          database: synapse

```

</details>



Enter the name of the PostgreSQL Database you configured per the previously mentioned [Requirements and Recommendations](https://ems-docs.element.io/books/element-server-suite-classic-documentation-lts-2410/page/requirements-and-recommendations) to use for Synapse.



#### Host



[![](https://ems-docs.element.io/uploads/images/gallery/2024-08/scaled-1680-/image-1724150463007.png)](https://ems-docs.element.io/uploads/images/gallery/2024-08/image-1724150463007.png)

https://ems-docs.element.io/books/element-server-suite-classic-documentation-lts-2504

<details class='cog'>

<summary>Config Example</summary>



```yml

spec:

  components:

    synapse:

      config:

        postgresql:

          host: db.example.com
https://ems-docs.element.io/books/element-server-suite-classic-documentation-lts-2504
```

</details>



Enter the fully qualified domain name of the PostgreSQL Database you configured per the previously mentioned [Requirements and Recommendations](https://ems-docs.element.io/books/element-server-suite-classic-documentation-lts-2410/page/requirements-and-recommendations) to use for Synapse.



#### Port



[![](https://ems-docs.element.io/uploads/images/gallery/2024-08/scaled-1680-/image-1724150637542.png)](https://ems-docs.element.io/uploads/images/gallery/2024-08/image-1724150637542.png)



<details class='cog'>

<summary>Config Example</summary>



```yml

spec:

  components:

    synapse:

      config:

        postgresql:

          # port not present when left as default 5432

          port: 5432

```

</details>



Defaults to `5432`, either keep if correct or provide the required port of the PostgreSQL Database you configured per the previously mentioned [Requirements and Recommendations](https://ems-docs.element.io/books/element-server-suite-classic-documentation-lts-2410/page/requirements-and-recommendations) to use for Synapse.





#### SSL Mode



[![](https://ems-docs.element.io/uploads/images/gallery/2024-08/scaled-1680-/image-1724150860317.png)](https://ems-docs.element.io/uploads/images/gallery/2024-08/image-1724150860317.png)



<details class='cog'>

<summary>Config Example</summary>



```yml

spec:

  components:

    synapse:

      config:

        postgresql:

          # sslMode not present when left as default `require` 

          sslMode: require

          # sslMode: disable

          # sslMode: allow

          # sslMode: prefer

          # sslMode: verify-ca

          # sslMode: verify-full

```

</details>



Defaults to `Require` - it is not recommended to disable SSL, so for most setups, this setting should be left as default. 



You should adjust to accommodate your environment as required, the options available are:

- Disable

- Allow

- Prefer

- Require

- Verify CA

- Verify Full



#### User



[![](https://ems-docs.element.io/uploads/images/gallery/2024-08/scaled-1680-/image-1724151253559.png)](https://ems-docs.element.io/uploads/images/gallery/2024-08/image-1724151253559.png)



<details class='cog'>

<summary>Config Example</summary>



```yml

spec:

  components:

    synapse:

      config:

        postgresql:

          user: test-username

```

</details>



Enter the username of a user who can access the PostgreSQL Database you configured per the previously mentioned [Requirements and Recommendations](https://ems-docs.element.io/books/element-server-suite-classic-documentation-lts-2410/page/requirements-and-recommendations) to use for Synapse.



#### PostgreSQL Password



[![](https://ems-docs.element.io/uploads/images/gallery/2024-08/scaled-1680-/image-1724151325375.png)](https://ems-docs.element.io/uploads/images/gallery/2024-08/image-1724151325375.png)



<details class='cog'>

<summary>Config Example</summary>



- `secrets.yml`

  ```yml

  apiVersion: v1

  kind: Secret

  metadata:

    name: synapse

    namespace: element-onprem

  data:

    postgresPassword: dGVzdC1wYXNzd29yZA==

  ```

</details>



Enter the password for the specified user who can access the PostgreSQL Database you configured per the previously mentioned [Requirements and Recommendations](https://ems-docs.element.io/books/element-server-suite-classic-documentation-lts-2410/page/requirements-and-recommendations) to use for Synapse.



### Advanced



#### Connection Pool



##### Max / Min Connections



[![](https://ems-docs.element.io/uploads/images/gallery/2024-08/scaled-1680-/image-1724151480786.png)](https://ems-docs.element.io/uploads/images/gallery/2024-08/image-1724151480786.png)





<details class='cog'>

<summary>Config Example</summary>



```yml

spec:

  components:

    synapse:

      config:

        postgresql:

          # connectionPool not present when left as default

          connectionPool:

            maxConnections: 10

            minConnections: 5

```

</details>



In most deployments you should not need to configure these settings, however if required, you can adjust both the minimum and maximum connections in the Synapse connection pool.