Configuring an external database for DAM
The Digital Asset Management (DAM) feature of HCL Digital Experience (DX) uses an internal PostgreSQL service as its default persistence backend. This guide explains how you can utilize an external PostgreSQL database from a cloud provider or self-hosted environment.
Prerequisites
Before configuring the external database, ensure the following:
- The external database is running PostgreSQL version 16.
- There is network access between your DAM application and the external PostgreSQL database.
- A database is set up for DAM.
- Roles are created with the necessary permissions to the database For more information, refer to Step 2 of Setting up a PostgreSQL database.
Configuring DAM to use the external database
After setting up the database, you can configure DAM to connect to the external PostgreSQL instance:
-
If your external database requires an SSL connection, create a Kubernetes Secret containing your SSL certificate file using the following command. This Secret will be mounted to the DAM container.
kubectl -n <namespace> create secret generic custom-db-ssl-cert --from-file=<path-to-your-ssl-pem-crt-file>Replace
<path-to-your-ssl-pem-crt-file>with the actual path to your SSL certificate file. -
Back up and import your existing database:
- Export the database dump from your current persistence node. For more information, refer to Backup Persistence.
- Import this database dump into your external database instance.
Note
Ensure you suspend all authoring operations on the DAM during the database export and import procedure to avoid introducing invalid data into the external database. To do so, scale down the replica to 0 for
digitalAssetManagementunderscaling.replicasin thevalues.yamlfile. -
Update your custom values YAML file:
- Open your custom values YAML file for editing.
- Set the
persistencefield underapplicationstofalseto disable the persistence and persistence pool nodes. Ensure thepersistencefield remains enabled for any other services (for example,people service) that still require the persistence functionality. - Modify the database hostname in the
configuration.persistence.hostfield to point to your external database. - Modify the database name in the
configuration.persistence.databaseNamefield to point to your database name. - If applicable, set the
configuration.persistence.sslfield totrue.
-
Perform a Helm upgrade using the following command:
helm upgrade <release-name> <chart-path> -f <values-file>
Sample scenario
This section provides a general example of the required steps to prepare any external PostgreSQL database for DAM, whether it is on a cloud provider such as AWS RDS or Azure Database for PostgreSQL, or on a self-hosted server. The specific commands may vary based on your chosen environment.
Setting up a PostgreSQL database
-
Connect to your PostgreSQL instance.
-
Create the necessary database, roles, and permissions using SQL commands similar to the following:
CREATE DATABASE <database>; CREATE ROLE <dxuser> WITH CREATEROLE login PASSWORD '<password>'; CREATE USER <damuser> WITH LOGIN PASSWORD '<password>'; ALTER DATABASE <database> OWNER TO <damuser>; GRANT CREATE ON DATABASE <database> TO <dxuser>; GRANT <damuser> TO <dxuser> WITH ADMIN OPTION; CREATE EXTENSION IF NOT EXISTS "uuid-ossp";This prepares the database schema for the DAM application.
If this is a fresh deployment and you choose to use a single credential, use the following SQL commands:
CREATE DATABASE <database>; CREATE ROLE <userid> with CREATEROLE login PASSWORD '<password>'; GRANT CREATE ON DATABASE <database> TO <userid>; CREATE EXTENSION IF NOT EXISTS "uuid-ossp";Update the same credentials for both the
dbUseranddamUserin values YAML. Refer digitalAssetManagement section in security configuration -
Back up and transfer the database dump:
- Export a database dump from your existing DAM persistence node.
- Transfer the
.dmpfile to a location accessible for import into your external database.
-
Import the database dump into the
<database>using the appropriate tools for your environment (for example,psql). -
Confirm that the data has been imported correctly by logging in to the
<database>using the<damUser>credentials. -
Configure your DAM application to connect to the external database. For more information, refer to Configuring DAM to use the external database.
- If your database is SSL enabled, ensure you have created the necessary Secret.
- Update your custom values YAML file to point to the external database host and enable SSL.
- Perform a Helm upgrade to apply the changes.
Rollback options
If you encounter issues after configuring DAM to use an external database, you can revert to the internal PostgreSQL persistence by following these steps:
-
Revert your custom values YAML:
- Open your custom values YAML file for editing.
- Set the
persistencefield underapplicationsback totrueto re-enable the internal persistence and persistence pool nodes. - Set
configuration.persistence.hostto empty. - Set
configuration.persistence.databaseNametodxmediadb - Set the
configuration.persistence.ssltofalse.
-
Restore the database dump that you created in Step 2 of Configuring DAM to use the external database back into the internal PostgreSQL instance, especially if any data was written during the brief period the external database was active. If not, ignore this step. For more information on how to import the database, refer to Restore persistence.
-
If credentials have been updated for external database, ensure they are reverted back. For more information, refer to Adjusting default credentials.
-
Delete the secret using the following command:
kubectl -n <namespace> delete secret custom-db-ssl-cert -
Perform a Helm upgrade using the following command:
helm upgrade <release-name> <chart-path> -f <values-file>
Limitations
- Changing user credentials using the Helm chart will not automatically update the external database. You must perform these updates manually in your external database instance.
- The option to use the same credentials for both
dbUseranddamUseris only applicable to new deployments.