User Tools

Site Tools


tech:openshift:start

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
tech:openshift:start [2018/06/24 15:12]
admin
tech:openshift:start [2019/01/05 16:52] (current)
rk4n3
Line 1: Line 1:
 <typo fs:​xx-large;​ fw: bold;>​OpenShift</​typo>​ <typo fs:​xx-large;​ fw: bold;>​OpenShift</​typo>​
 +
 +<​code>​oc import-image <NAME OF STREAM></​code>​
  
 ====== Resources ====== ====== Resources ======
 +[[https://​docs.docker.com/​develop/​develop-images/​dockerfile_best-practices|Dockerfile Best Practices]] \\
 +
 [[https://​www.clouda.ca/​blog/​general/​openshift-on-centos-7-quick-installation|OpenShift on CentOS 7]] \\ [[https://​www.clouda.ca/​blog/​general/​openshift-on-centos-7-quick-installation|OpenShift on CentOS 7]] \\
 [[https://​github.com/​openshift/​origin#​getting-started|OpenShift ''​Getting Started''​ on GitHub]] \\ [[https://​github.com/​openshift/​origin#​getting-started|OpenShift ''​Getting Started''​ on GitHub]] \\
Line 30: Line 34:
   * Remove image:<​code>​docker image rm bluejay-loadgen</​code>​   * Remove image:<​code>​docker image rm bluejay-loadgen</​code>​
  
 +------
 +===== Example: Resurrect Bluejay in OpenShift =====
 +  * Set up OpenShift cluster, and start with ''​rc.openshift start''​
 +    * The ''​rc.openshift''​ wrapper calls ''​oc cluster up''​ with args
 +  * Initialize service account<​code>​oc create serviceaccount bluejay
 +oc policy add-role-to-user system:​image-builder -z bluejay
 +oc policy add-role-to-user admin -z bluejay
 +oc sa get-token bluejay</​code>​
 +    * Populate the token into ''​~bluejay/​.bluejayrc''​
 +  * Ensure access to OpenShift docker repo<​code>​docker login -u yourlogin -p $(oc whoami -t) 172.30.1.1:​5000</​code>​
 +  * Build, tag, and push JMeter image<​code>​cd ~/​src/​bluejay/​s2ijm ; make
 +docker tag <​newimage>​ 172.30.1.1:​5000/​bluejay/​jmeter
 +docker push 172.30.1.1:​5000/​bluejay/​jmeter</​code>​
 +  * Build, tag, and push Locust image<​code>​cd ~/​src/​bluejay/​s2iloc ; make
 +docker tag <​newimage>​ 172.30.1.1:​5000/​bluejay/​locust
 +docker push 172.30.1.1:​5000/​bluejay/​locust</​code>​
 +  * Build, tag, and push Maven image<​code>​cd ~/​src/​bluejay/​s2imvn ; make
 +docker tag <​newimage>​ 172.30.1.1:​5000/​bluejay/​maven
 +docker push 172.30.1.1:​5000/​bluejay/​maven</​code>​
 +  * Build, tag, and push Gatling image<​code>​cd ~/​src/​bluejay/​s2igat ; make
 +docker tag <​newimage>​ 172.30.1.1:​5000/​bluejay/​gatling
 +docker push 172.30.1.1:​5000/​bluejay/​gatling</​code>​
 +  * Create image streams<​code>​cd ~/​src/​bluejay/​etc
 +oc create -f loadctl.json
 +oc create -f loadloc.json
 +oc create -f loadmvn.json
 +oc create -f loadgat.json</​code>​
 +  * Create load-gen build configs \\ //Remember to set LDAP credentials in YAML files//<​code>​cd ~/​src/​bluejay/​etc
 +oc create -f bld-loadctl.yaml
 +oc create -f bld-loadloc.yaml
 +oc create -f bld-loadmvn.yaml
 +oc create -f bld-loadgat.yaml</​code>​
 +  * Verify build completions and image streams
 +  * Add OAPT storage \\ //Remember to make it "​shared",​ use name like ''​oaptpubrpt201''//​
 +  * Add OAPT application
 +    * Add OAPT storage at mount path ''/​opt/​app-root/​pub''​
 +
 +------
 ====== Trivia ====== ====== Trivia ======
 +
 +===== Installation:​ Docker & OC CLI =====
 +  * In /​etc/​yum.repos.d/​docker.repo<​code>​[dockerrepo]
 +name=Docker Repository
 +baseurl=https://​yum.dockerproject.org/​repo/​main/​centos/​7
 +enabled=1
 +gpgcheck=1
 +gpgkey=https://​yum.dockerproject.org/​gpg</​code>​
 +  * ''​yum install docker-engine''​
 +  * ''​usermod -aG docker msamud1''​
 +  * ''​chkconfig docker on''​
 +  * Install S2I:  download and extract to /​usr/​local/​bin ...<​code>​wget https://​github.com/​openshift/​source-to-image/​releases/​download/​v1.1.10/​source-to-image-v1.1.10-27f0729d-linux-amd64.tar.gz</​code>​
 +  * OpenShift CLI client (oc):
 +    * Requires active RHEL subscription to download
 +    * Once downloaded, extract "​oc"​ from archive into /​usr/​local/​bin
  
 ===== PoC/​Exploration Notes ===== ===== PoC/​Exploration Notes =====
-===== Some URLs researched ... ===== +==== Some URLs researched ... ==== 
-http://​www.testautomationguru.com/​jmeter-distributed-load-testing-using-docker/​ +http://​www.testautomationguru.com/​jmeter-distributed-load-testing-using-docker/ ​\\ 
-https://​hub.docker.com/​_/​openjdk/​ +https://​hub.docker.com/​_/​openjdk/ ​\\ 
-https://​eleanordare.com/​blog/​2018/​5/​3/​using-a-jenkins-pipeline-to-run-jmeter-tests-in-openshift-bkba6 +https://​eleanordare.com/​blog/​2018/​5/​3/​using-a-jenkins-pipeline-to-run-jmeter-tests-in-openshift-bkba6 ​\\ 
-https://​eleanordare.com/​blog/​2017/​6/​14/​using-a-jenkins-pipeline-to-run-jmeter-tests-in-openshift +https://​eleanordare.com/​blog/​2017/​6/​14/​using-a-jenkins-pipeline-to-run-jmeter-tests-in-openshift ​\\ 
-https://​blog.openshift.com/​running-any-docker-image-on-openshift-origin/​ +https://​blog.openshift.com/​remotely-push-pull-container-images-openshift \\ 
-https://​docs.openshift.com/​online/​architecture/​core_concepts/​builds_and_image_streams.html#​pipeline-build +https://​docs.openshift.org/​latest/​dev_guide/​jobs.html \\ 
-https://​docs.openshift.com/​online/​dev_guide/​application_lifecycle/​new_app.html#​dev-guide-new-app +https://​docs.openshift.com/​enterprise/​3.0/​architecture/​core_concepts/​builds_and_image_streams.html \\ 
-https://​docs.openshift.com/​online/​dev_guide/​index.html +https://​blog.openshift.com/​running-any-docker-image-on-openshift-origin/ ​\\ 
-https://​blog.openshift.com/​getting-any-docker-image-running-in-your-own-openshift-cluster/​+https://​docs.openshift.com/​online/​architecture/​core_concepts/​builds_and_image_streams.html#​pipeline-build ​\\ 
 +https://​docs.openshift.com/​online/​dev_guide/​application_lifecycle/​new_app.html#​dev-guide-new-app ​\\ 
 +https://​docs.openshift.com/​online/​dev_guide/​index.html ​\\ 
 +https://​docs.openshift.com/​online/​dev_guide/​builds/​build_inputs.html#​image-source \\ 
 +https://​docs.openshift.com/​online/​dev_guide/​application_lifecycle/​new_app.html \\ 
 +https://​blog.openshift.com/​getting-any-docker-image-running-in-your-own-openshift-cluster/ ​\\ 
 +https://​blog.openshift.com/​openshift-jobs \\ 
 +https://​docs.openshift.com/​online/​rest_api/​apis-batch/​v1.Job.html \\ 
 + 
 +==== Initial PoC at Optum'​s OpenShift ==== 
 +  * Ensure that docker-engine is installed on Linux XaaS VM 
 +  * Log in to DTR (Docker Trusted Registry) \\ ''​docker login docker.optum.com''​ 
 +  * Pull existing repository (previously created in web GUI) \\ ''​docker pull docker.optum.com/​msamud1/​bluejay-jmeter''​ 
 +  * Build new image using S2I (S2I build is another topic) 
 +  * Tag new image in local registry \\ ''​docker tag <​newimageid>​ docker.optum.com/​msamud1/​bluejay-jmeter''​ 
 +  * Push to DTR \\ ''​docker push docker.optum.com/​msamud1/​bluejay-jmeter''​ 
 + 
 +//**NOTE:** these commands assume being run from $HOME/​src/​bluejay ... // \\ 
 +  * Log in to Optum'​s OpenShift (this is elk river non-prod) \\ ''​oc login https://​ocp-elr-core-nonprod.optum.com''​ 
 +  * Create image stream for base JMeter builder image \\ ''​oc create -f ./​etc/​jmeter.yaml''​ 
 +  * Create image stream for app-specific load controller \\ ''​oc create -f ./​etc/​timbrado.json''​ 
 +  * Create image stream for load generator(s) \\ ''​oc create -f ./​etc/​loadgen.json''​ 
 +  * Create BuildConfig for app-specific load controller \\ ''​oc create -f ./​etc/​bld-timbrado.json''​ 
 +  * Create BuildConfig for load generator(s) \\ ''​oc create -f ./​etc/​bld-loadgen.json''​ 
 +  * Run a job: \\ ''​oc create -f ./​etc/​job-launch.yaml''​
  
 ===== Misc ... ===== ===== Misc ... =====
tech/openshift/start.1529871167.txt.gz · Last modified: 2018/06/24 15:12 by admin