Configuring an external database for Build
You can configure Build to use the same external MySQL database that is used by Deploy. When using an external database, the Build Helm chart must be configured to connect to the existing MySQL instance instead of creating a database inside the Kubernetes cluster.
Before you begin
You must have completed the following tasks:
- Ensured that the external MySQL database used by Deploy is available and accessible from the Kubernetes cluster.
- Ensured that the following information is available:
MySQL host name or IP addressMYSQL portDatabase nameDatabase user nameDatabase password
-
Ensured that the database user has permission to access the required database.
-
Ensured that the Kubernetes cluster is connected to the MySQL server.
-
Esnured that a Kubernetes secret containing the database password exists in the deployment namespace.
Procedure
-
Add variables for the external MySQL database in the installation script:
MYSQL_HOST=<mysql-host> MYSQL_PORT=3306 DATABASE_NAME=<database-name> DATABASE_USER=<database-user> BUILD_DB_SECRET=build-secretThese variables define the connection details for the external MySQL database used by the Build.
-
Create a Kubernetes secret that contains the database password by running the
following command:
BUILD_DB_PASSWORD=<DATABASE_PASSWORD> kubectl create secret generic build-secret -n devops-loop --from-literal=dbpassword="$BUILD_DB_PASSWORD"⚠️ Important: The
BUILD_DB_PASSWORDmust match the password assigned to the MySQL user. -
Add the following Helm values to the
HELM_OPTIONSsection of the installation script. These parameters configure the Build Helm chart to use the external database.--set hcl-devops-build.externalDB.enabled=true \ --set hcl-devops-build.externalDB.hostname=<MYSQL_HOST> \ --set hcl-devops-build.externalDB.port=<MYSQL_PORT> \ --set hcl-devops-build.externalDB.database=<DATABASE_NAME> \ --set hcl-devops-build.externalDB.user=<DATABASE_USER> \ --set hcl-devops-build.secret.name=build-secret