bob-builds-labs

Deploying a Wordpress Application from code and templates

OpenShift enable developers to deploy services from templates

get the Templates and Parameters

You can view a list of avilable templates with

oc get templates -n openshift

image

To view available Parameters of a Template, use

oc process --parameters -n openshift mariadb-persistent

## Deploy Mariadb from and WP from Source Github

oc new-project wordpress
oc label ns wordpress ppdm_policy=PPDM_GOLD
oc new-app openshift/mariadb-persistent \
-p VOLUME_CAPACITY=10Gi \
-p MYSQL_USER=bobuser \
-p MYSQL_PASSWORD='Password123!' \
-p MYSQL_DATABASE=wordpress \
-p MARIADB_VERSION=latest


oc new-app php~https://github.com/wordpress/wordpress
oc logs -f buildconfig/wordpress
oc expose svc/wordpress
oc get routes

Cofiguring Wordpress

Use the endpoint from the routes command to connect to the Wordpress App

Database name: wordpress
Database username: bobuser
Database password: Password123!
Database host: mariadb

image

Click on Run the Installation

image

Put in whatever you want to Use to Customize your Site and User Info, then click on Install Wordpress image

Advanced Accessing the Database from CLI

export MYSQL_DATABASE=$(oc get secret mariadb -n wordpress -ogo-template='' | base64 -d )
export MYSQL_USER=$(oc get secret mariadb -n wordpress -ogo-template='' | base64 -d )
export MYSQL_PASSWORD=$(oc get secret mariadb -n wordpress -ogo-template='' | base64 -d )
POD=$(oc get pods -l name=mariadb --output=name | awk -F/ '{print $NF}')
oc exec $POD -- bash -c "mysql --user=${MYSQL_USER} --password=${MYSQL_PASSWORD} wordpress -e 'select * from wp_users;'"
oc exec $POD -- bash -c "mysql --user=${MYSQL_USER} --password=${MYSQL_PASSWORD} wordpress -e 'select * from wp_uposts;'"

Back to Index