Configuring central database access to the Utility Docker container
Centralized configuration of database access information allows utilities to run without having to directly specify login and other information. Using this feature, the Utility Docker container will have the information available after being created. There are three ways to make centralized database connection information available to the Utility Docker container.
About this task
After database access information is centralized using this feature, every Utility Docker
container that is created will have the database information built into it. The startup process involves:
- Collecting the database access information.
- Placing the database access information in the following file:
/opt/WebSphere/CommerceServer90/xml/config/alldbconnector.xml
<override identifier= "default" enabled="yes">
<jdbcurl value="jdbc:db2://vm32.mycompany.com:50000/mall" enabled="yes"/>
<property name="user" value="wcs"/> <property name="password" value="wcs1"/>
</override>
This database information must be available to the Utility Docker container at the time of its
creation. There are three ways that the information can be made available: via Vault; through the
config.properties file; or as environment variables within the Docker image
itself. The configUtility.sh process will try to search for the variables in the following sequence:
- First, it checks for the environment variables which signal that the container is setup with Vault: VAULT_TOKEN, VAULT_URL, TENANT, ENVIRONMENT, ENVTYPE. If these are present, the database access information will be retrieved from Vault. Note that the process will not use other methods for obtaining the database access information. Therefore, if one database profile is in Vault then all need to be in Vault.
- If Vault environment variables are not available, the process will attempt to retrieve the database access information from environment variables.
Procedure
Adding database login variables to Vault
-
Open a command line window in the Utility Docker container. For more information, see Running utilities from the Utility server Docker container.
- Use curl to add the variables for the default database profile: dbHost,
dbPort, dbName, dbType,
dbUser, dbPass. The following example shows the addition of
the 'mall'
dbName.
curl -X POST -H "X-Vault-Token:7f47efbb-b162-619b-0ced-448079d91b77" -d '{"value":"mall"}' http://myhostname.com:8200/v1/MyCompany/Non-production/auth/dbName
- Use curl to add the variables for the default database profile: dbHost,
dbPort, dbName, dbType,
dbUser, dbPass. The following example shows the addition of
the 'mall'
dbName.
Adding profile information as environment variables
-
Instead of adding the variables to Vault as in Steps 1 and 2, you may choose to add them as
environment variables instead.
- Open the /SETUP/ext-config/config.properties file for editing.
- Add the following variables to the file: DBHOST, DBPORT, DBNAME, DBTYPE, DBUSER, DBPASS.
- Save and exit the file.