CS Launch MariaDB: Difference between revisions

From Computer Science Wiki
Jump to navigation Jump to search
Carnold (talk | contribs)
m Protected "CS Launch MariaDB" ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))
Carnold (talk | contribs)
No edit summary
Line 32: Line 32:
** <code>MARIADB_PASSWORD</code> = <code>Insecure</code>
** <code>MARIADB_PASSWORD</code> = <code>Insecure</code>
* '''Click on the ''Create'' button'''
* '''Click on the ''Create'' button'''
[[File:launch-mariadb-secret.png]]


== Create Custom Configurations ==
== Create Custom Configurations ==
Line 47: Line 48:
</pre>
</pre>
* '''Click on the ''Create'' button'''
* '''Click on the ''Create'' button'''
[[File:launch-mariadb-config.png]]


== Create the Deployment ==
== Create the Deployment ==

Revision as of 12:45, 2 October 2025

Introduction

Instructions for deploying a simple MariaDB database service on CS Launch using Docker official images: https://hub.docker.com/u/library

Create Project and Namespace

You will need a project and namespace on CS Launch to deploy your database. See HowTo:CS_Launch for instructions on doing this.

Create Persistence Storage

Your database will need a Persistent Volume Claim to store the data so that it is not lost between restarts.

  • Navigate to your Cluster Dashboard
  • Click on Storage from the menu on the left
  • Click on PersistentVolumeClaims underneath Storage
  • Click on the Create button
  • Fill in Name with a namespace unique name, example: mariadb-pvc
  • Change Request Storage to the size of your storage requirements, example: 1 GiB
  • Click on the Create button

Create Passwords Secret

A secret is a secure way to store your deployments password information.

  • Navigate to your Cluster Dashboard
  • Click on Storage from the menu on the left
  • Click on Secrets underneath Storage
  • Click on the Create button
  • Select the Opaque tile as this type of secret is suited for storing passwords
  • Fill in Name with namespace unique name, example: mariadb-secret
  • Fill in Key with MARIADB_ROOT_PASSWORD
  • Fill in Value with what you want to use as the root password, for example: ChangeMe
  • Fill in additional Keys:
    • MARIADB_DATABASE = test-db
    • MARIADB_USER = test
    • MARIADB_PASSWORD = Insecure
  • Click on the Create button

Create Custom Configurations

You can use a ConfigMap to storage custom configuration options.

  • Navigate to your Cluster Dashboard
  • Click on Storage from the menu on the left
  • Click on ConfigMaps underneath Storage
  • Click on the Create button
  • Fill in Name with namespace unique name, example: mariadb-config
  • Fill in Key with my.cnf
  • Fill in Value with your custom configuration options:
[mariadb]
### Put custom mariadb configurations here
  • Click on the Create button

Create the Deployment

Now you have all the components created, you can create the deployment itself. We will create it as a "Deployment" to make it easier. You can create as a StatefulSet to get a consistent pod name, but it is more work set up initially.

  • Navigate to your Cluster Dashboard
  • Click on Workloads from the menu on the left
  • Click on Deployments underneath Workloads
  • Click on the Create button
  • Fill in Name with the hostname you want other workloads to access the service by, example: mariadb
  • Fill in Container Image with the version of mariadb docker image you want, example: mariadb:lts or use a specific version that you want
  • Click on Add Port or Service button
  • Select Cluster IP from the Service Type drop down list
  • Fill in service Name with a port name example: mariadb
  • Fill in Private Container Port with the database port: 3306
  • Click on Add Variable under Environment Variables
  • Select Secret from the Type drop down list
  • Select mariadb-secret from the Secret drop down list

  • Click on the Deployment tab
  • Click on Scaling and Upgrade Policy under the Deployment tab
  • Select Recreate: kill ALL pods, then start new pods checkbox
    • This tells the cluster to remove pods before restarting because multiple pods can not mount the PVC

  • Click on the Pod tab
  • Click on Storage under the Pod tab
  • Select ConfigMap from the Add Volume drop down list
  • Change VolumeName to configuration
  • Select mariadb-config under the ConfigMap drop down list
  • Select Persistent Volume Claim from the Add Volume drop down list
  • Change VolumeName to data
  • Select mariadb-pvc from the Persistent Volume Claim drop down list

  • Click on container-0 tab
  • Click on Storage under the container-0 tab
  • Select configuration from the Select Volume drop down list
  • Fill in Mount Point with /etc/mysql/conf.d
  • Select data from the Select Volume drop down list
  • Fill in Mount Point with /var/lib/mysql

  • Click on Health Check under the container-0 tab
  • Select Command run inside the container exits with status 0 from the Type drop down list under Readiness Check
  • Change Initial Delay to 30 Sec.
  • Change Timeout to 5 Sec.
  • Fill in Command to run with bash -c 'healthcheck.sh --connect --innodb_initialized'
  • Select Command run inside the container exists with status 0 from the Type drop down list under Liveness Check
  • Change Initial Delay to 120 Sec.
  • Change Timeout to 5 Sec.
  • Fill in Command to run with bash -c 'healthcheck.sh --connect --innodb_initialized'
  • Select Command run inside the container exists with status 0 from the Type drop down list under Startup Check
  • Change Initial Delay to 10 Sec.
  • Change Timeout to 5 Sec.
  • Fill in Command to run with bash -c 'healthcheck.sh --connect --innodb_initialized'
  • Change Failure Threshold to 30

  • Finally, click on the Create button to start your deployment