|
4 | 4 |
|
5 | 5 | :_mod-docs-content-type: PROCEDURE |
6 | 6 | [id="results-db_{context}"] |
7 | | -= Preparing a secret with the database credentials |
| 7 | += Configuring an external database server |
8 | 8 |
|
9 | | -{tekton-results} uses a PostgreSQL database to store data. You can configure the installation to use either a PostgreSQL server that is automatically installed with {tekton-results} or an external PostgreSQL server that already exists in your deployment. In both cases, provide a secret with the database credentials. |
| 9 | +{tekton-results} uses a PostgreSQL database to store data. By default, the installation includes an internal PostgreSQL instance. |
| 10 | +You can configure the installation to use an external PostgreSQL server that already exists in your deployment. |
10 | 11 |
|
11 | 12 | .Procedure |
12 | 13 |
|
13 | | -Complete one of the following steps: |
14 | | - |
15 | | -* If you do not need to use an external PostgreSQL server, create a secret with the database user named `result` and a random password in the `openshift-pipelines` namespace by entering the following command: |
| 14 | +. Create a secret with the credentials for connecting to your PostgreSQL server by entering the following command: |
16 | 15 | + |
17 | 16 | [source,terminal] |
18 | 17 | ---- |
19 | 18 | $ oc create secret generic tekton-results-postgres \ |
20 | 19 | --namespace=openshift-pipelines \ |
21 | | - --from-literal=POSTGRES_USER=result \ |
22 | | - --from-literal=POSTGRES_PASSWORD=$(openssl rand -base64 20) |
| 20 | + --from-literal=POSTGRES_USER=<user> \ |
| 21 | + --from-literal=POSTGRES_PASSWORD=<password> |
23 | 22 | ---- |
24 | | -+ |
25 | | -[NOTE] |
26 | | -==== |
27 | | -In this command and in subsequent commads, if you configured a custom target namespace for {pipelines-shortname}, use the name of this namespace instead of `openshift-pipelines`. |
28 | | -==== |
29 | 23 |
|
30 | | -* If you want to use an external PostgreSQL database server to store {tekton-results} data, create a secret with the credentials for this server by entering the following command: |
| 24 | +. Edit the `TektonConfig` custom resource (CR) by using the following command: |
31 | 25 | + |
32 | 26 | [source,terminal] |
33 | 27 | ---- |
34 | | -$ oc create secret generic tekton-results-postgres \ |
35 | | - --namespace=openshift-pipelines \ |
36 | | - --from-literal=POSTGRES_USER=<user> \ # <1> |
37 | | - --from-literal=POSTGRES_PASSWORD=<password> #<2> |
| 28 | +$ oc edit TektonConfig config |
38 | 29 | ---- |
39 | 30 | + |
40 | | -Replace `<user>` with the username for the PostgreSQL user that {tekton-results} must use. Replace `<password>` with the password for the same account. |
| 31 | +Make the following changes in the `result` spec: |
| 32 | ++ |
| 33 | +[source,yaml] |
| 34 | +---- |
| 35 | +apiVersion: operator.tekton.dev/v1alpha1 |
| 36 | +kind: TektonConfig |
| 37 | +metadata: |
| 38 | + name: config |
| 39 | +spec: |
| 40 | + result: |
| 41 | + is_external_db: true |
| 42 | + db_host: database.example.com # <1> |
| 43 | + db_port: 5342 # <2> |
| 44 | +---- |
| 45 | +<1> Provide the host name of your PostgreSQL server. |
| 46 | +<2> Provide the port number of your PostgreSQL server. |
0 commit comments