Configuring remote databases for IBM Cloud Private Cloud Foundry

You can use an extension to modify your IBM® Cloud Private Cloud Foundry deployment manifest to use external databases.

Before you begin

Prepare external databases

You must prepare external databases before applying the extension. All required databases can be created on different database servers. The database server type and the connection port number must be the same. MySQL and Postgres are currently supported.

  1. Log in to the database server or servers and create the following external databases. Optionally you can name these databases differently. Make note of the names and use them later when you configure the extension.
    • cloud_controller
    • credhub
    • diego
    • locket
    • network_connectivity
    • network_policy
    • routing-api
    • uaa
  2. If you are using a Postgres database, connect to each database and install the citext extension by using the following SQL:

    create extension citext;
    
  3. Ensure that the connection port is open in the firewall and that remote connection is allowed for these databases.

Clone the cfp-cf-ext-db-extension repository

Apply the cfp-cf-ext-db-extension before your initial deployment. If you apply this extension after the initial deployment, it requires redeployment, which results in data loss.

Creating the extension .zip file

Clone the Git repository https://github.com/ibm-cloud-architecture/cfp-cf-ext-db-extension. In the project root, create the extension .zip file by using the following command:

  zip -r ../cfp-cf-ext-db-extension.zip *

Registering the extension

  1. Copy the .zip file to the IBM Cloud Private Cloud Foundry installer directory of the inception VM.
  2. Run the following command to register the extension. Ensure the extension .zip file path is correct.
    ./cm extension -e cfp-cf-ext-db-extension register -p ./cfp-cf-ext-db-extension
    
  3. Configure the extension by using the command line or by using the Cloud Foundry deployment tool.

Configuring the extension by using the command line

  1. Create the ext-db-uiconfig.yml file in the IBM Cloud Private Cloud Foundry installer directory by using the following content as an example. Replace the examples with the actual values for your deployment.
    YAML
    uiconfig:
     bbs_db_host: 9.21.107.54
     bbs_db_name: diego
     bbs_db_password: postgres
     bbs_db_user: postgres
     cc_db_host: 9.21.107.54
     cc_db_name: cloud_controller
     cc_db_password: postgres
     cc_db_user: postgres
     configuration_name: externaldb
     credhub_db_host: 9.21.107.54
     credhub_db_name: credhub
     credhub_db_password: postgres
     credhub_db_user: postgres
     db_port: 5432                # This port number is used to connect to all databases.
     db_type: postgres        # This database type is used for all databases. Valid values are postgres or mysql.
     locket_db_host: 9.21.107.54
     locket_db_name: locket
     locket_db_password: postgres
     locket_db_user: postgres
     policy_server_db_host: 9.21.107.54
     policy_server_db_name: network_policy
     policy_server_db_password: postgres
     policy_server_db_user: postgres
     routing_api_db_host: 9.21.107.54
     routing_api_db_name: routing-api
     routing_api_db_password: postgres
     routing_api_db_user: postgres
     silk_controller_db_host: 9.21.107.54
     silk_controller_db_name: network_connectivity
     silk_controller_db_password: postgres
     silk_controller_db_user: postgres
     uaa_db_host: 9.21.107.54
     uaa_db_name: uaa
     uaa_db_password: postgres
     uaa_db_user: postgres
    
  2. In the IBM Cloud Private Cloud Foundry installer directory, run the following command to save the extension configuration:
    ./cm extension -e cfp-cf-ext-db-extension save -c ext-db-uiconfig.yml
    
  3. Insert the extension in the main deployment:
    ./cm states insert -i cfp-cf-ext-db-extension
    

Configuring the extension by using the Cloud Foundry deployment tool

  1. Log in to the Cloud Foundry deployment tool.
  2. From the main menu, click 1. Register new extensions.
  3. Find cfp-cf-ext-db-extension and click + to insert the extension in the main deployment.
  4. From the main menu, click 2. Configuration.
  5. Choose External database configuration for cfp-cf-ext-db-extension and click the pencil to edit the configuration.
  6. Provide all required values under each database tab.
  7. Save and exit.

Now the extension is part of the main deployment steps to deploy IBM Cloud Private Cloud Foundry with external databases.

Note: If you have trouble loading changes to the extension with the same name, unregister the extension by using the following command, then register the extension again:

  ./cm extension -e cfp-cf-ext-db-extension unregister