Chapter 11. Setting up your 3scale system image with an Oracle Database
- The Oracle Database is only supported with OpenShift Container Platform (OCP) 3.11 when you are performing a template-based installation of 3scale.
- The Oracle Database is not supported with OCP version 4.2 and 4.3 when you are performing an operator-only installation of 3scale.
- For more information about supported configurations, see the Red Hat 3scale API Management Supported Configurations page.
This section explains how a Red Hat 3scale API Management administrator sets up the 3scale system image with an Oracle Database. By default, 3scale 2.9 has a component called system that stores configuration data in a MySQL database. You can override the default database and store your information in an external Oracle Database. Follow the steps in this chapter to build a custom system container image with your own Oracle Database client binaries and deploy 3scale to OpenShift.
Prerequisites
- Download the basic-lite or basic client, the ODBC driver, and the SDK for either Oracle Database 12c or Oracle Database 19c from the Instant Client Downloads for Linux x86-64 (64-bit) page.
A supported version of the following Oracle software components:
- Oracle Instant Client Package: Basic or Basic Light
- Oracle Instant Client Package: SDK
- Oracle Instant Client Package: ODBC
Oracle 12c example packages for 3scale 2.9 and 2.9.1
- Oracle Instant Client Package - Basic: instantclient-basic-linux.x64-12.2.0.1.0.zip or instantclient-basiclite-linux.x64-12.2.0.1.0.zip
- Oracle Instant Client Package - SDK: instantclient-sdk-linux.x64-12.2.0.1.0.zip
- Oracle Instant Client Package - ODBC: instantclient-odbc-linux.x64-12.2.0.1.0-2.zip
Oracle 19c example packages for 3scale 2.9.1
- Oracle Instant Client Package - Basic or Basic Light: instantclient-basic-linux.x64-19.8.0.0.0dbru.zip or instantclient-basiclite-linux.x64-19.8.0.0.0dbru.zip
- Oracle Instant Client Package - SDK: instantclient-sdk-linux.x64-19.8.0.0.0dbru.zip
- Oracle Instant Client Package - ODBC: instantclient-odbc-linux.x64-19.8.0.0.0dbru.zip
To set up your 3scale system image with and Oracle Database, perform the steps outlined in the following sections:
11.1. Preparing the Oracle Database
This section provides steps for preparing your Oracle Database.
Prerequisites
- A supported version of the Oracle Database accessible from your OpenShift cluster.
- Access to the Oracle Database system user for installation procedures.
Procedure
Create a new database.
To configure 3scale with Oracle Database, use the following settings:
ALTER SYSTEM SET max_string_size=extended SCOPE=SPFILE;
Collect the database details.
You need the following information for 3scale configuration:
- The Oracle Database URL address.
- The Oracle Database. service name
The Oracle Database system password.
The
DATABASE_URL
parameter must follow this format:oracle-enhanced://${user}:${password}@${host}:${port}/${database}
Example
DATABASE_URL="oracle-enhanced://user:password@my-oracle-database.com:1521/threescalepdb"
Additional resources
- For information on creating a new database in Oracle Database, see the Oracle documentation.
11.2. Building the system image
This section provides steps to build the system image.
Prerequisites
- You should have already carried out the steps in Preparing the Oracle Database.
Procedure
Clone the OpenShift Templates for 3scale from the GitHub repository. Use the following command:
$ git clone --branch 2.9.1.GA https://github.com/3scale/3scale-amp-openshift-templates.git
-
Place your Oracle Database Instant Client Package files into the
3scale-amp-openshift-templates/amp/system-oracle/oracle-client-files
directory. - Download the 3scale 2.9 amp.yml template.
Run the
oc new-app
command with the-f
option and specify thebuild.yml
OpenShift template:$ oc new-app -f build.yml
Run the
oc new-app
command with the-f
option to indicate theamp.yml
OpenShift template, and the-p
option to specify theWILDCARD_DOMAIN
parameter with the domain of your OpenShift cluster:$ oc new-app -f amp.yml -p WILDCARD_DOMAIN=mydomain.com
Enter the following
oc patch
commands, replacingSYSTEM_PASSWORD
with the Oracle Databasesystem
password you set up in Preparing the Oracle Database:$ oc patch dc/system-app -p '[{"op": "add", "path": "/spec/strategy/rollingParams/pre/execNewPod/env/-", "value": {"name": "ORACLE_SYSTEM_PASSWORD", "value": "SYSTEM_PASSWORD"}}]' --type=json $ oc patch dc/system-app -p '{"spec": {"strategy": {"rollingParams": {"post":{"execNewPod": {"env": [{"name": "ORACLE_SYSTEM_PASSWORD", "value": "SYSTEM_PASSWORD"}]}}}}}}'
Enter the following command, replacing
DATABASE_URL
to point to your Oracle Database, specified in Preparing the Oracle Database:$ oc patch secret/system-database -p '{"stringData": {"URL": "DATABASE_URL"}}'
Enter the
oc start-build
command to build the new system image:$ oc start-build 3scale-amp-system-oracle --from-dir=.
Wait until the build completes. To see the state of the build, run the following command:
$ oc get build <build-name> -o jsonpath="{.status.phase}"
- Wait until the build is in a Complete state.
11.2.1. Updating ImageChange triggers
Update the ImageChange triggers of the DeploymentConfigs that use the System image so they use the new Oracle-based System image.
Prerequisites
- First carry out the steps in Building the system image.
Procedure
Save the current 3scale release in an environment variable:
$ export THREESCALE_RELEASE=2.9
Update the
system-app
ImageChange trigger:$ oc set triggers dc/system-app --from-image=amp-system:${THREESCALE_RELEASE} --containers=system-master,system-developer,system-provider --remove $ oc set triggers dc/system-app --from-image=amp-system:${THREESCALE_RELEASE}-oracle --containers=system-master,system-developer,system-provider
This triggers a redeployment of the
system-app
DeploymentConfig. Wait until it is redeployed, its corresponding new pods are ready, and the old ones have stopped.Update the
system-sidekiq
ImageChange trigger:$ oc set triggers dc/system-sidekiq --from-image=amp-system:${THREESCALE_RELEASE} --containers=system-sidekiq,check-svc --remove $ oc set triggers dc/system-sidekiq --from-image=amp-system:${THREESCALE_RELEASE}-oracle --containers=system-sidekiq,check-svc
This triggers a redeployment of the
system-sidekiq
DeploymentConfig. Wait until it is redeployed, its corresponding new pods are ready, and the old ones have stopped.Update the
system-sphinx
ImageChange trigger:$ oc set triggers dc/system-sphinx --from-image=amp-system:${THREESCALE_RELEASE} --containers=system-sphinx,system-master-svc --remove $ oc set triggers dc/system-sphinx --from-image=amp-system:${THREESCALE_RELEASE}-oracle --containers=system-sphinx,system-master-svc
This triggers a redeployment of the
system-sphinx
DeploymentConfig. Wait until it is redeployed, its corresponding new pods are ready, and the old ones have stopped.
Additional resources
For more information about 3scale and Oracle Database support, see Red Hat 3scale API Management Supported Configurations.