|
| 1 | +// Module included in the following assemblies: |
| 2 | +// * serverless-logic/serverless-logic-managing-supporting-services |
| 3 | + |
| 4 | + |
| 5 | +:_mod-docs-content-type: REFERENCE |
| 6 | +[id="serverless-logic-supporting-services-persistence-configuration_{context}"] |
| 7 | += Supporting services persistence configurations |
| 8 | + |
| 9 | +The persistence configuration for supporting services in {ServerlessLogicProductName} can be either ephemeral or PostgreSQL, depending on needs of your environment. Ephemeral persistence is ideal for development and testing, while PostgreSQL persistence is recommended for production environments. |
| 10 | + |
| 11 | +[id="serverless-logic-supporting-services-ephemeral-persistence-config_{context}"] |
| 12 | +== Ephemeral persistence configuration |
| 13 | + |
| 14 | +The ephemeral persistence uses an embedded PostgreSQL database that is dedicated to each service. The {ServerlessLogicOperatorName} recreates this database with every service restart, making it suitable only for development and testing purposes. You do not need any additional configuration other than the following `SonataFlowPlatform` CR: |
| 15 | + |
| 16 | +[source,yaml] |
| 17 | +---- |
| 18 | +apiVersion: sonataflow.org/v1alpha08 |
| 19 | +kind: SonataFlowPlatform |
| 20 | +metadata: |
| 21 | + name: sonataflow-platform-example |
| 22 | + namespace: example-namespace |
| 23 | +spec: |
| 24 | + services: |
| 25 | + dataIndex: |
| 26 | + enabled: true |
| 27 | + # Specific configurations for the Data Index Service |
| 28 | + # might be included here |
| 29 | + jobService: |
| 30 | + enabled: true |
| 31 | + # Specific configurations for the Job Service |
| 32 | + # might be included here |
| 33 | +---- |
| 34 | + |
| 35 | +[id="serverless-logic-supporting-services-postgresql-persistence-config_{context}"] |
| 36 | +== PostgreSQL persistence configuration |
| 37 | + |
| 38 | +For PostgreSQL persistence, you must set up a PostgreSQL server instance on your cluster. The administration of this instance remains independent of the {ServerlessLogicOperatorName} control. To connect a supporting service with the PostgreSQL server, you must configure the appropriate database connection parameters. |
| 39 | + |
| 40 | +You can configure PostgreSQL persistence in the `SonataFlowPlatform` CR by using the following example: |
| 41 | + |
| 42 | +.Example of PostgreSQL persistence configuration |
| 43 | +[source,yaml] |
| 44 | +---- |
| 45 | +apiVersion: sonataflow.org/v1alpha08 |
| 46 | +kind: SonataFlowPlatform |
| 47 | +metadata: |
| 48 | + name: sonataflow-platform-example |
| 49 | + namespace: example-namespace |
| 50 | +spec: |
| 51 | + services: |
| 52 | + dataIndex: |
| 53 | + enabled: true |
| 54 | + persistence: |
| 55 | + postgresql: |
| 56 | + serviceRef: |
| 57 | + name: postgres-example <1> |
| 58 | + namespace: postgres-example-namespace <2> |
| 59 | + databaseName: example-database <3> |
| 60 | + databaseSchema: data-index-schema <4> |
| 61 | + port: 1234 <5> |
| 62 | + secretRef: |
| 63 | + name: postgres-secrets-example <6> |
| 64 | + userKey: POSTGRESQL_USER <7> |
| 65 | + passwordKey: POSTGRESQL_PASSWORD <8> |
| 66 | + jobService: |
| 67 | + enabled: true |
| 68 | + persistence: |
| 69 | + postgresql: |
| 70 | + # Specific database configuration for the Job Service |
| 71 | + # might be included here. |
| 72 | +---- |
| 73 | + |
| 74 | +<1> Name of the service to connect with the PostgreSQL database server. |
| 75 | +<2> Optional: Defines the namespace of the PostgreSQL Service. Defaults to the SonataFlowPlatform namespace. |
| 76 | +<3> Defines the name of the PostgreSQL database for storing supporting service data. |
| 77 | +<4> Optional: Specifies the schema for storing supporting service data. Default value is `SonataFlowPlatform` name, suffixed with `-data-index-service` or `-jobs-service`. For example, `sonataflow-platform-example-data-index-service`. |
| 78 | +<5> Optional: Port number to connect with the PostgreSQL Service. Default value is `5432`. |
| 79 | +<6> Defines the name of the secret containing the username and password for database access. |
| 80 | +<7> Defines the name of the key in the secret that contains the username to connect with the database. |
| 81 | +<8> Defines the name of the key in the secret that contains the password to connect with the database. |
| 82 | + |
| 83 | +[NOTE] |
| 84 | +==== |
| 85 | +You can configure each service’s persistence independently by using the respective persistence field. |
| 86 | +==== |
| 87 | + |
| 88 | +Create the secrets to access PostgreSQL by running the following command: |
| 89 | + |
| 90 | +[source,terminal] |
| 91 | +---- |
| 92 | +$ oc create secret generic <postgresql_secret_name> \ |
| 93 | + --from-literal=POSTGRESQL_USER=<user> \ |
| 94 | + --from-literal=POSTGRESQL_PASSWORD=<password> \ |
| 95 | + -n <namespace> |
| 96 | +---- |
| 97 | + |
| 98 | +[id="serverless-logic-supporting-services-common-postgresql-persistence-config_{context}"] |
| 99 | +== Common PostgreSQL persistence configuration |
| 100 | + |
| 101 | +The {ServerlessLogicOperatorName} automatically connects supporting services to the common PostgreSQL server configured in the `spec.persistence` field. |
| 102 | + |
| 103 | +For rules, the following precedence is applicable: |
| 104 | + |
| 105 | +* If you configure a specific persistence for a supporting service, for example, `services.dataIndex.persistence`, it uses that configuration. |
| 106 | +* If you do not configure persistence for a service, the system uses the common persistence configuration from the current platform. |
| 107 | + |
| 108 | +[NOTE] |
| 109 | +==== |
| 110 | +When using a common PostgreSQL configuration, each service schema is automatically set as the `SonataFlowPlatform` name, suffixed with `-data-index-service` or `-jobs-service`, for example, `sonataflow-platform-example-data-index-service`. |
| 111 | +==== |
0 commit comments