Course Hero Logo

2 inspect the php source code for the sample

Course Hero uses AI to attempt to automatically extract content from documents to surface to you and others so you can study better, e.g., in search results, to enrich docs, and more. This preview shows page 203 - 206 out of 348 pages.

2.Inspect the PHP source code for the sample application and create and push a new branchnameds2ito use during this exercise.2.1.Enter your local clone of theDO180-appsGit repository and checkout themasterbranch of the course's repository to ensure you start this exercise from a known goodstate:[[email protected] openshift-s2i]$cd ~/DO180-apps[[email protected] DO180-apps]$git checkout master...output omitted...2.2.Create a new branch to save any changes you make during this exercise:DO180-OCP4.2-en-1-20191105185
Chapter 6|Deploying Containerized Applications on OpenShift[[email protected] DO180-apps]$git checkout -b s2iSwitched to a new branch 's2i'[[email protected] DO180-apps]$git push -u origin s2i...output omitted...* [new branch]s2i -> s2iBranch s2i set up to track remote branch s2i from origin.2.3.Review the PHP source code of the application, inside the thephp-helloworldfolder.Open theindex.phpfile in the/home/student/DO180-apps/php-helloworldfolder:<?phpprint "Hello, World! php version is " . PHP_VERSION . "\n";?>The application implements a simple response which returns the PHP version it isrunning.3.Prepare the lab environment.3.1.Load your classroom environment configuration.Run the following command to load the environment variables created in the firstguided exercise:[[email protected] DO180-apps]$source /usr/local/etc/ocp4.config3.2.Log in to the OpenShift cluster.[[email protected] DO180-apps]$oc login -u ${RHT_OCP4_DEV_USER} -p \>${RHT_OCP4_DEV_PASSWORD} ${RHT_OCP4_MASTER_API}Login successful...output omitted...3.3.Create a new project that contains your RHOCP developer username for the resourcesyou create during this exercise:[[email protected] DO180-apps]$oc new-project ${RHT_OCP4_DEV_USER}-s2i4.Create a new PHP application using Source-to-Image from thephp-helloworlddirectory using thes2ibranch you created in the previous step in your fork of the DO180-apps Git repository.4.1.Use theoc new-appcommand to create the PHP application.ImportantThe following example uses the number sign (#) to select a speicific branch fromthe git repository, in this case thes2ibranch created in the previous step.186DO180-OCP4.2-en-1-20191105
Chapter 6|Deploying Containerized Applications on OpenShift[[email protected] DO180-apps]$oc new-app -i php:7.1 --name=php-helloworld \>{RHT_OCP4_GITHUB_USER}/DO180-apps#s2i \>--context-dir php-helloworld4.2.Wait for the build to complete and the application to deploy. Verify that the buildprocess starts with theoc get podscommand.[[email protected] openshift-s2i]$oc get podsNAMEREADYSTATUSRESTARTSAGEphp-helloworld-1-build1/1Running05s4.3.Examine the logs for this build. Use the build pod name for this build,php-helloworld-1-build.[[email protected] DO180-apps]$oc logs --all-containers \>-f php-helloworld-1-buildCloning "yourgituser/DO180-apps" ...

Upload your study docs or become a

Course Hero member to access this document

Upload your study docs or become a

Course Hero member to access this document

End of preview. Want to read all 348 pages?

Upload your study docs or become a

Course Hero member to access this document

Term
Spring
Professor
N/A
Tags

Newly uploaded documents

Show More

Newly uploaded documents

Show More

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture