OpenShift Build and Deploy a JEE Application with S2I: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 1: Line 1:
=Internal=
=Internal=


* [[OpenShift_Build_Operations#Build_and_Deploy_a_JEE_Application|OpenShift Build Operations]]
* [[OpenShift_Build_Operations#Build_and_Deploy_a_JEE_Application|Build Operations]]
* [[OpenShift_Application_Operations#Instantiate_a_Stored_Template|Application Operations]]


=Overview=
=Overview=

Revision as of 08:31, 25 November 2017

Internal

Overview

Process

"Join" Projects

If the source repository pod runs in a collocated OpenShift project, and we want to use the internal DNS name, we need to join the projects.

oadm pod-network join-projects --to=cicd lab

Create the Application

oc new-app <openshift-project-template-name> \
 --param APPLICATION_NAME=<application-name> \
 --param SOURCE_REPOSITORY_URL=<git-url> \ 
 --param SOURCE_REPOSITORY_REF=master \
 --param CONTEXT_DIR=/
oc new-app eap64-basic-s2i \
 --param APPLICATION_NAME=tasks \
 --param SOURCE_REPOSITORY_URL=https://gogs.cicd.svc.cluster.local:3000/gogs/openshift-tasks-private \ 
 --param SOURCE_REPOSITORY_REF=master \
 --param CONTEXT_DIR=/

This command uses openshift project's "eap64-basic-s2i" template and creates:

  • a build configuration
  • an image stream
  • a deployment configuration
  • a route
  • a service

Add Source Repository Secrets

If the source repository is protected, we need to place credentials into the builder configuration, and the builder service account environment:

oc secrets new=basicauth <secret-name> --username=... --password=...
oc secrets link builder <secret-name>
oc set build-secret --source bc/<build-config-name> <secret-name>