/openshift-jee-sample

A sample app to be deployed on openshift environments

Primary LanguageHTML

Note: Git is a prereq

  1. Download the openshift-origin-client-tools for your OS: https://github.com/openshift/origin/releases/tag/v3.6.1

  2. Fork this repo: https://github.com/danmcp/openshift-jee-sample

  3. git clone https://github.com/<userid>/openshift-jee-sample.git

  4. cd openshift-jee-sample

  5. Login to web console: http://bit.ly/anz-openshift

  6. Create a project and give it a unique name

  7. Open Metrics URL and accept the cert warnings

  8. Add To Project -> Browse Catalog -> Java -> Red Hat JBoss EAP -> Red Hat JBoss EAP 7.0

    • Name: somethingcool
    • Git Repository URL: https://github.com/<userid>/openshift-jee-sample.git
    • Blank out Git Reference and Context Dir
  9. oc login https://ocplabs.australiasoutheast.cloudapp.azure.com:8443

  10. oc set env dc/somethingcool AUTO_DEPLOY_EXPLODED=true

  11. oc get pods

  12. oc rsync target/SampleApp.war/ <pod_name>:/deployments/SampleApp.war --watch

  13. Browse to SampleApp/HelloWorld

  14. Make a change to HelloWorld and/or HelloWorldHelper.java

  15. Browse to SampleApp/HelloWorld

  16. oc set env dc/somethingcool DEBUG=true

  17. oc get pods

  18. oc port-forward <pod_name> 8787:8787

  19. oc rsync target/SampleApp.war/ <pod_name>:/deployments/SampleApp.war

  20. Set a break point and browse to SampleApp/HelloWorld

  21. Change danmcp in pipeline.yaml to be your github login

  22. oc create -f https://raw.githubusercontent.com/<userid>/openshift-jee-sample/master/pipeline.yaml

  23. Modify Jenkinsfile inside of node(maven):

       //stage('build') {
       //  git url: "https://github.com/<userid>/openshift-jee-sample.git"
       //  openshiftBuild(buildConfig: 'somethingcool', showBuildLogs: 'true')
       //}
       stage('test') {
         git url: "https://github.com/<userid>/openshift-jee-sample.git"
         //sh "mvn verify"
         sh "mvn clean"
       }
       stage('approval') {
         input "Approve?"
       }
       stage('deploy') {
         openshiftDeploy(deploymentConfig: 'somethingcool')
       }
       stage('scale') {
         openshiftScale(deploymentConfig: 'somethingcool', replicaCount: '2')
       }
       stage('system test') {
         //sh "sleep 10"
         sh "curl http://somethingcool:8080 | grep WildFly"
       }
    
  24. git add .

  25. git commit -m 'Adding stages'

  26. git push origin master