# Configuring Synapse

See how to download example files from the helm chart [here](https://ems-docs.element.io/books/element-server-suite-pro/page/setting-up-ess-pro-helm-chart#bkmrk-downloading-ess-pro-).

### Configuration

For a quick setup using the default settings, see the minimal fragment example in `charts/matrix-stack/ci/fragments/synapse-minimal.yaml`.

### Configuring a postgresql database

If you want to use [an external postgresql](https://charts.element.io/packages/helm/matrix-stack/matrix-stack?modal=values&path=synapse.postgres), see the following fragments examples:
- `charts/matrix-stack/ci/fragments/synapse-postgres.yaml`
- `charts/matrix-stack/ci/fragments/synapse-postgres-secrets-in-helm.yaml` or `charts/matrix-stack/ci/fragments/synapse-postgres-secrets-externally.yaml`

### Credentials

Credentials are generated if possible. Alternatively they can either be provided inline
in the values with `value` or if you have an existing `Secret` in the cluster in the
same namespace you can use `secret` and`secretKey` to reference it.

If you dont want the chart to generate the secret, please refer to the following values fragments examples to see the secrets to configure.

Synapse requires [`registrationSharedSecret`](https://charts.element.io/packages/helm/matrix-stack/matrix-stack?modal=values&path=synapse.registrationSharedSecret), [`signingKey`](https://charts.element.io/packages/helm/matrix-stack/matrix-stack?modal=values&path=synapse.signingKey) and [`macaroon`](https://charts.element.io/packages/helm/matrix-stack/matrix-stack?modal=values&path=synapse.macaroon) secrets:
- `charts/matrix-stack/ci/fragments/synapse-secrets-in-helm.yaml`
- `charts/matrix-stack/ci/fragments/synapse-secrets-externally.yaml`

If you are configuring [S3 storage](https://charts.element.io/packages/helm/matrix-stack/matrix-stack?modal=values&path=synapse.media.s3), see the following values fragments examples to see the secrets to configure:
- `charts/matrix-stack/ci/fragments/synapse-s3-secrets-in-helm.yaml`
- `charts/matrix-stack/ci/fragments/synapse-s3-secrets-externally.yaml`

### Additional configuration

[Additional Synapse configuration](https://charts.element.io/packages/helm/matrix-stack/matrix-stack?modal=values&path=synapse.additional) can be provided inline in the values as a string with
```yaml
synapse:
  additional:
    ## Either reference config to inject by:
    1-custom-config:
      config: |
        admin_contact: "mailto:admin@example.com"
    ## Either reference an existing `Secret` by:
    2-custom-config:
      configSecret: custom-synapse-config
      configSecretKey: shared.yaml
```

### Workers

The following Synapse [workers](https://charts.element.io/packages/helm/matrix-stack/matrix-stack?modal=values&path=synapse.workers) are disabled by default and can be enabled on a per-worker basis :
- `appservice`
- `background`
- `client-reader`
- `encryption`
- `event-creator`
- `event-persister`
- `federation-sender`
- `initial-synchrotron`
- `media-repository`
- `presence-writer`
- `pusher`
- `receipts-account`
- `sliding-sync`
- `sso-login`
- `synchrotron`
- `typing-persister`
- `user-dir`

Synapse [workers](https://charts.element.io/packages/helm/matrix-stack/matrix-stack?modal=values&path=synapse.workers) can be configured in the values with:
```yaml
synapse:
  workers:
    <worker name>:
      enabled: true
```

Each worker comes with a different options (static replicas, horizontal scaling, resources, etc). These options can be seen under [`synapse.workers.<name>`](https://charts.element.io/packages/helm/matrix-stack/matrix-stack?modal=values&path=synapse.workers) section of `helm show values` for this chart.

The following Synapse pro workers are enabled by default :
- `federation-reader`

They can be disabled in the values with :

```yaml
synapse:
  workers:
    <worker name>:
      enabled: false
```


Full details on available configuration options can be found at
https://element-hq.github.io/synapse/latest/usage/configuration/config_documentation.html

### Disabling Synapse

Synapse is enabled for deployment by default can be disabled with the following values
```yaml
synapse:
  enabled: false
```