Demo: Creating an ephemeral instance of MySQL in OpenShift
This repository is to accompany a blog post at developers.redhat.com that instructs how to create an ephemeral MySQL instance in OpenShift 4.x. This repo can be used standalone, but it really sings when used with the blog post.
Like everything else we do at Red Hat, it's open source and open to pull requests.
./openshift-install create cluster
oc new-project mysql-test
oc new-app mysql-ephemeral --name mysql
NOTE that you must change the user and password values in the following script before running it.
$PROJECT-HOME/scripts/create-customer.ps1
$PROJECT-HOME/scripts/create-customer.sh
Note: The variables 'MYSQL_USER' and 'MYSQL_PASSWORD' are determined by the values returned after you create the ephemeral MySQL application, above.
oc new-app https://github.com/redhat-developer-demos/mysql-openshift-ephemeral.git --context-dir=src/getCustomer --name getcustomer -e MYSQL_HOST=mysql -e MYSQL_DATABASE=sampledb -e MYSQL_USER=userP1F -e MYSQL_PASSWORD=eRwTuVSW1MhsIUHw
Note: The variables 'MYSQL_USER' and 'MYSQL_PASSWORD' are determined by the values returned after you create the ephemeral MySQL application, above.
oc new-app https://github.com/redhat-developer-demos/mysql-openshift-ephemeral.git --context-dir=src/getCustomerSummaryList --name getcustomersummarylist -e MYSQL_HOST=mysql -e MYSQL_DATABASE=sampledb -e MYSQL_USER=userP1F -e MYSQL_PASSWORD=eRwTuVSW1MhsIUHw
This will pull a Linux image from a registry. This is being done to demonstrate the versatility of the OpenShift application build feature.
oc new-app --name mvccustomer --docker-image=quay.io/donschenck/mvccustomer:latest -e GET_CUSTOMER_SUMMARY_LIST_URI="http://getcustomersummarylist:8080/customers" -e GET_CUSTOMER_URI="http://getcustomer:8080/customer"
oc expose service mvccustomer --insecure-skip-tls-verify=false
Get the route, then open it in your browser:
oc get routes